@stacksjs/buddy 0.75.639 → 0.75.640

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.
@@ -1,3 +1,3 @@
1
- import process from"node:process";import{runAction}from"@stacksjs/actions/run-action";import{intro,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{Action}from"@stacksjs/enums";import{projectPath}from"@stacksjs/path";import{ExitCode}from"@stacksjs/types";import{resultFailed}from"../result";function testPathEnv(paths){return paths?.length?{STACKS_TEST_PATHS:JSON.stringify(paths)}:undefined}function scopedTests(label,paths){if(!paths?.length)return label;return`${label} for ${paths.length===1?paths[0]:`${paths.length} paths`}`}export function test(buddy){const descriptions={command:"Runs your test suite",types:"Typechecks your codebase",coverage:"Generates a test coverage report",ui:"Runs your test suite in the browser",unit:"Runs your unit tests",feature:"Runs your feature tests",showReport:"Show the test report",project:"Target a specific project",verbose:"Enable verbose output"};buddy.command("test [...paths]",descriptions.command).option("-f, --feature",descriptions.feature,{default:false}).option("-u, --unit",descriptions.unit,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:true}).example("buddy test").example("buddy test tests/unit/auth.test.ts").example("buddy test storage/framework/core/scheduler/tests").action(async(paths,options)=>{const perf=await intro("buddy test");const env=testPathEnv(paths);if(options.feature&&options.unit){const result=await runAction(Action.Test,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(options.feature&&!options.unit){log.info("Running Feature tests...");const result=await runAction(Action.TestFeature,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(!options.feature&&options.unit){log.info("Running Unit tests...");const result=await runAction(Action.TestUnit,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(!options.feature&&!options.unit){const result=await runAction(Action.Test,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}await outro(scopedTests("Finished running tests",paths),{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("test:unit [...paths]",descriptions.unit).option("--verbose",descriptions.verbose,{default:false}).example("buddy test:unit").example("buddy test:unit tests/unit/auth.test.ts").action(async(paths,options)=>{const perf=await intro("buddy test:unit");const result=await runAction(Action.TestUnit,{...options,verbose:true,cwd:projectPath(),env:testPathEnv(paths)});if(resultFailed(result)){await outro("While running `buddy test:unit`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro(scopedTests("Finished running unit tests",paths),{startTime:perf,useSeconds:true})});buddy.command("test:feature [...paths]",descriptions.feature).option("--verbose",descriptions.verbose,{default:false}).example("buddy test:feature").example("buddy test:feature tests/feature/login.test.ts").action(async(paths,options)=>{const perf=await intro("buddy test:feature");const result=await runAction(Action.TestFeature,{...options,verbose:true,cwd:projectPath(),env:testPathEnv(paths)});if(resultFailed(result)){await outro("While running `buddy test:feature`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro(scopedTests("Finished running feature tests",paths),{startTime:perf,useSeconds:true})});buddy.command("test:ui",descriptions.command).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{const perf=await intro("buddy test:ui");const result=await runAction(Action.TestUi,{...options,verbose:true,cwd:projectPath()});if(resultFailed(result)){await outro("While running `buddy test:ui`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro("Finished running tests in the browser",{startTime:perf,useSeconds:true})});buddy.command("test:types",descriptions.types).alias("typecheck").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{const perf=await intro("buddy test:types");const result=await runAction(Action.Typecheck,{...options,verbose:true,cwd:projectPath()});if(resultFailed(result)){await outro("While running `buddy test:types`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro("Finished running typecheck",{startTime:perf,useSeconds:true})});buddy.command("test:page-audit","Loads pages in headless Chrome and reports duplicate API requests, failed requests and console errors").option("--url <urls>","Page URLs to audit, comma-separated (paths resolve against --base)").option("--base [base]","Origin that paths in --url resolve against",{default:"http://localhost:3000"}).option("--quiet-ms [ms]","How long the network must stay quiet before a page counts as loaded",{default:1000}).option("--timeout [ms]","Give up waiting for a page to settle after this long",{default:15000}).option("--mobile","Audit at a 390px phone viewport instead of 1440px",{default:false}).option("--json","Print the reports as JSON",{default:false}).option("--lighthouse","Also measure Performance, Accessibility, Best Practices and SEO with Lighthouse",{default:false}).option("--sitemap <file>","Audit every page in a local sitemap on --base").option("--device <device>","Lighthouse profile: mobile, desktop or both",{default:"both"}).option("--basic-auth","Authenticate on --base using STACKS_AUDIT_USERNAME and STACKS_AUDIT_PASSWORD",{default:false}).option("--min-score <score>","Required Lighthouse score in every category, from 0 to 100",{default:100}).option("--output <directory>","Directory for Lighthouse JSON, HTML and summary reports",{default:"storage/framework/testing/lighthouse"}).example("buddy test:page-audit --url /,/dashboard --base http://localhost:3000").example("buddy test:page-audit --url http://localhost:3000/pricing --json").example("buddy test:page-audit --lighthouse --sitemap public/sitemap.xml --base http://localhost:3000 --min-score 100").action(async(options)=>{const{auditLighthouse,basicAuditOrigin,formatLighthouseResult,lighthouseTargets}=await import("@stacksjs/testing/lighthouse");const base=options.base||"http://localhost:3000";const username=process.env.STACKS_AUDIT_USERNAME;const password=process.env.STACKS_AUDIT_PASSWORD;let targets;let authOrigin;try{targets=await lighthouseTargets(options);if(options.basicAuth){authOrigin=basicAuditOrigin(base,targets);if(!username||!password)throw new TypeError("Set STACKS_AUDIT_USERNAME and STACKS_AUDIT_PASSWORD for --basic-auth");delete process.env.STACKS_AUDIT_USERNAME;delete process.env.STACKS_AUDIT_PASSWORD}if(options.lighthouse){if(!["mobile","desktop","both"].includes(options.device||"both"))throw new TypeError("Choose mobile, desktop or both");const minimum=Number(options.minScore??100);if(!Number.isFinite(minimum)||minimum<0||minimum>100)throw new TypeError("Minimum score must be between 0 and 100")}}catch(error){await log.error(error instanceof Error?error.message:String(error));process.exit(ExitCode.InvalidArgument)}const{auditPage,formatPageAudit,installBasicAuth,launch,pageAuditClean}=await import("@stacksjs/testing/browser");const viewport=options.mobile?{width:390,height:844,mobile:true,deviceScaleFactor:2}:{width:1440,height:900};const{cdp,close,port}=await launch({viewport,shared:authOrigin?false:undefined});const reports=[];let lighthouse=[];try{if(authOrigin)await installBasicAuth(cdp,authOrigin,username,password);for(const target of targets){const url=new URL(target,base).href;const report=await auditPage(url,{cdp,quietMs:Number(options.quietMs)||1000,timeoutMs:Number(options.timeout)||15000});reports.push(report);if(!options.json)await log.info(formatPageAudit(report))}if(!authOrigin)await close();if(options.lighthouse){if(authOrigin)await cdp.send("Page.navigate",{url:"about:blank"});lighthouse=await auditLighthouse({urls:targets,outputDir:options.output||projectPath("storage/framework/testing/lighthouse"),device:options.device,minimum:Number(options.minScore??100),chromePort:authOrigin?port:undefined,onResult:(result)=>{if(!options.json)process.stdout.write(`${formatLighthouseResult(result)}
1
+ import process from"node:process";import{runAction}from"@stacksjs/actions/run-action";import{intro,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{Action}from"@stacksjs/enums";import{projectPath}from"@stacksjs/path";import{ExitCode}from"@stacksjs/types";import{resultFailed}from"../result";function testPathEnv(paths){return paths?.length?{STACKS_TEST_PATHS:JSON.stringify(paths)}:undefined}function scopedTests(label,paths){if(!paths?.length)return label;return`${label} for ${paths.length===1?paths[0]:`${paths.length} paths`}`}export function test(buddy){const descriptions={command:"Runs your test suite",types:"Typechecks your codebase",coverage:"Generates a test coverage report",ui:"Runs your test suite in the browser",unit:"Runs your unit tests",feature:"Runs your feature tests",showReport:"Show the test report",project:"Target a specific project",verbose:"Enable verbose output"};buddy.command("test [...paths]",descriptions.command).option("-f, --feature",descriptions.feature,{default:false}).option("-u, --unit",descriptions.unit,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:true}).example("buddy test").example("buddy test tests/unit/auth.test.ts").example("buddy test storage/framework/core/scheduler/tests").action(async(paths,options)=>{const perf=await intro("buddy test");const env=testPathEnv(paths);if(options.feature&&options.unit){const result=await runAction(Action.Test,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(options.feature&&!options.unit){log.info("Running Feature tests...");const result=await runAction(Action.TestFeature,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(!options.feature&&options.unit){log.info("Running Unit tests...");const result=await runAction(Action.TestUnit,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}if(!options.feature&&!options.unit){const result=await runAction(Action.Test,{...options,cwd:projectPath(),env});if(resultFailed(result)){await outro("While running `buddy test`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}}await outro(scopedTests("Finished running tests",paths),{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("test:unit [...paths]",descriptions.unit).option("--verbose",descriptions.verbose,{default:false}).example("buddy test:unit").example("buddy test:unit tests/unit/auth.test.ts").action(async(paths,options)=>{const perf=await intro("buddy test:unit");const result=await runAction(Action.TestUnit,{...options,verbose:true,cwd:projectPath(),env:testPathEnv(paths)});if(resultFailed(result)){await outro("While running `buddy test:unit`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro(scopedTests("Finished running unit tests",paths),{startTime:perf,useSeconds:true})});buddy.command("test:feature [...paths]",descriptions.feature).option("--verbose",descriptions.verbose,{default:false}).example("buddy test:feature").example("buddy test:feature tests/feature/login.test.ts").action(async(paths,options)=>{const perf=await intro("buddy test:feature");const result=await runAction(Action.TestFeature,{...options,verbose:true,cwd:projectPath(),env:testPathEnv(paths)});if(resultFailed(result)){await outro("While running `buddy test:feature`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro(scopedTests("Finished running feature tests",paths),{startTime:perf,useSeconds:true})});buddy.command("test:ui",descriptions.command).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{const perf=await intro("buddy test:ui");const result=await runAction(Action.TestUi,{...options,verbose:true,cwd:projectPath()});if(resultFailed(result)){await outro("While running `buddy test:ui`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro("Finished running tests in the browser",{startTime:perf,useSeconds:true})});buddy.command("test:types",descriptions.types).alias("typecheck").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{const perf=await intro("buddy test:types");const result=await runAction(Action.Typecheck,{...options,verbose:true,cwd:projectPath()});if(resultFailed(result)){await outro("While running `buddy test:types`, there was an issue",{startTime:perf,useSeconds:true},result.error);process.exit(ExitCode.FatalError)}await outro("Finished running typecheck",{startTime:perf,useSeconds:true})});buddy.command("test:page-audit","Loads pages in headless Chrome and reports duplicate API requests, failed requests and console errors").option("--url <urls>","Page URLs to audit, comma-separated (paths resolve against --base)").option("--base [base]","Origin that paths in --url resolve against",{default:"http://localhost:3000"}).option("--quiet-ms [ms]","How long the network must stay quiet before a page counts as loaded",{default:1000}).option("--timeout [ms]","Give up waiting for a page to settle after this long",{default:15000}).option("--mobile","Audit at a 390px phone viewport instead of 1440px",{default:false}).option("--json","Print the reports as JSON",{default:false}).option("--lighthouse","Also measure Performance, Accessibility, Best Practices and SEO with Lighthouse",{default:false}).option("--sitemap <file>","Audit every page in a local sitemap on --base").option("--device <device>","Lighthouse profile: mobile, desktop or both",{default:"both"}).option("--basic-auth","Authenticate on --base using STACKS_AUDIT_USERNAME and STACKS_AUDIT_PASSWORD",{default:false}).option("--min-score <score>","Required Lighthouse score in every category, from 0 to 100",{default:100}).option("--output <directory>","Directory for Lighthouse JSON, HTML and summary reports",{default:"storage/framework/testing/lighthouse"}).example("buddy test:page-audit --url /,/dashboard --base http://localhost:3000").example("buddy test:page-audit --url http://localhost:3000/pricing --json").example("buddy test:page-audit --lighthouse --sitemap public/sitemap.xml --base http://localhost:3000 --min-score 100").action(async(options)=>{const{auditLighthouse,basicAuditOrigin,formatLighthouseResult,lighthouseTargets}=await import("@stacksjs/testing/lighthouse");const base=options.base||"http://localhost:3000";const username=process.env.STACKS_AUDIT_USERNAME;const password=process.env.STACKS_AUDIT_PASSWORD;let targets;let authOrigin;try{targets=await lighthouseTargets(options);if(options.basicAuth){authOrigin=basicAuditOrigin(base,targets);if(!username||!password)throw new TypeError("Set STACKS_AUDIT_USERNAME and STACKS_AUDIT_PASSWORD for --basic-auth");delete process.env.STACKS_AUDIT_USERNAME;delete process.env.STACKS_AUDIT_PASSWORD}if(options.lighthouse){if(!["mobile","desktop","both"].includes(options.device||"both"))throw new TypeError("Choose mobile, desktop or both");const minimum=Number(options.minScore??100);if(!Number.isFinite(minimum)||minimum<0||minimum>100)throw new TypeError("Minimum score must be between 0 and 100")}}catch(error){await log.error(error instanceof Error?error.message:String(error));process.exit(ExitCode.InvalidArgument)}const{auditPage,formatPageAudit,installBasicAuth,launch,pageAuditClean}=await import("@stacksjs/testing/browser");const viewport=options.mobile?{width:390,height:844,mobile:true,deviceScaleFactor:2}:{width:1440,height:900};const{cdp,close,port}=await launch({viewport,shared:false});const reports=[];let lighthouse=[];try{if(authOrigin)await installBasicAuth(cdp,authOrigin,username,password);for(const target of targets){const url=new URL(target,base).href;const report=await auditPage(url,{cdp,quietMs:Number(options.quietMs)||1000,timeoutMs:Number(options.timeout)||15000});reports.push(report);if(!options.json)await log.info(formatPageAudit(report))}if(!authOrigin)await close();if(options.lighthouse){if(authOrigin)await cdp.send("Page.navigate",{url:"about:blank"});lighthouse=await auditLighthouse({urls:targets,outputDir:options.output||projectPath("storage/framework/testing/lighthouse"),device:options.device,minimum:Number(options.minScore??100),chromePort:authOrigin?port:undefined,onResult:(result)=>{if(!options.json)process.stdout.write(`${formatLighthouseResult(result)}
2
2
  `)}})}}finally{await close()}if(options.json)process.stdout.write(`${JSON.stringify(options.lighthouse?{pages:reports,lighthouse}:reports,null,2)}
3
3
  `);process.exit(reports.every(pageAuditClean)&&lighthouse.every((result)=>result.passed)?ExitCode.Success:ExitCode.FatalError)});onUnknownSubcommand(buddy,"test")}
@@ -67,7 +67,7 @@ export declare const VENDORED_DEFAULTS: 'storage/framework/defaults';
67
67
  * `scaffold-package-app.test.ts` fails if one stops existing in the
68
68
  * repository, so a moved file cannot quietly start shipping again.
69
69
  */
70
- export declare const FRAMEWORK_ONLY_PATHS: readonly ['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'];
70
+ export declare const FRAMEWORK_ONLY_PATHS: readonly ['bench', 'config/changelog.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'];
71
71
  /**
72
72
  * The STX runtime packages, released together at one version: the runtime,
73
73
  * its components, its compiler, and the three the runtime itself pulls in.
@@ -1,4 +1,4 @@
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)}
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","config/changelog.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,"logsmith.config.ts"]){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
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
3
  `)}return changes}export const STX_RUNTIME_PACKAGES=["@stacksjs/stx","@stacksjs/components","bun-plugin-stx","@stacksjs/desktop","@stacksjs/sanitizer","stx-router"];export function appPackageOverrides(overrides){const next={};const removed=[];for(const[name,rule]of Object.entries(overrides)){if(STX_RUNTIME_PACKAGES.includes(name))removed.push(name);else next[name]=rule}return{overrides:next,removed}}export function applyAppPackageOverrides(root){const file=join(root,"package.json");if(!existsSync(file))return[];const pkg=JSON.parse(readFileSync(file,"utf8"));if(!pkg.overrides||typeof pkg.overrides!=="object"||Array.isArray(pkg.overrides))return[];const{overrides,removed}=appPackageOverrides(pkg.overrides);if(removed.length===0)return[];if(Object.keys(overrides).length>0)pkg.overrides=overrides;else delete pkg.overrides;writeFileSync(file,`${JSON.stringify(pkg,null,2)}
4
4
  `);return removed}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)}
@@ -37,7 +37,7 @@ export declare const APP_SITE_TEMPLATE: 'storage/framework/defaults/scaffold/res
37
37
  *
38
38
  * `scaffold-site.test.ts` holds this against the repository: a top-level path
39
39
  * committed here later is either added to this list, because an app wants it,
40
- * or to one of the lists that remove it. `ops/` and `.reviewos/` reached every
40
+ * or to one of the lists that remove it. Host operations and `.reviewos/` reached every
41
41
  * new app because nothing asked that question.
42
42
  */
43
43
  export declare const APP_TOP_LEVEL: readonly string[];
@@ -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","ops",".reviewos","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"]);export const APP_TOP_LEVEL=[".devcontainer",".dockerignore",".editorconfig",".env.example",".gitattributes",".github",".gitignore",".security-ignore.json","AGENTS.md","CHANGELOG.md","README.md","app","bootstrap","buddy","bun.lock","bunfig.toml","cloud","config","database","locales","package.json","pantry.lock","public","resources","routes","storage","tests","tsconfig.json"];export const REMOVED_BY_OTHER_STEPS={".env.development":"install",".env.production":"install",".env.staging":"install","LICENSE.md":"removeFrameworkLicense","deps.yml":"generatePantryDeps"};function parentOf(relative){return relative.includes("/")?relative.slice(0,relative.lastIndexOf("/")):""}function isEmptyDir(dir){return existsSync(dir)&&readdirSync(dir).length===0}
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","cloud/production",".reviewos","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,"ops"]){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"]);export const APP_TOP_LEVEL=[".devcontainer",".dockerignore",".editorconfig",".env.example",".gitattributes",".github",".gitignore",".security-ignore.json","AGENTS.md","CHANGELOG.md","README.md","app","bootstrap","buddy","bun.lock","bunfig.toml","cloud","config","database","locales","package.json","pantry.lock","public","resources","routes","storage","tests","tsconfig.json"];export const REMOVED_BY_OTHER_STEPS={".env.development":"install",".env.production":"install",".env.staging":"install","LICENSE.md":"removeFrameworkLicense","deps.yml":"generatePantryDeps"};function parentOf(relative){return relative.includes("/")?relative.slice(0,relative.lastIndexOf("/")):""}function isEmptyDir(dir){return existsSync(dir)&&readdirSync(dir).length===0}
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.639",
5
+ "version": "0.75.640",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -95,71 +95,71 @@
95
95
  "prepublishOnly": "bun run build"
96
96
  },
97
97
  "dependencies": {
98
- "@stacksjs/actions": "0.75.639",
99
- "@stacksjs/docs": "0.75.639",
100
- "@stacksjs/ai": "0.75.639",
101
- "@stacksjs/alias": "0.75.639",
102
- "@stacksjs/analytics": "0.75.639",
103
- "@stacksjs/api": "0.75.639",
104
- "@stacksjs/arrays": "0.75.639",
105
- "@stacksjs/auth": "0.75.639",
106
- "@stacksjs/browser-extension": "0.75.639",
107
- "@stacksjs/build": "0.75.639",
98
+ "@stacksjs/actions": "0.75.640",
99
+ "@stacksjs/docs": "0.75.640",
100
+ "@stacksjs/ai": "0.75.640",
101
+ "@stacksjs/alias": "0.75.640",
102
+ "@stacksjs/analytics": "0.75.640",
103
+ "@stacksjs/api": "0.75.640",
104
+ "@stacksjs/arrays": "0.75.640",
105
+ "@stacksjs/auth": "0.75.640",
106
+ "@stacksjs/browser-extension": "0.75.640",
107
+ "@stacksjs/build": "0.75.640",
108
108
  "@stacksjs/bumpx": "^0.2.32",
109
- "@stacksjs/cache": "0.75.639",
110
- "@stacksjs/chat": "0.75.639",
109
+ "@stacksjs/cache": "0.75.640",
110
+ "@stacksjs/chat": "0.75.640",
111
111
  "@stacksjs/clapp": "^0.2.17",
112
- "@stacksjs/cli": "0.75.639",
113
- "@stacksjs/cloud": "0.75.639",
114
- "@stacksjs/cms": "0.75.639",
115
- "@stacksjs/collections": "0.75.639",
116
- "@stacksjs/commerce": "0.75.639",
117
- "@stacksjs/config": "0.75.639",
118
- "@stacksjs/database": "0.75.639",
119
- "@stacksjs/desktop-build": "0.75.639",
120
- "@stacksjs/dns": "0.75.639",
112
+ "@stacksjs/cli": "0.75.640",
113
+ "@stacksjs/cloud": "0.75.640",
114
+ "@stacksjs/cms": "0.75.640",
115
+ "@stacksjs/collections": "0.75.640",
116
+ "@stacksjs/commerce": "0.75.640",
117
+ "@stacksjs/config": "0.75.640",
118
+ "@stacksjs/database": "0.75.640",
119
+ "@stacksjs/desktop-build": "0.75.640",
120
+ "@stacksjs/dns": "0.75.640",
121
121
  "@stacksjs/dnsx": "^0.2.3",
122
- "@stacksjs/email": "0.75.639",
123
- "@stacksjs/enums": "0.75.639",
124
- "@stacksjs/env": "0.75.639",
125
- "@stacksjs/error-handling": "0.75.639",
126
- "@stacksjs/events": "0.75.639",
127
- "@stacksjs/features": "0.75.639",
128
- "@stacksjs/git": "0.75.639",
122
+ "@stacksjs/email": "0.75.640",
123
+ "@stacksjs/enums": "0.75.640",
124
+ "@stacksjs/env": "0.75.640",
125
+ "@stacksjs/error-handling": "0.75.640",
126
+ "@stacksjs/events": "0.75.640",
127
+ "@stacksjs/features": "0.75.640",
128
+ "@stacksjs/git": "0.75.640",
129
129
  "@stacksjs/gitit": "^0.2.5",
130
- "@stacksjs/health": "0.75.639",
131
- "@stacksjs/hq": "0.75.639",
130
+ "@stacksjs/health": "0.75.640",
131
+ "@stacksjs/hq": "0.75.640",
132
132
  "@stacksjs/httx": "^0.1.10",
133
- "@stacksjs/image": "0.75.639",
134
- "@stacksjs/lint": "0.75.639",
135
- "@stacksjs/logging": "0.75.639",
136
- "@stacksjs/notifications": "0.75.639",
137
- "@stacksjs/objects": "0.75.639",
138
- "@stacksjs/orm": "0.75.639",
139
- "@stacksjs/path": "0.75.639",
140
- "@stacksjs/payments": "0.75.639",
141
- "@stacksjs/realtime": "0.75.639",
142
- "@stacksjs/router": "0.75.639",
133
+ "@stacksjs/image": "0.75.640",
134
+ "@stacksjs/lint": "0.75.640",
135
+ "@stacksjs/logging": "0.75.640",
136
+ "@stacksjs/notifications": "0.75.640",
137
+ "@stacksjs/objects": "0.75.640",
138
+ "@stacksjs/orm": "0.75.640",
139
+ "@stacksjs/path": "0.75.640",
140
+ "@stacksjs/payments": "0.75.640",
141
+ "@stacksjs/realtime": "0.75.640",
142
+ "@stacksjs/router": "0.75.640",
143
143
  "@stacksjs/rpx": "^0.11.54",
144
- "@stacksjs/scheduler": "0.75.639",
145
- "@stacksjs/search-engine": "0.75.639",
146
- "@stacksjs/security": "0.75.639",
147
- "@stacksjs/server": "0.75.639",
148
- "@stacksjs/sites": "0.75.639",
149
- "@stacksjs/skills": "0.75.639",
150
- "@stacksjs/socials": "0.75.639",
151
- "@stacksjs/storage": "0.75.639",
152
- "@stacksjs/strings": "0.75.639",
144
+ "@stacksjs/scheduler": "0.75.640",
145
+ "@stacksjs/search-engine": "0.75.640",
146
+ "@stacksjs/security": "0.75.640",
147
+ "@stacksjs/server": "0.75.640",
148
+ "@stacksjs/sites": "0.75.640",
149
+ "@stacksjs/skills": "0.75.640",
150
+ "@stacksjs/socials": "0.75.640",
151
+ "@stacksjs/storage": "0.75.640",
152
+ "@stacksjs/strings": "0.75.640",
153
153
  "@stacksjs/stx": "^0.2.908",
154
- "@stacksjs/testing": "0.75.639",
155
- "@stacksjs/tinker": "0.75.639",
154
+ "@stacksjs/testing": "0.75.640",
155
+ "@stacksjs/tinker": "0.75.640",
156
156
  "@stacksjs/tlsx": "^0.13.19",
157
157
  "@stacksjs/ts-cloud": "^0.16.144",
158
- "@stacksjs/tunnel": "0.75.639",
159
- "@stacksjs/types": "0.75.639",
160
- "@stacksjs/ui": "0.75.639",
161
- "@stacksjs/utils": "0.75.639",
162
- "@stacksjs/validation": "0.75.639",
158
+ "@stacksjs/tunnel": "0.75.640",
159
+ "@stacksjs/types": "0.75.640",
160
+ "@stacksjs/ui": "0.75.640",
161
+ "@stacksjs/utils": "0.75.640",
162
+ "@stacksjs/validation": "0.75.640",
163
163
  "ajv": "^8.20.0",
164
164
  "ajv-formats": "^3.0.1",
165
165
  "bun-plugin-stx": "^0.2.908",