@stacksjs/buddy 0.75.515 → 0.75.518
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/dist/app-store-connect.js +2 -2
- package/dist/cli.js +4 -4
- package/dist/cloud-tenants.js +1 -1
- package/dist/commands/about.js +1 -1
- package/dist/commands/add.js +1 -1
- package/dist/commands/ai-access.js +2 -2
- package/dist/commands/ai-context.js +2 -2
- package/dist/commands/auth-prune-options.js +1 -1
- package/dist/commands/auth.js +1 -1
- package/dist/commands/build.js +1 -1
- package/dist/commands/cd.js +3 -3
- package/dist/commands/changelog.js +1 -1
- package/dist/commands/clean.js +1 -1
- package/dist/commands/cloud.js +7 -7
- package/dist/commands/comments.js +2 -2
- package/dist/commands/commerce-import.js +3 -3
- package/dist/commands/commit.js +1 -1
- package/dist/commands/completion.js +7 -7
- package/dist/commands/config-migrate.js +5 -5
- package/dist/commands/configure.js +2 -2
- package/dist/commands/create.js +1 -1
- package/dist/commands/db.js +1 -1
- package/dist/commands/deploy-fly.js +2 -2
- package/dist/commands/deploy-preview.js +1 -1
- package/dist/commands/deploy-ssh-target.js +1 -1
- package/dist/commands/deploy.js +588 -19
- package/dist/commands/desktop-apple.js +12 -12
- package/dist/commands/desktop-probe.js +1 -1
- package/dist/commands/dev.js +4 -4
- package/dist/commands/dns.js +2 -2
- package/dist/commands/docs/agent-counts.js +2 -2
- package/dist/commands/docs/buddy-commands.js +11 -11
- package/dist/commands/docs/capabilities.js +2 -2
- package/dist/commands/docs/desktop-matrix.js +2 -2
- package/dist/commands/docs/framework-repo.js +1 -1
- package/dist/commands/docs/generated-artifacts.js +3 -3
- package/dist/commands/docs/links.js +2 -2
- package/dist/commands/docs/native-skills.js +2 -2
- package/dist/commands/docs/snippets.js +7 -7
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/domains.js +2 -2
- package/dist/commands/email.js +26 -26
- package/dist/commands/env.js +1 -1
- package/dist/commands/extension.js +3 -3
- package/dist/commands/features.js +3 -3
- package/dist/commands/feedback.js +3 -3
- package/dist/commands/fresh.js +1 -1
- package/dist/commands/gdpr.js +6 -6
- package/dist/commands/generate.js +5 -5
- package/dist/commands/http.js +1 -1
- package/dist/commands/install.js +1 -1
- package/dist/commands/integrations-probe.js +2 -2
- package/dist/commands/key.js +1 -1
- package/dist/commands/libs.js +1 -1
- package/dist/commands/link.js +2 -2
- package/dist/commands/lint.js +2 -2
- package/dist/commands/list.js +2 -2
- package/dist/commands/mail.js +13 -13
- package/dist/commands/maintenance.js +1 -1
- package/dist/commands/make.js +1 -1
- package/dist/commands/migrate-project.js +1 -1
- package/dist/commands/migrate.js +59 -59
- package/dist/commands/outdated.js +1 -1
- package/dist/commands/package.js +1 -1
- package/dist/commands/phone.js +13 -13
- package/dist/commands/ports.js +2 -2
- package/dist/commands/prepublish.js +1 -1
- package/dist/commands/preview-deploy.js +1 -1
- package/dist/commands/projects.js +1 -1
- package/dist/commands/publish.js +8 -8
- package/dist/commands/queue.js +1 -1
- package/dist/commands/release.js +7 -7
- package/dist/commands/route.js +1 -1
- package/dist/commands/saas.js +1 -1
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/search.js +1 -1
- package/dist/commands/security.js +2 -2
- package/dist/commands/seed.js +1 -1
- package/dist/commands/serve.js +1 -1
- package/dist/commands/server-image.js +2 -2
- package/dist/commands/server-trust.js +2 -2
- package/dist/commands/server.js +10 -8
- package/dist/commands/setup-ai.js +2 -2
- package/dist/commands/setup.js +5 -5
- package/dist/commands/share.js +1 -1
- package/dist/commands/simulator.js +1 -1
- package/dist/commands/sms.js +25 -25
- package/dist/commands/socials.js +3 -3
- package/dist/commands/stacks.js +1 -1
- package/dist/commands/storage-backup.js +1 -1
- package/dist/commands/telemetry.js +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/tinker.js +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/upgrade.js +1 -1
- package/dist/commands/user.js +2 -2
- package/dist/config.js +1 -1
- package/dist/custom-cli.js +1 -1
- package/dist/database-backup.js +2 -2
- package/dist/database-preflight.js +1 -1
- package/dist/deploy-notify.js +3 -3
- package/dist/deployment-inputs.js +1 -1
- package/dist/deployment-revision.js +4 -4
- package/dist/dns-credentials.js +1 -1
- package/dist/email-reprocess.js +1 -1
- package/dist/feedback-links.js +1 -1
- package/dist/global-options.js +1 -1
- package/dist/lazy-commands.js +1 -1
- package/dist/mail-dns-health.js +1 -1
- package/dist/mail-users.js +1 -1
- package/dist/migrators/index.js +1 -1
- package/dist/migrators/laravel/index.js +1 -1
- package/dist/migrators/laravel/migrations.js +4 -4
- package/dist/migrators/laravel/models.js +4 -4
- package/dist/native-project.js +7 -7
- package/dist/native-site.js +2 -2
- package/dist/pantry-service-ports.js +2 -2
- package/dist/production-server.js +1 -1
- package/dist/project-setup.js +1 -1
- package/dist/publish-stx.js +1 -1
- package/dist/registry.js +1 -1
- package/dist/release-ios.js +1 -1
- package/dist/result.js +1 -1
- package/dist/scaffold-app.js +4 -4
- package/dist/scaffold-desktop.js +1 -1
- package/dist/scaffold-package-app.js +7 -7
- package/dist/scaffold-site.js +1 -1
- package/dist/storage-backup.js +1 -1
- package/dist/system-dependencies.js +1 -1
- package/dist/unbacked-data.js +1 -1
- package/dist/unvendor-rewrite.js +2 -2
- package/dist/version-info.js +1 -1
- package/dist/workflow-prune.js +3 -3
- package/package.json +55 -55
package/dist/publish-stx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{globSync}from"@stacksjs/storage";import{defaultsSpecifier}from"./scaffold-package-app";export const COMPONENT_TREE={from:"resources/components",to:"resources/components"}
|
|
1
|
+
import{existsSync}from"node:fs";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{globSync}from"@stacksjs/storage";import{defaultsSpecifier}from"./scaffold-package-app";export const COMPONENT_TREE={from:"resources/components",to:"resources/components"};export const VIEW_TREES=[{from:"views/dashboard",to:"resources/views/dashboard"},{from:"views/system-tray",to:"resources/views/system-tray"},{from:"resources/views",to:"resources/views"}];function normalizeName(name){const cleaned=name.trim().replace(/\\/g,"/").replace(/^\/+/,"").replace(/\.stx$/,"");if(!cleaned||cleaned.split("/").includes(".."))return;return cleaned}function locateComponent(name,defaultsRoot,projectRoot){const tree=COMPONENT_TREE;const base=join(defaultsRoot,tree.from);const matches=existsSync(join(base,`${name}.stx`))?[`${name}.stx`]:name.includes("/")?[]:globSync([`**/${name}.stx`],{cwd:base}).sort();if(matches.length===0)return{ok:false,message:`Could not find a default component named ${name}`,details:[`Looked under: ${base}`]};if(matches.length>1){return{ok:false,message:`${matches.length} default components are named ${name}. Pass the one you mean by its path:`,details:matches.map((match)=>`buddy publish:component ${match.replace(/\.stx$/,"")}`)}}const relativePath=matches[0];return{ok:true,source:join(base,relativePath),target:join(projectRoot,tree.to,relativePath)}}function locateView(name,defaultsRoot,projectRoot){const looked=[];for(const tree of VIEW_TREES){const prefix=tree.to.slice("resources/views".length).replace(/^\//,"");if(prefix&&name!==prefix&&!name.startsWith(`${prefix}/`))continue;const inTree=prefix?name.slice(prefix.length).replace(/^\//,""):name;const base=join(defaultsRoot,tree.from);looked.push(base);const candidates=inTree?[`${inTree}.stx`,`${inTree}/index.stx`]:["index.stx"];for(const relativePath of candidates){if(!existsSync(join(base,relativePath)))continue;return{ok:true,source:join(base,relativePath),target:join(projectRoot,tree.to,relativePath)}}}return{ok:false,message:`Could not find a default view at ${name}`,details:looked.map((dir)=>`Looked under: ${dir}`)}}export function locateDefaultStx(kind,name,defaultsRoot,projectRoot){const normalized=normalizeName(name);if(!normalized)return{ok:false,message:`Not a ${kind} name: ${name}`,details:[]};return kind==="component"?locateComponent(normalized,defaultsRoot,projectRoot):locateView(normalized,defaultsRoot,projectRoot)}const RELATIVE_IMPORT=/(\bfrom\s+|\bimport\s*\(\s*|^\s*import\s+)(['"])(\.{1,2}\/[^'"]+)\2/gm;export function pointImportsAtDefaults(source,sourcePath,defaultsRoot){let rewritten=0;const code=source.replace(RELATIVE_IMPORT,(match,lead,quote,specifier)=>{const inTree=relative(defaultsRoot,resolve(dirname(sourcePath),specifier));if(!inTree||inTree.startsWith("..")||isAbsolute(inTree))return match;rewritten++;return`${lead}${quote}${defaultsSpecifier(inTree.replace(/\\/g,"/"))}${quote}`});return{code,rewritten}}
|
package/dist/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function fetchPublishedVersions(depName){const response=await fetch(`https://registry.npmjs.org/${depName.replace("/","%2F")}`,{headers:{accept:"application/vnd.npm.install-v1+json"}});if(!response.ok)throw Error(`registry responded ${response.status}`);const packument=await response.json();return{latest:packument["dist-tags"]?.latest,versions:new Set(Object.keys(packument.versions??{}))}}
|
|
1
|
+
export async function fetchPublishedVersions(depName){const response=await fetch(`https://registry.npmjs.org/${depName.replace("/","%2F")}`,{headers:{accept:"application/vnd.npm.install-v1+json"}});if(!response.ok)throw new Error(`registry responded ${response.status}`);const packument=await response.json();return{latest:packument["dist-tags"]?.latest,versions:new Set(Object.keys(packument.versions??{}))}}
|
package/dist/release-ios.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{incrementVersion,nextBuildNumber,SemVer}from"@stacksjs/bumpx";import{isLocalSite}from"@stacksjs/actions/build/mobile-target";import{execFileSync}from"node:child_process";function marketingVersion(version){const parsed=new SemVer(version);if(parsed.prerelease.length||parsed.build.length||parsed.toString()!==version)throw Error("An iOS marketing version must be a stable version such as 1.0.0");return parsed.toString()}function iosBlock(source){const start=source.search(/\bios\s*:\s*\{/);if(start===-1)return null;const after=source.slice(start+1).search(/\n\s*(?:android|desktop|watch|web)\s*:\s*\{/);return{start,end:after===-1?source.length:start+1+after}}const VERSION_ENTRY=/(\bversion\s*:\s*(?:[^,\n]*?\?\?\s*)?)(['"])(\d+\.\d+\.\d+)\2/;export function iosVersionIn(source){const block=iosBlock(source);if(!block)return null;return VERSION_ENTRY.exec(source.slice(block.start,block.end))?.[3]??null}export function withIosVersion(source,version){marketingVersion(version);const block=iosBlock(source);if(!block||!VERSION_ENTRY.test(source.slice(block.start,block.end)))throw Error("config/mobile.ts declares no iOS `version`");const ios=source.slice(block.start,block.end).replace(VERSION_ENTRY,(_,lead,quote)=>`${lead}${quote}${version}${quote}`);return source.slice(0,block.start)+ios+source.slice(block.end)}export function bumpedVersion(current,bump){marketingVersion(current);if(bump==="build")return current;if(["patch","minor","major"].includes(bump))return marketingVersion(incrementVersion(current,bump));return marketingVersion(bump)}export function nextBuildTag(version,tags,latestRun){marketingVersion(version);const prefix=`v${version}-build.`;if(latestRun!==
|
|
1
|
+
import{incrementVersion,nextBuildNumber,SemVer}from"@stacksjs/bumpx";import{isLocalSite}from"@stacksjs/actions/build/mobile-target";import{execFileSync}from"node:child_process";function marketingVersion(version){const parsed=new SemVer(version);if(parsed.prerelease.length||parsed.build.length||parsed.toString()!==version)throw new Error("An iOS marketing version must be a stable version such as 1.0.0");return parsed.toString()}function iosBlock(source){const start=source.search(/\bios\s*:\s*\{/);if(start===-1)return null;const after=source.slice(start+1).search(/\n\s*(?:android|desktop|watch|web)\s*:\s*\{/);return{start,end:after===-1?source.length:start+1+after}}const VERSION_ENTRY=/(\bversion\s*:\s*(?:[^,\n]*?\?\?\s*)?)(['"])(\d+\.\d+\.\d+)\2/;export function iosVersionIn(source){const block=iosBlock(source);if(!block)return null;return VERSION_ENTRY.exec(source.slice(block.start,block.end))?.[3]??null}export function withIosVersion(source,version){marketingVersion(version);const block=iosBlock(source);if(!block||!VERSION_ENTRY.test(source.slice(block.start,block.end)))throw new Error("config/mobile.ts declares no iOS `version`");const ios=source.slice(block.start,block.end).replace(VERSION_ENTRY,(_,lead,quote)=>`${lead}${quote}${version}${quote}`);return source.slice(0,block.start)+ios+source.slice(block.end)}export function bumpedVersion(current,bump){marketingVersion(current);if(bump==="build")return current;if(["patch","minor","major"].includes(bump))return marketingVersion(incrementVersion(current,bump));return marketingVersion(bump)}export function nextBuildTag(version,tags,latestRun){marketingVersion(version);const prefix=`v${version}-build.`;if(latestRun!==undefined){const tag=`${prefix}${nextBuildNumber(latestRun)}`;if(tags.includes(tag))throw new Error(`${tag} already exists, but Xcode Cloud has not allocated that run. Reconcile the release tags with Xcode Cloud before releasing; a larger tag would misidentify the TestFlight build.`);return tag}const builds=tags.filter((tag)=>tag.startsWith(prefix)).map((tag)=>tag.slice(prefix.length)).filter((number)=>/^[1-9]\d*$/.test(number)).map(Number).filter(Number.isSafeInteger);return`${prefix}${nextBuildNumber(0,builds)}`}export function pushIosReleaseTag(cwd,tag){const git=(...args)=>execFileSync("git",args,{cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();git("tag","-a",tag,"-m",tag);const createdTag=git("rev-parse",`refs/tags/${tag}`);try{git("push","--quiet","--atomic","origin","main",tag)}catch(error){try{const remote=git("ls-remote","--tags","origin",`refs/tags/${tag}`);if(!remote)git("update-ref","-d",`refs/tags/${tag}`,createdTag)}catch{}throw error}}export function iosReleaseSummary(tag,options){const match=/^v(\d+\.\d+\.\d+)-build\.(\d+)$/.exec(tag);if(!match)throw new Error(`${tag} is not an iOS build tag (v<version>-build.<n>)`);const[,version,build]=match;return{name:`${version} (build ${build})`,body:options.numberedByXcodeCloud?`Version ${version}, TestFlight build **${build}**: Xcode Cloud builds this tag, and its run number is the build number TestFlight shows.`:`Version ${version}, build tag ${build}. Xcode Cloud builds this tag; it was cut without an App Store Connect key, so the build number TestFlight shows may differ.`}}export function unreleasableSite(craftConfig){const site=craftConfig.devServerURL;if(typeof site!=="string"||!site)return null;let url;try{url=new URL(site)}catch{return`devServerURL ${JSON.stringify(site)} is not a URL`}return isLocalSite(url)?`devServerURL ${url.origin}${url.pathname} is a local address, which a tester's phone cannot reach`:null}
|
package/dist/result.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function resultFailed(result){if(!result||typeof result!=="object")return
|
|
1
|
+
export function resultFailed(result){if(!result||typeof result!=="object")return false;const candidate=result;return typeof candidate.isErr==="function"?candidate.isErr():Boolean(candidate.isErr)}export function resultError(result,fallback="Unknown error"){if(!result||typeof result!=="object")return fallback;const error=result.error;if(error instanceof Error)return error.message;if(typeof error==="string"&&error)return error;return error===undefined||error===null?fallback:String(error)}export function reportFailure(result,fallback){process.stderr.write(`${resultError(result,fallback)}
|
|
2
2
|
`);process.exit(1)}
|
package/dist/scaffold-app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{existsSync,readFileSync,rmSync,writeFileSync}from"node:fs";import{join}from"node:path";export function appIdentity(path){const slug=path.replace(/\/+$/,"").split("/").pop()||"stacks-app"
|
|
1
|
+
import{existsSync,readFileSync,rmSync,writeFileSync}from"node:fs";import{join}from"node:path";export function appIdentity(path){const slug=path.replace(/\/+$/,"").split("/").pop()||"stacks-app";const words=slug.split(/[^a-z0-9]+/i).filter(Boolean);const displayName=words.map((word)=>`${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ")||"My App";const kebab=words.join("-").toLowerCase().replace(/^[^a-z]+/,"")||"app";return{slug,displayName,kebab,snake:kebab.replaceAll("-","_"),bundleId:`com.example.${kebab}`}}export function templatePlaceholders(identity){return{__APP_NAME__:identity.displayName,__APP_SLUG__:identity.slug,__APP_TAG_PREFIX__:identity.kebab,__APP_BUNDLE_ID__:identity.bundleId}}export function renderTemplate(source,identity){let rendered=source;for(const[placeholder,value]of Object.entries(templatePlaceholders(identity)))rendered=rendered.replaceAll(placeholder,value);return rendered}export function appEnvValues(identity){return{APP_NAME:`"${identity.displayName.replaceAll('"',"")}"`,APP_URL:`${identity.kebab}.localhost`,DB_DATABASE:identity.snake,MAIL_FROM_ADDRESS:`"no-reply@${identity.kebab}.localhost"`,QUEUE_PREFIX:`${identity.snake}:queue`,PREDICTHQ_DB_PASSWORD:null}}export function applyAppEnvTemplate(root,identity){const file=join(root,".env.example");if(!existsSync(file))return[];const values=appEnvValues(identity);const changed=[];const lines=readFileSync(file,"utf8").split(`
|
|
2
2
|
`).flatMap((line)=>{const key=/^([A-Z0-9_]+)=/.exec(line)?.[1];if(!key||!(key in values))return[line];changed.push(key);const value=values[key];return value===null?[]:[`${key}=${value}`]});writeFileSync(file,lines.join(`
|
|
3
|
-
`));return changed}export function appPackageValues(identity){return{name:identity.kebab,version:"0.0.0",description:identity.displayName,author:
|
|
4
|
-
`);return changed}export function removeFrameworkLicense(root){const file=join(root,"LICENSE.md");if(!existsSync(file)||!readFileSync(file,"utf8").includes("Open Web Foundation"))return
|
|
5
|
-
`);return
|
|
3
|
+
`));return changed}export function appPackageValues(identity){return{name:identity.kebab,version:"0.0.0",description:identity.displayName,author:undefined,contributors:undefined,funding:undefined,homepage:undefined,repository:undefined,bugs:undefined,license:undefined}}export function applyAppPackageTemplate(root,identity){const file=join(root,"package.json");if(!existsSync(file))return[];const pkg=JSON.parse(readFileSync(file,"utf8"));const changed=[];for(const[key,value]of Object.entries(appPackageValues(identity))){if(value===undefined){if(key in pkg){delete pkg[key];changed.push(key)}}else if(pkg[key]!==value){pkg[key]=value;changed.push(key)}}writeFileSync(file,`${JSON.stringify(pkg,null,2)}
|
|
4
|
+
`);return changed}export function removeFrameworkLicense(root){const file=join(root,"LICENSE.md");if(!existsSync(file)||!readFileSync(file,"utf8").includes("Open Web Foundation"))return false;rmSync(file);return true}const FRAMEWORK_PUBLISH_RULE=/^- Publish completed work to [\s\S]*?(?=\n\n|\n- |\n#)/m;export const APP_PUBLISH_RULE="- Only commit or push when asked.";export function applyAppAgentsTemplate(root){const file=join(root,"AGENTS.md");if(!existsSync(file))return false;const raw=readFileSync(file,"utf8");const next=raw.replace(FRAMEWORK_PUBLISH_RULE,APP_PUBLISH_RULE);if(next===raw)return false;writeFileSync(file,next);return true}export function applyAppChangelogTemplate(root,identity){const file=join(root,"CHANGELOG.md");if(!existsSync(file))return false;writeFileSync(file,`# ${identity.displayName} Changelog
|
|
5
|
+
`);return true}
|
package/dist/scaffold-desktop.js
CHANGED
|
@@ -51,5 +51,5 @@ onMount(async () => {
|
|
|
51
51
|
* Whatever this file imports is compiled into the built app.
|
|
52
52
|
*/
|
|
53
53
|
route.get('/api/desktop/status', () => response.json({ app: ${name}, ok: true }))
|
|
54
|
-
`}}export function scaffoldDesktopApp(root,identity){const written=[];for(const[file,content]of Object.entries(desktopScaffoldFiles(identity))){const target=join(root,file);if(existsSync(target))continue;mkdirSync(dirname(target),{recursive
|
|
54
|
+
`}}export function scaffoldDesktopApp(root,identity){const written=[];for(const[file,content]of Object.entries(desktopScaffoldFiles(identity))){const target=join(root,file);if(existsSync(target))continue;mkdirSync(dirname(target),{recursive:true});writeFileSync(target,content);written.push(file)}const manifest=join(root,"package.json");if(existsSync(manifest)){const source=readFileSync(manifest,"utf8");const pkg=JSON.parse(source);const missing=Object.entries(DESKTOP_SCRIPTS).filter(([script])=>!pkg.scripts?.[script]);if(missing.length){pkg.scripts={...pkg.scripts,...Object.fromEntries(missing)};const indent=/^\{\n(\s+)"/.exec(source)?.[1]??" ";writeFileSync(manifest,`${JSON.stringify(pkg,null,indent)}
|
|
55
55
|
`);written.push("package.json")}}return written}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{appendFileSync,cpSync,existsSync,lstatSync,readdirSync,readFileSync,rmSync,writeFileSync}from"node:fs";import{extname,join,relative}from"node:path";import{linkPackagedDefaults,packagedDefaultsRoot}from"@stacksjs/path";export const VENDORED_DEFAULTS="storage/framework/defaults"
|
|
2
|
-
`)}const frameworkFile=join(root,"storage/framework/package.json");if(existsSync(frameworkFile)){const framework=JSON.parse(readFileSync(frameworkFile,"utf8"));let touched
|
|
3
|
-
`)}return changes}const FRAMEWORK_CREDIT_KEYS=["author","contributors","funding","homepage","repository","bugs"];export function stripFrameworkManifestCredits(root){const framework=join(root,"storage/framework")
|
|
4
|
-
`);touched.push(relative(root,file))}return touched}const CORE_CONTENT_PATHS=[{file:"config/css.ts",from:"'./storage/framework/core/error-handling/src/views/**/*.{stx,html}'",to:"'./node_modules/@stacksjs/error-handling/dist/views/**/*.{stx,html}'"}];export function rewriteCoreContentPaths(root){const touched=[];for(const{file,from,to}of CORE_CONTENT_PATHS){const full=join(root,file);if(!existsSync(full))continue;const raw=readFileSync(full,"utf8");if(!raw.includes(from))continue;writeFileSync(full,raw.replaceAll(from,to));touched.push(file)}return touched}export function applyPackageAppTsconfig(root){const source=join(root,"storage/framework/tsconfig.package-app.json");if(!existsSync(source))return
|
|
1
|
+
import{appendFileSync,cpSync,existsSync,lstatSync,readdirSync,readFileSync,rmSync,writeFileSync}from"node:fs";import{extname,join,relative}from"node:path";import{linkPackagedDefaults,packagedDefaultsRoot}from"@stacksjs/path";export const VENDORED_DEFAULTS="storage/framework/defaults";export const FRAMEWORK_ONLY_PATHS=["bench","logsmith.config.ts","storage/framework/tsconfig.framework.json","storage/framework/tsconfig.defaults.json","storage/framework/tsconfig.type-tests.json","storage/framework/docs","storage/framework/scripts/fresh","storage/framework/scripts/generate-changelog","storage/framework/scripts/install","storage/framework/scripts/link","storage/framework/scripts/lint","storage/framework/scripts/move-built-src-files.ts","storage/framework/scripts/move-dts-files.ts","storage/framework/scripts/normalize-workspace-deps-for-publish","storage/framework/scripts/publish","storage/framework/scripts/publish-commit","storage/framework/scripts/publish-dummy-libs"];export function pruneFrameworkOnlyFiles(root){const removed=[];for(const path of FRAMEWORK_ONLY_PATHS){const full=join(root,path);if(!existsSync(full))continue;rmSync(full,{recursive:true,force:true});removed.push(path)}return removed}const FRAMEWORK_ONLY_SCRIPTS=[/^bench(?::|$)/,/^test:bench$/,/^typecheck:(?:bench|framework|type-tests)$/,/^docs:/,/^declarations:check$/,/^deps:lockfile:check$/];const APP_SCRIPTS={buddy:"./buddy",typecheck:"bun run typecheck:app","typecheck:app":"bun x --bun tsc --noEmit -p tsconfig.json --pretty false","typecheck:views":"bun x --bun stx typecheck --lib storage/framework/types/request-context.d.ts --lib storage/framework/types/browser-composables.d.ts 'resources/**/*.stx'","build:reset":"rm -rf node_modules && pantry install && ./buddy generate:types && ./buddy lint:fix"};export function appPackageScripts(scripts){const next={};const removed=[];const rewritten=[];for(const[name,command]of Object.entries(scripts)){if(FRAMEWORK_ONLY_SCRIPTS.some((pattern)=>pattern.test(name))){removed.push(name);continue}const replacement=APP_SCRIPTS[name];if(replacement!==undefined&&replacement!==command){next[name]=replacement;rewritten.push(name);continue}next[name]=command}return{scripts:next,removed,rewritten}}export function applyAppPackageScripts(root){const file=join(root,"package.json");const empty={scripts:{},removed:[],rewritten:[]};if(!existsSync(file))return empty;const pkg=JSON.parse(readFileSync(file,"utf8"));const changes=appPackageScripts(pkg.scripts??{});if(changes.removed.length>0||changes.rewritten.length>0){pkg.scripts=changes.scripts;writeFileSync(file,`${JSON.stringify(pkg,null,2)}
|
|
2
|
+
`)}const frameworkFile=join(root,"storage/framework/package.json");if(existsSync(frameworkFile)){const framework=JSON.parse(readFileSync(frameworkFile,"utf8"));let touched=false;for(const[name,command]of Object.entries(framework.scripts??{})){if(!/\.\/scripts\/publish|\.\/core\b/.test(command))continue;delete framework.scripts[name];touched=true}if(touched)writeFileSync(frameworkFile,`${JSON.stringify(framework,null,2)}
|
|
3
|
+
`)}return changes}const FRAMEWORK_CREDIT_KEYS=["author","contributors","funding","homepage","repository","bugs"];export function stripFrameworkManifestCredits(root){const framework=join(root,"storage/framework");const manifests=[];const walk=(dir)=>{let entries;try{entries=readdirSync(dir,{withFileTypes:true})}catch{return}for(const entry of entries){const full=join(dir,entry.name);if(entry.isDirectory()&&!["core","defaults","node_modules","dist"].includes(entry.name))walk(full);else if(entry.isFile()&&entry.name==="package.json")manifests.push(full)}};walk(framework);const touched=[];for(const file of manifests){const pkg=JSON.parse(readFileSync(file,"utf8"));const present=FRAMEWORK_CREDIT_KEYS.filter((key)=>(key in pkg));if(present.length===0)continue;for(const key of present)delete pkg[key];writeFileSync(file,`${JSON.stringify(pkg,null,2)}
|
|
4
|
+
`);touched.push(relative(root,file))}return touched}const CORE_CONTENT_PATHS=[{file:"config/css.ts",from:"'./storage/framework/core/error-handling/src/views/**/*.{stx,html}'",to:"'./node_modules/@stacksjs/error-handling/dist/views/**/*.{stx,html}'"}];export function rewriteCoreContentPaths(root){const touched=[];for(const{file,from,to}of CORE_CONTENT_PATHS){const full=join(root,file);if(!existsSync(full))continue;const raw=readFileSync(full,"utf8");if(!raw.includes(from))continue;writeFileSync(full,raw.replaceAll(from,to));touched.push(file)}return touched}export function applyPackageAppTsconfig(root){const source=join(root,"storage/framework/tsconfig.package-app.json");if(!existsSync(source))return false;cpSync(source,join(root,"storage/framework/tsconfig.app.json"));rmSync(source);return true}const SKIPPED_DIRECTORIES=new Set(["node_modules","pantry","dist","storage","public",".git",".cache",".stx","coverage"]);const SCANNED_EXTENSIONS=new Set([".ts",".tsx",".js",".mjs",".cjs",".stx"]);function projectSources(dir){let entries;try{entries=readdirSync(dir,{withFileTypes:true})}catch{return[]}return entries.flatMap((entry)=>{const full=join(dir,entry.name);if(entry.isDirectory())return SKIPPED_DIRECTORIES.has(entry.name)?[]:projectSources(full);return entry.isFile()&&SCANNED_EXTENSIONS.has(extname(entry.name))?[full]:[]})}const DEFAULTS_IMPORT=/(\bfrom\s+|\bimport\s*\(\s*|\brequire\s*\(\s*|^\s*import\s+)(['"])(?:~\/|(?:\.{1,2}\/)+)storage\/framework\/defaults\/([^'"]+)\2/gm;export function defaultsSpecifier(rest,hasFile=()=>false){if(!extname(rest)&&hasFile(`${rest}.ts`))return`@stacksjs/defaults/${rest}.ts`;return`@stacksjs/defaults/${rest}`}export function rewriteDefaultsImports(root,hasFile){const touched=[];for(const file of projectSources(root)){const raw=readFileSync(file,"utf8");if(!raw.includes("storage/framework/defaults/"))continue;const fileExists=file.endsWith(".stx")?()=>false:hasFile;const next=raw.replace(DEFAULTS_IMPORT,(_match,lead,quote,rest)=>`${lead}${quote}${defaultsSpecifier(rest,fileExists)}${quote}`);if(next!==raw){writeFileSync(file,next);touched.push(relative(root,file))}}return touched}const TS=".ts";const DEFAULTS_MODULE_PATHS=[{file:"bunfig.toml",from:`"./storage/framework/defaults/resources/plugins/preloader${TS}"`,to:'"@stacksjs/defaults/resources/plugins/preloader"'},{file:"config/ui.ts",from:`'./storage/framework/defaults/stx-components-plugin${TS}'`,to:`'@stacksjs/defaults/stx-components-plugin${TS}'`}];export function rewriteDefaultsModulePaths(root){const touched=[];for(const{file,from,to}of DEFAULTS_MODULE_PATHS){const full=join(root,file);if(!existsSync(full))continue;const raw=readFileSync(full,"utf8");if(!raw.includes(from))continue;writeFileSync(full,raw.replaceAll(from,to));touched.push(file)}return touched}const GITIGNORE_ENTRY=`/${VENDORED_DEFAULTS}`;const GITIGNORE_BLOCK=`
|
|
5
5
|
# The framework defaults: a link to node_modules/@stacksjs/defaults, made on
|
|
6
6
|
# boot. \`buddy publish:defaults\` replaces it with a copy you commit instead.
|
|
7
7
|
${GITIGNORE_ENTRY}
|
|
8
8
|
`;function ignoresDefaults(gitignore){return gitignore.split(`
|
|
9
|
-
`).some((line)=>line.trim()===GITIGNORE_ENTRY)}export function ignoreDefaults(root){const file=join(root,".gitignore")
|
|
9
|
+
`).some((line)=>line.trim()===GITIGNORE_ENTRY)}export function ignoreDefaults(root){const file=join(root,".gitignore");const raw=existsSync(file)?readFileSync(file,"utf8"):"";if(ignoresDefaults(raw))return false;appendFileSync(file,`${raw.endsWith(`
|
|
10
10
|
`)||raw===""?"":`
|
|
11
|
-
`}${GITIGNORE_BLOCK}`);return
|
|
11
|
+
`}${GITIGNORE_BLOCK}`);return true}export function unignoreDefaults(root){const file=join(root,".gitignore");if(!existsSync(file))return false;const raw=readFileSync(file,"utf8");if(!ignoresDefaults(raw))return false;writeFileSync(file,raw.replace(GITIGNORE_BLOCK,"").split(`
|
|
12
12
|
`).filter((line)=>line.trim()!==GITIGNORE_ENTRY).join(`
|
|
13
|
-
`));return
|
|
13
|
+
`));return true}export function adoptPackagedDefaults(root){const packageRoot=packagedDefaultsRoot(root);if(!packageRoot)throw new Error("@stacksjs/defaults is not installed, so there is nothing to run the defaults from. Install the project's dependencies first.");const tree=join(root,VENDORED_DEFAULTS);let removedTree=false;try{const stat=lstatSync(tree);if(stat.isDirectory()){rmSync(tree,{recursive:true,force:true});removedTree=true}}catch{}const hasFile=(path)=>existsSync(join(packageRoot,path));return{packageRoot,removedTree,rewrittenImports:rewriteDefaultsImports(root,hasFile),rewrittenModulePaths:rewriteDefaultsModulePaths(root),ignored:ignoreDefaults(root),linked:linkPackagedDefaults(root)}}
|
package/dist/scaffold-site.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cpSync,existsSync,readdirSync,rmSync}from"node:fs";import{join}from"node:path";export const SITE_ONLY_PATHS=["resources/views/index.stx","resources/views/coming-soon.stx","resources/views/compare","resources/views/features","resources/views/use-cases","resources/views/components/FeatureCard.stx","resources/views/layouts/marketing.stx","resources/views/partials/theme.stx","resources/data/assets.ts","resources/data/comparisons.ts","resources/data/features.ts","resources/data/highlight.ts","resources/data/nav.ts","resources/data/stats.ts","resources/data/use-cases.ts","resources/partials/marketing-footer.stx","resources/partials/marketing-head.stx","resources/partials/marketing-nav.stx","resources/partials/marketing-theme-toggle.stx","resources/emails/subscription-confirmation.stx","resources/assets/scripts/site-mode.js","public/assets/styles/home.css","public/assets/styles/marketing.css","public/assets/styles/theme.css","resources/assets/fonts/nps","public/assets/fonts/nps","public/assets/images","resources/assets/images/bg-img.png","resources/assets/images/marketing-park-camp.svg","resources/assets/images/marketing-park-geyser.svg","resources/assets/images/marketing-park-lighthouse.svg","resources/assets/images/marketing-park-trail.svg","resources/assets/images/marketing-park-wing.svg","resources/assets/images/park-ridge.svg","resources/assets/images/river.svg","resources/assets/images/topography.svg","resources/assets/images/wood-sign.svg","docs","content/blog","content/BLOG_STRATEGY.md","public/images/atomic-fx-diagram.png","public/images/atomic-ui-diagram.png","public/images/diagram.png","public/images/og-image.png","public/images/social.png","public/images/background-auth.jpg","public/images/background-features.jpg","public/images/screenshots/expenses.webp","public/images/screenshots/reporting.webp","public/images/screenshots/vat-returns.webp","public/images/logos/amex.jpg","public/images/logos/jcb.svg","public/images/logos/laravel.svg","public/images/logos/logo-dark.svg","public/images/logos/logo-mini.svg","public/images/logos/logo-transparent.svg","public/images/logos/logo-white.png","public/images/logos/logo.png","public/images/logos/logo.svg","public/images/logos/mastercard.svg","public/images/logos/meilisearch.svg","public/images/logos/mirage.svg","public/images/logos/statamic.svg","public/images/logos/statickit.svg","public/images/logos/transistor.svg","public/images/logos/tuple.svg","public/images/logos/visa.png","public/images/logos/visa.svgz","resources/assets/scripts/main.ts","resources/assets/styles/main.css","resources/layouts/Desktop.stx","resources/partials/welcome-pdf-content.stx","resources/partials/welcome-pdf-toolbar.stx","resources/components/ContextMenu.stx","resources/components/ContextMenuItem.stx","resources/components/DesktopIcon.stx","resources/components/FeatureButton.stx","resources/components/InputGroup.stx","resources/components/LoginForm.stx","resources/components/LoginScreen.stx","resources/components/NotificationPopup.stx","resources/components/PackageItem.stx","resources/components/StartMenu.stx","resources/components/StartMenuItem.stx","resources/components/Taskbar.stx","resources/components/Window.stx"]
|
|
1
|
+
import{cpSync,existsSync,readdirSync,rmSync}from"node:fs";import{join}from"node:path";export const SITE_ONLY_PATHS=["resources/views/index.stx","resources/views/coming-soon.stx","resources/views/compare","resources/views/features","resources/views/use-cases","resources/views/components/FeatureCard.stx","resources/views/layouts/marketing.stx","resources/views/partials/theme.stx","resources/data/assets.ts","resources/data/comparisons.ts","resources/data/features.ts","resources/data/highlight.ts","resources/data/nav.ts","resources/data/stats.ts","resources/data/use-cases.ts","resources/partials/marketing-footer.stx","resources/partials/marketing-head.stx","resources/partials/marketing-nav.stx","resources/partials/marketing-theme-toggle.stx","resources/emails/subscription-confirmation.stx","resources/assets/scripts/site-mode.js","public/assets/styles/home.css","public/assets/styles/marketing.css","public/assets/styles/theme.css","resources/assets/fonts/nps","public/assets/fonts/nps","public/assets/images","resources/assets/images/bg-img.png","resources/assets/images/marketing-park-camp.svg","resources/assets/images/marketing-park-geyser.svg","resources/assets/images/marketing-park-lighthouse.svg","resources/assets/images/marketing-park-trail.svg","resources/assets/images/marketing-park-wing.svg","resources/assets/images/park-ridge.svg","resources/assets/images/river.svg","resources/assets/images/topography.svg","resources/assets/images/wood-sign.svg","docs","content/blog","content/BLOG_STRATEGY.md","public/images/atomic-fx-diagram.png","public/images/atomic-ui-diagram.png","public/images/diagram.png","public/images/og-image.png","public/images/social.png","public/images/background-auth.jpg","public/images/background-features.jpg","public/images/screenshots/expenses.webp","public/images/screenshots/reporting.webp","public/images/screenshots/vat-returns.webp","public/images/logos/amex.jpg","public/images/logos/jcb.svg","public/images/logos/laravel.svg","public/images/logos/logo-dark.svg","public/images/logos/logo-mini.svg","public/images/logos/logo-transparent.svg","public/images/logos/logo-white.png","public/images/logos/logo.png","public/images/logos/logo.svg","public/images/logos/mastercard.svg","public/images/logos/meilisearch.svg","public/images/logos/mirage.svg","public/images/logos/statamic.svg","public/images/logos/statickit.svg","public/images/logos/transistor.svg","public/images/logos/tuple.svg","public/images/logos/visa.png","public/images/logos/visa.svgz","resources/assets/scripts/main.ts","resources/assets/styles/main.css","resources/layouts/Desktop.stx","resources/partials/welcome-pdf-content.stx","resources/partials/welcome-pdf-toolbar.stx","resources/components/ContextMenu.stx","resources/components/ContextMenuItem.stx","resources/components/DesktopIcon.stx","resources/components/FeatureButton.stx","resources/components/InputGroup.stx","resources/components/LoginForm.stx","resources/components/LoginScreen.stx","resources/components/NotificationPopup.stx","resources/components/PackageItem.stx","resources/components/StartMenu.stx","resources/components/StartMenuItem.stx","resources/components/Taskbar.stx","resources/components/Window.stx"];export const APP_SITE_TEMPLATE="storage/framework/defaults/scaffold/resources";export function applyAppSiteTemplate(root){const template=join(root,APP_SITE_TEMPLATE);if(!existsSync(template))throw new Error(`No app site template at ${APP_SITE_TEMPLATE}`);const removed=[];for(const relative of SITE_ONLY_PATHS){const target=join(root,relative);if(!existsSync(target))continue;rmSync(target,{recursive:true,force:true});removed.push(relative)}for(const relative of removed){let dir=parentOf(relative);while(dir&&!KEPT_ROOTS.has(dir)&&isEmptyDir(join(root,dir))){rmSync(join(root,dir),{recursive:true,force:true});dir=parentOf(dir)}}cpSync(template,join(root,"resources"),{recursive:true});return removed}const KEPT_ROOTS=new Set(["resources","public"]);function parentOf(relative){return relative.includes("/")?relative.slice(0,relative.lastIndexOf("/")):""}function isEmptyDir(dir){return existsSync(dir)&&readdirSync(dir).length===0}
|
package/dist/storage-backup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAbsolute,join}from"node:path";const REMOTE_DRIVERS=new Set(["s3","azure","gcs","r2"])
|
|
1
|
+
import{isAbsolute,join}from"node:path";const REMOTE_DRIVERS=new Set(["s3","azure","gcs","r2"]);const DISK_ROOTS={local:"storage/app",public:"public"};export function resolveStorageTarget(filesystems,disk,projectRoot){const configured=filesystems?.disks?.[disk];const driver=configured?.driver??(disk==="local"||disk==="public"?"local":disk);if(REMOTE_DRIVERS.has(driver)){return{ok:false,refusal:{disk,reason:`\`${disk}\` is a ${driver} disk, so its files are not on this machine. `+"Use the provider's own versioning or replication: streaming every object through this process "+"is slower, costs egress, and gives a worse guarantee."}}}const declared=configured?.root??DISK_ROOTS[disk];if(!declared){return{ok:false,refusal:{disk,reason:`\`${disk}\` is not a configured disk, and is not one of the built-in local disks (${Object.keys(DISK_ROOTS).join(", ")}).`}}}return{ok:true,target:{disk,root:isAbsolute(declared)?declared:join(projectRoot,declared)}}}export function storageBackupFileName(disk,at){const stamp=at.toISOString().replace(/[:.]/g,"-").replace("Z","");return`${stamp}.${disk}.zip`}export function isStorageBackupFileName(name){return/^\d{4}-\d{2}-\d{2}T[\d-]+\.[\w-]+\.zip$/.test(name)}export function diskOfBackup(name){if(!isStorageBackupFileName(name))return null;const parts=name.split(".");return parts.length>=3?parts[parts.length-2]:null}export function prunableStorageBackups(existing,retain,disk){if(!Number.isFinite(retain)||retain<1)return[];const byDisk=new Map;for(const name of existing.filter(isStorageBackupFileName)){const owner=diskOfBackup(name);if(disk&&owner!==disk)continue;byDisk.set(owner,[...byDisk.get(owner)??[],name])}const prunable=[];for(const names of byDisk.values()){const sorted=[...names].sort();const excess=sorted.length-retain;if(excess>0)prunable.push(...sorted.slice(0,excess))}return prunable.sort()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function describeSystemDependencies(depsSource){const code=new Bun.Transpiler({loader:"ts",trimUnusedImports
|
|
1
|
+
export function describeSystemDependencies(depsSource){const code=new Bun.Transpiler({loader:"ts",trimUnusedImports:false}).transformSync(depsSource);if(/(?:^|[{,\s])["']?craft["']?\s*:/m.test(code)){return{status:"fail",message:"config/deps.ts declares `craft`, which Pantry resolves to craft-native.org, a package the registry has no artifacts for, so `pantry install` fails. Remove the line: the Craft SDK comes from `craft-native` in package.json, and a desktop build installs the CLI with `pantry install craft`."}}return{status:"pass",message:"config/deps.ts declares no system dependency the registry cannot install"}}
|
package/dist/unbacked-data.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";const STATEFUL_SERVICES={postgres:{holds:"the application database",dumpable
|
|
1
|
+
import process from"node:process";const STATEFUL_SERVICES={postgres:{holds:"the application database",dumpable:true},mysql:{holds:"the application database",dumpable:true},mariadb:{holds:"the application database",dumpable:true},vitess:{holds:"the application database",dumpable:false}};function isEnabled(value){if(value===true)return true;if(!value||typeof value!=="object")return false;return value.enabled!==false}export function findUnbackedManagedServices(tsCloudConfig,hasOffsiteDestination=false){const config=tsCloudConfig;const managed=config?.infrastructure?.compute?.managedServices;if(!managed||typeof managed!=="object")return[];const out=[];for(const[name,{holds,dumpable}]of Object.entries(STATEFUL_SERVICES)){if(!isEnabled(managed?.[name]))continue;if(hasOffsiteDestination&&dumpable)continue;out.push({name,holds,dumpable})}return out}export function unbackedDataMessage(services){const first=services[0];if(!first)return"No unbacked managed data services.";const names=services.map((s)=>s.name).join(", ");const one=services.length===1;const subject=one?`${names} is`:`${names} are`;const holds=first.holds.charAt(0).toUpperCase()+first.holds.slice(1);const head=`${subject} provisioned on the compute instance. ${holds} shares a disk with the web process`;if(services.every((s)=>s.dumpable)){return`${head}, and nothing copies its data off the box. The dumps \`buddy deploy\` takes before each `+"migration land on that same disk: they survive a bad migration, not the loss of the instance. "+"Copy them somewhere else on a schedule, and check a restore works (`buddy db:restore`) before you need one."}const undumpable=services.filter((s)=>!s.dumpable).map((s)=>s.name).join(", ");return`${head}, and nothing backs it up. \`buddy db:backup\` does not dump ${undumpable}: a logical dump `+"taken through a vtgate does not restore a sharded keyspace, so pretending otherwise would be worse than "+"saying nothing. Take a snapshot at the storage layer, and test restoring it (stacksjs/stacks#2313)."}export async function hasOffsiteBackupDestination(){try{const{config,overridesReady}=await import("@stacksjs/config");await overridesReady.catch(()=>{});const{resolveBackupDestination}=await import("./database-backup");return resolveBackupDestination(config?.database,process.env)!==null}catch{return false}}
|
package/dist/unvendor-rewrite.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{existsSync,lstatSync,readFileSync}from"node:fs";import{readdir}from"node:fs/promises";import{join,resolve}from"node:path";import{log}from"@stacksjs/cli";import{fs}from"@stacksjs/storage";export function isDanglingLink(target){try{return lstatSync(target).isSymbolicLink()&&!existsSync(target)}catch{return
|
|
2
|
-
`);files.push(full.replace(`${cwd}/`,""))}};await walk(framework);return{files,ranges}}const SCANNED_EXTENSIONS=new Set([".ts",".tsx",".js",".mjs",".cjs",".json",".sh",".yml",".yaml",".toml"])
|
|
1
|
+
import{existsSync,lstatSync,readFileSync}from"node:fs";import{readdir}from"node:fs/promises";import{join,resolve}from"node:path";import{log}from"@stacksjs/cli";import{fs}from"@stacksjs/storage";export function isDanglingLink(target){try{return lstatSync(target).isSymbolicLink()&&!existsSync(target)}catch{return false}}function hoistedLinker(cwd){try{const bunfig=readFileSync(resolve(cwd,"bunfig.toml"),"utf-8");return/^\s*linker\s*=\s*["']hoisted["']/m.test(bunfig)}catch{return false}}export function detectInstaller(cwd){const has=(rel)=>existsSync(resolve(cwd,rel));const usesPantry=has("pantry")||has("pantry.lock")&&!has("node_modules");if(usesPantry&&Bun.which("pantry")){if(hoistedLinker(cwd))return["pantry","install","--linker","hoisted"];return["pantry","install"]}if(usesPantry)log.warn("This project installs with pantry, but no `pantry` binary is on PATH — falling back to `bun install`.");return["bun","install"]}export const UNVENDOR_INSTALLERS=["bun","pantry"];export function isUnvendorInstaller(value){return typeof value==="string"&&UNVENDOR_INSTALLERS.includes(value)}export function chooseInstaller(cwd,requested){if(requested==="bun")return["bun","install"];if(requested==="pantry")return hoistedLinker(cwd)?["pantry","install","--linker","hoisted"]:["pantry","install"];return detectInstaller(cwd)}export const INSTALL_RETRY_DELAYS_MS=[15000,30000,60000,90000,120000,180000];export async function installWithRetry(run,options={}){const delays=options.delaysMs??INSTALL_RETRY_DELAYS_MS;const sleep=options.sleep??((ms)=>Bun.sleep(ms));let code=await run();for(const[i,delay]of delays.entries()){if(code===0)break;options.onRetry?.(i+2,delay);await sleep(delay);code=await run()}return code}export async function rewriteSurvivingFrameworkManifests(cwd,provided,range){const framework=resolve(cwd,"storage/framework");const files=[];let ranges=0;const walk=async(dir)=>{let entries;try{entries=await readdir(dir,{withFileTypes:true})}catch{return}for(const entry of entries){if(entry.name==="core"||entry.name==="node_modules"||entry.name==="dist")continue;const full=join(dir,entry.name);if(entry.isDirectory()){await walk(full);continue}if(!entry.isFile()||entry.name!=="package.json")continue;const raw=await fs.promises.readFile(full,"utf-8");const pkg=JSON.parse(raw);let touched=false;for(const field of["dependencies","devDependencies","peerDependencies"]){const dependencies=pkg[field];if(!dependencies)continue;for(const[name,spec]of Object.entries(dependencies)){if(!spec.startsWith("workspace:")||!provided.has(name))continue;dependencies[name]=range;ranges++;touched=true}}if(!touched)continue;await fs.promises.writeFile(full,`${JSON.stringify(pkg,null,2)}
|
|
2
|
+
`);files.push(full.replace(`${cwd}/`,""))}};await walk(framework);return{files,ranges}}const SCANNED_EXTENSIONS=new Set([".ts",".tsx",".js",".mjs",".cjs",".json",".sh",".yml",".yaml",".toml"]);const SKIPPED_DIRECTORIES=new Set(["node_modules","pantry","dist","storage","public","coverage","temp","tmp",".git",".cache",".claude",".idea",".stx",".vscode"]);async function*projectFiles(cwd){const walk=async function*(dir){let entries;try{entries=await readdir(dir,{withFileTypes:true})}catch{return}for(const entry of entries){const full=join(dir,entry.name);if(entry.isDirectory()){if(SKIPPED_DIRECTORIES.has(entry.name))continue;yield*walk(full);continue}if(!entry.isFile())continue;const dot=entry.name.lastIndexOf(".");const ext=dot===-1?"":entry.name.slice(dot);if(SCANNED_EXTENSIONS.has(ext)||entry.name==="Dockerfile"||entry.name.startsWith("Dockerfile."))yield full}};yield*walk(cwd)}const CORE_SOURCE_IMPORT=/(\bfrom\s+|\bimport\s*\(\s*|\brequire\s*\(\s*)(['"])(?:\.{1,2}\/)*storage\/framework\/core\/([\w.-]+)\/src\/([^'"]+?)(?:\.ts)?\2/g;function toPackageSpecifier(pkg,rest){const subpath=rest.replace(/\/index$/,"");return subpath==="index"?`@stacksjs/${pkg}`:`@stacksjs/${pkg}/${subpath}`}const CORE_ACTION_COMMANDS={"actions/src/migrate/database":"migrate","actions/src/migrate/fresh":"migrate:fresh","actions/src/database/seed":"seed","actions/src/auth/setup":"auth:setup","actions/src/dev/api":"dev:api","actions/src/key-generate":"key:generate"};const CORE_COMMAND_PATH=/\bbunx?\s+(?:-{1,2}[\w=.-]+\s+)*(?:\.\/)?storage\/framework\/core\/([\w/.-]+?)\.ts\b/g;export async function rewriteCoreCommandPaths(cwd){const touched=[];for await(const file of projectFiles(cwd)){const raw=await fs.promises.readFile(file,"utf-8");if(!raw.includes("storage/framework/core/"))continue;const next=raw.replace(CORE_COMMAND_PATH,(match,entry)=>{if(entry==="buddy/src/cli")return"./buddy";const command=CORE_ACTION_COMMANDS[entry];return command?`./buddy ${command}`:match});if(next!==raw){await fs.promises.writeFile(file,next);touched.push(file.replace(`${cwd}/`,""))}}return touched}export async function rewriteCoreSourceImports(cwd){const touched=[];for await(const file of projectFiles(cwd)){const raw=await fs.promises.readFile(file,"utf-8");if(!raw.includes("storage/framework/core/"))continue;const next=raw.replace(CORE_SOURCE_IMPORT,(_match,lead,quote,pkg,rest)=>`${lead}${quote}${toPackageSpecifier(pkg,rest)}${quote}`);if(next!==raw){await fs.promises.writeFile(file,next);touched.push(file.replace(`${cwd}/`,""))}}return touched}export async function findCoreReferences(cwd){const hits=[];for await(const file of projectFiles(cwd)){const raw=await fs.promises.readFile(file,"utf-8");if(!raw.includes("storage/framework/core"))continue;raw.split(`
|
|
3
3
|
`).forEach((text,index)=>{if(!text.includes("storage/framework/core"))return;const trimmed=text.trim();if(/^(?:\/\/|\*|#|<!--)/.test(trimmed))return;hits.push({file:file.replace(`${cwd}/`,""),line:index+1,text:trimmed.slice(0,120)})})}return hits}
|
package/dist/version-info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{version as buddyVersion}from"../package.json";const stacksVersion=buddyVersion;export{buddyVersion,stacksVersion};export const versionDescriptor=`${buddyVersion} stacks/${stacksVersion}
|
|
1
|
+
import{version as buddyVersion}from"../package.json";const stacksVersion=buddyVersion;export{buddyVersion,stacksVersion};export const versionDescriptor=`${buddyVersion} stacks/${stacksVersion}`;export const versionLine=`buddy/${versionDescriptor}`;
|
package/dist/workflow-prune.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const FRAMEWORK_ONLY_PATH=/storage\/framework\/(?:core|scripts\/publish-commit)
|
|
2
|
-
`);const removedJobs=[];let removedSteps=0;for(const job of jobStarts(lines).reverse()){const end=blockEnd(lines,job.at,2)
|
|
3
|
-
`),removedJobs,removedSteps}}export async function pruneVendoredCoreFromWorkflows(cwd){const{readdir,readFile,writeFile}=await import("node:fs/promises")
|
|
1
|
+
const FRAMEWORK_ONLY_PATH=/storage\/framework\/(?:core|scripts\/publish-commit)/;const FRAMEWORK_ONLY_SCRIPTS=new Set(["docs:buddy","docs:buddy:check","docs:artifacts","docs:artifacts:check","docs:links","docs:links:check"]);function invocations(line){return[...line.matchAll(/(?:bun\s+run|bun\s+buddy|\.\/buddy|bunx?\s+buddy)\s+["']?([\w:.-]+)/g)].map((match)=>match[1])}function referencesCore(line){const trimmed=line.trim();if(trimmed.startsWith("#"))return false;const code=line.replace(/\s#.*$/,"");return FRAMEWORK_ONLY_PATH.test(code)||invocations(code).some((name)=>FRAMEWORK_ONLY_SCRIPTS.has(name))}export const frameworkOnlyScripts=[...FRAMEWORK_ONLY_SCRIPTS];function jobStarts(lines){const out=[];let inJobs=false;for(const[at,line]of lines.entries()){if(/^jobs:\s*$/.test(line)){inJobs=true;continue}if(!inJobs)continue;if(/^\S/.test(line)&&!/^\s*#/.test(line))break;const match=line.match(/^ {2}([A-Za-z_][\w-]*):\s*$/);if(match)out.push({name:match[1],at})}return out}function blockEnd(lines,from,indent){const sibling=new RegExp(`^ {${indent}}(?:- |[A-Za-z_"'])`);for(let at=from+1;at<lines.length;at++){const line=lines[at];if(line.trim()==="")continue;const leading=line.length-line.trimStart().length;if(leading<indent)return at;if(leading===indent&&sibling.test(line))return at}return lines.length}const SETUP_STEP=[/uses:\s*actions\/checkout/,/uses:\s*actions\/cache/,/uses:\s*actions\/setup-/,/uses:\s*pantry-pm\/pantry/,/run:\s*(?:bun|pantry|npm|pnpm|yarn)\s+(?:install|ci)\b/];function isSetupStep(step){const code=step.filter((line)=>!line.trim().startsWith("#"));return SETUP_STEP.some((pattern)=>code.some((line)=>pattern.test(line)))}function withLeadingComments(lines,at){let start=at;while(start-1>=0){const previous=lines[start-1].trim();if(previous.startsWith("#")||previous==="")start--;else break}while(start<at&&lines[start].trim()==="")start++;return start}export function pruneVendoredCoreFromWorkflow(source){let lines=source.split(`
|
|
2
|
+
`);const removedJobs=[];let removedSteps=0;for(const job of jobStarts(lines).reverse()){const end=blockEnd(lines,job.at,2);const body=lines.slice(job.at,end);const steps=[];for(const[offset,line]of body.entries()){if(!/^ {6}- /.test(line))continue;const at=job.at+offset;const stepEnd=blockEnd(lines,at,6);const step=lines.slice(at,stepEnd);steps.push({at,end:stepEnd,core:step.some(referencesCore),setup:isSetupStep(step)})}if(steps.length===0||!steps.some((step)=>step.core))continue;if(steps.filter((step)=>!step.setup).every((step)=>step.core)){lines.splice(withLeadingComments(lines,job.at),end-withLeadingComments(lines,job.at));removedJobs.push(job.name);continue}for(const step of[...steps].reverse()){if(!step.core)continue;const from=withLeadingComments(lines,step.at);lines.splice(from,step.end-from);removedSteps++}}if(removedJobs.length>0){lines=lines.map((line)=>{const inline=line.match(/^(\s*needs:\s*)\[([^\]]*)\]\s*$/);if(inline){const kept=inline[2].split(",").map((name)=>name.trim()).filter((name)=>name&&!removedJobs.includes(name));return kept.length>0?`${inline[1]}[${kept.join(", ")}]`:""}const scalar=line.match(/^(\s*)needs:\s*([A-Za-z_][\w-]*)\s*$/);if(scalar&&removedJobs.includes(scalar[2]))return"";return line}).filter((line,at,all)=>!(line===""&&all[at-1]===""&&all[at+1]===""))}return{yaml:lines.join(`
|
|
3
|
+
`),removedJobs,removedSteps}}export async function pruneVendoredCoreFromWorkflows(cwd){const{readdir,readFile,writeFile}=await import("node:fs/promises");const{join}=await import("node:path");const dir=join(cwd,".github","workflows");const pruned=[];let entries;try{entries=await readdir(dir)}catch{return pruned}for(const entry of entries.sort()){if(!/\.ya?ml$/.test(entry))continue;const file=join(dir,entry);try{const source=await readFile(file,"utf-8");const result=pruneVendoredCoreFromWorkflow(source);if(result.yaml===source)continue;await writeFile(file,result.yaml);pruned.push({file:`.github/workflows/${entry}`,removedJobs:result.removedJobs,removedSteps:result.removedSteps})}catch{continue}}return pruned}export function splitFrameworkTypecheckScript(scripts){const typecheck=scripts.typecheck;if(!typecheck?.includes("tsconfig.framework.json")||!scripts["typecheck:app"])return null;return Object.fromEntries(Object.entries(scripts).flatMap(([name,script])=>name==="typecheck"?[["typecheck","bun run typecheck:app && bun run typecheck:framework"],["typecheck:framework",dropVendoredCoreSegments(script)]]:[[name,script]]))}function dropVendoredCoreSegments(script){const kept=splitTopLevelAnd(script).map((segment)=>segment.trim()).filter((segment)=>segment&&!segment.includes("storage/framework/core"));return kept.length>0?kept.join(" && "):script}function splitTopLevelAnd(script){const segments=[];let depth=0;let current="";for(let i=0;i<script.length;i++){const char=script[i];if(char==="(")depth++;else if(char===")")depth=Math.max(0,depth-1);if(depth===0&&char==="&"&&script[i+1]==="&"){segments.push(current);current="";i++;continue}current+=char}segments.push(current);return segments}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.518",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -95,69 +95,69 @@
|
|
|
95
95
|
"prepublishOnly": "bun run build"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@stacksjs/actions": "0.75.
|
|
99
|
-
"@stacksjs/ai": "0.75.
|
|
100
|
-
"@stacksjs/alias": "0.75.
|
|
101
|
-
"@stacksjs/analytics": "0.75.
|
|
102
|
-
"@stacksjs/api": "0.75.
|
|
103
|
-
"@stacksjs/arrays": "0.75.
|
|
104
|
-
"@stacksjs/auth": "0.75.
|
|
105
|
-
"@stacksjs/browser-extension": "0.75.
|
|
106
|
-
"@stacksjs/build": "0.75.
|
|
98
|
+
"@stacksjs/actions": "0.75.518",
|
|
99
|
+
"@stacksjs/ai": "0.75.518",
|
|
100
|
+
"@stacksjs/alias": "0.75.518",
|
|
101
|
+
"@stacksjs/analytics": "0.75.518",
|
|
102
|
+
"@stacksjs/api": "0.75.518",
|
|
103
|
+
"@stacksjs/arrays": "0.75.518",
|
|
104
|
+
"@stacksjs/auth": "0.75.518",
|
|
105
|
+
"@stacksjs/browser-extension": "0.75.518",
|
|
106
|
+
"@stacksjs/build": "0.75.518",
|
|
107
107
|
"@stacksjs/bumpx": "^0.2.26",
|
|
108
|
-
"@stacksjs/cache": "0.75.
|
|
109
|
-
"@stacksjs/chat": "0.75.
|
|
108
|
+
"@stacksjs/cache": "0.75.518",
|
|
109
|
+
"@stacksjs/chat": "0.75.518",
|
|
110
110
|
"@stacksjs/clapp": "^0.2.16",
|
|
111
|
-
"@stacksjs/cli": "0.75.
|
|
112
|
-
"@stacksjs/cloud": "0.75.
|
|
113
|
-
"@stacksjs/cms": "0.75.
|
|
114
|
-
"@stacksjs/collections": "0.75.
|
|
115
|
-
"@stacksjs/commerce": "0.75.
|
|
116
|
-
"@stacksjs/config": "0.75.
|
|
117
|
-
"@stacksjs/database": "0.75.
|
|
118
|
-
"@stacksjs/desktop-build": "0.75.
|
|
119
|
-
"@stacksjs/dns": "0.75.
|
|
111
|
+
"@stacksjs/cli": "0.75.518",
|
|
112
|
+
"@stacksjs/cloud": "0.75.518",
|
|
113
|
+
"@stacksjs/cms": "0.75.518",
|
|
114
|
+
"@stacksjs/collections": "0.75.518",
|
|
115
|
+
"@stacksjs/commerce": "0.75.518",
|
|
116
|
+
"@stacksjs/config": "0.75.518",
|
|
117
|
+
"@stacksjs/database": "0.75.518",
|
|
118
|
+
"@stacksjs/desktop-build": "0.75.518",
|
|
119
|
+
"@stacksjs/dns": "0.75.518",
|
|
120
120
|
"@stacksjs/dnsx": "^0.2.3",
|
|
121
|
-
"@stacksjs/email": "0.75.
|
|
122
|
-
"@stacksjs/enums": "0.75.
|
|
123
|
-
"@stacksjs/env": "0.75.
|
|
124
|
-
"@stacksjs/error-handling": "0.75.
|
|
125
|
-
"@stacksjs/events": "0.75.
|
|
126
|
-
"@stacksjs/features": "0.75.
|
|
127
|
-
"@stacksjs/git": "0.75.
|
|
121
|
+
"@stacksjs/email": "0.75.518",
|
|
122
|
+
"@stacksjs/enums": "0.75.518",
|
|
123
|
+
"@stacksjs/env": "0.75.518",
|
|
124
|
+
"@stacksjs/error-handling": "0.75.518",
|
|
125
|
+
"@stacksjs/events": "0.75.518",
|
|
126
|
+
"@stacksjs/features": "0.75.518",
|
|
127
|
+
"@stacksjs/git": "0.75.518",
|
|
128
128
|
"@stacksjs/gitit": "^0.2.5",
|
|
129
|
-
"@stacksjs/health": "0.75.
|
|
129
|
+
"@stacksjs/health": "0.75.518",
|
|
130
130
|
"@stacksjs/httx": "^0.1.10",
|
|
131
|
-
"@stacksjs/image": "0.75.
|
|
132
|
-
"@stacksjs/lint": "0.75.
|
|
133
|
-
"@stacksjs/logging": "0.75.
|
|
134
|
-
"@stacksjs/notifications": "0.75.
|
|
135
|
-
"@stacksjs/objects": "0.75.
|
|
136
|
-
"@stacksjs/orm": "0.75.
|
|
137
|
-
"@stacksjs/path": "0.75.
|
|
138
|
-
"@stacksjs/payments": "0.75.
|
|
139
|
-
"@stacksjs/realtime": "0.75.
|
|
140
|
-
"@stacksjs/router": "0.75.
|
|
131
|
+
"@stacksjs/image": "0.75.518",
|
|
132
|
+
"@stacksjs/lint": "0.75.518",
|
|
133
|
+
"@stacksjs/logging": "0.75.518",
|
|
134
|
+
"@stacksjs/notifications": "0.75.518",
|
|
135
|
+
"@stacksjs/objects": "0.75.518",
|
|
136
|
+
"@stacksjs/orm": "0.75.518",
|
|
137
|
+
"@stacksjs/path": "0.75.518",
|
|
138
|
+
"@stacksjs/payments": "0.75.518",
|
|
139
|
+
"@stacksjs/realtime": "0.75.518",
|
|
140
|
+
"@stacksjs/router": "0.75.518",
|
|
141
141
|
"@stacksjs/rpx": "^0.11.54",
|
|
142
|
-
"@stacksjs/scheduler": "0.75.
|
|
143
|
-
"@stacksjs/search-engine": "0.75.
|
|
144
|
-
"@stacksjs/security": "0.75.
|
|
145
|
-
"@stacksjs/server": "0.75.
|
|
146
|
-
"@stacksjs/sites": "0.75.
|
|
147
|
-
"@stacksjs/skills": "0.75.
|
|
148
|
-
"@stacksjs/socials": "0.75.
|
|
149
|
-
"@stacksjs/storage": "0.75.
|
|
150
|
-
"@stacksjs/strings": "0.75.
|
|
142
|
+
"@stacksjs/scheduler": "0.75.518",
|
|
143
|
+
"@stacksjs/search-engine": "0.75.518",
|
|
144
|
+
"@stacksjs/security": "0.75.518",
|
|
145
|
+
"@stacksjs/server": "0.75.518",
|
|
146
|
+
"@stacksjs/sites": "0.75.518",
|
|
147
|
+
"@stacksjs/skills": "0.75.518",
|
|
148
|
+
"@stacksjs/socials": "0.75.518",
|
|
149
|
+
"@stacksjs/storage": "0.75.518",
|
|
150
|
+
"@stacksjs/strings": "0.75.518",
|
|
151
151
|
"@stacksjs/stx": "0.2.807",
|
|
152
|
-
"@stacksjs/testing": "0.75.
|
|
153
|
-
"@stacksjs/tinker": "0.75.
|
|
152
|
+
"@stacksjs/testing": "0.75.518",
|
|
153
|
+
"@stacksjs/tinker": "0.75.518",
|
|
154
154
|
"@stacksjs/tlsx": "^0.13.19",
|
|
155
155
|
"@stacksjs/ts-cloud": "^0.16.109",
|
|
156
|
-
"@stacksjs/tunnel": "0.75.
|
|
157
|
-
"@stacksjs/types": "0.75.
|
|
158
|
-
"@stacksjs/ui": "0.75.
|
|
159
|
-
"@stacksjs/utils": "0.75.
|
|
160
|
-
"@stacksjs/validation": "0.75.
|
|
156
|
+
"@stacksjs/tunnel": "0.75.518",
|
|
157
|
+
"@stacksjs/types": "0.75.518",
|
|
158
|
+
"@stacksjs/ui": "0.75.518",
|
|
159
|
+
"@stacksjs/utils": "0.75.518",
|
|
160
|
+
"@stacksjs/validation": "0.75.518",
|
|
161
161
|
"ajv": "^8.20.0",
|
|
162
162
|
"ajv-formats": "^3.0.1",
|
|
163
163
|
"bun-plugin-stx": "0.2.807",
|