@stacksjs/actions 0.75.539 → 0.75.542
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/build/android-config.d.ts +7 -0
- package/dist/build/ios-config.d.ts +7 -10
- package/dist/build/native-sensors.d.ts +2 -0
- package/dist/dev/dashboard-feature-views.d.ts +8 -0
- package/dist/dev/dashboard-feature-views.js +1 -1
- package/dist/dev/dashboard.js +2 -2
- package/dist/dev/views.js +1 -1
- package/dist/upgrade/packages.d.ts +16 -1
- package/dist/upgrade/packages.js +1 -1
- package/package.json +45 -45
|
@@ -18,6 +18,12 @@ export declare function androidRelease(config: Pick<AndroidMobileConfig, 'versio
|
|
|
18
18
|
* not fail a release build.
|
|
19
19
|
*/
|
|
20
20
|
export declare function uploadAndroidMapping(mappingPath: string, host: string, release: string, token: string | undefined, send?: typeof fetch): Promise<{ ok: boolean, message: string }>;
|
|
21
|
+
/**
|
|
22
|
+
* An app's `android.capabilities` names, and the Craft `enable…` flag each
|
|
23
|
+
* sets. Closed, like ios-config.ts's map, and checked against the installed
|
|
24
|
+
* Craft by tests/craft-capability-parity.test.ts.
|
|
25
|
+
*/
|
|
26
|
+
declare const CAPABILITY_KEYS: Partial<Record<keyof MobileCapabilities, `enable${string}`>>;
|
|
21
27
|
/** Craft Android flags no `android.capabilities` name sets, each with why. */
|
|
22
28
|
export declare const ANDROID_UNMAPPED_CRAFT_FLAGS: Readonly<Record<`enable${string}`, string>>;
|
|
23
29
|
/**
|
|
@@ -92,3 +98,4 @@ export declare interface CraftAndroidConfig {
|
|
|
92
98
|
privacyPolicyURL?: string
|
|
93
99
|
}
|
|
94
100
|
export type AndroidCraftFeature = keyof typeof CRAFT_ANDROID_FLOORS;
|
|
101
|
+
export { CAPABILITY_KEYS as ANDROID_CAPABILITY_KEYS };
|
|
@@ -72,9 +72,7 @@ export declare const NATIVE_APP_ROUTE: '__app';
|
|
|
72
72
|
* tests/craft-capability-parity.test.ts fails on any flag the installed Craft
|
|
73
73
|
* declares that is neither here nor in {@link IOS_UNMAPPED_CRAFT_FLAGS}.
|
|
74
74
|
*/
|
|
75
|
-
declare const CAPABILITY_KEYS: Partial<Record<keyof MobileCapabilities, `enable${string}
|
|
76
|
-
|
|
77
|
-
export { CAPABILITY_KEYS as IOS_CAPABILITY_KEYS };
|
|
75
|
+
declare const CAPABILITY_KEYS: Partial<Record<keyof MobileCapabilities, `enable${string}`>>;
|
|
78
76
|
/** Craft iOS flags no `ios.capabilities` name sets, each with why. */
|
|
79
77
|
export declare const IOS_UNMAPPED_CRAFT_FLAGS: Readonly<Record<`enable${string}`, string>>;
|
|
80
78
|
/**
|
|
@@ -88,12 +86,7 @@ export declare const IOS_UNMAPPED_CRAFT_FLAGS: Readonly<Record<`enable${string}`
|
|
|
88
86
|
* @stacksjs/mobile. Capabilities older than every craft-native Stacks has
|
|
89
87
|
* accepted are not listed.
|
|
90
88
|
*/
|
|
91
|
-
export declare const CRAFT_CAPABILITY_FLOORS: Partial<Record<keyof typeof CAPABILITY_KEYS, string
|
|
92
|
-
|
|
93
|
-
export interface UnsupportedCraftCapability {
|
|
94
|
-
capability: keyof typeof CRAFT_CAPABILITY_FLOORS
|
|
95
|
-
needs: string
|
|
96
|
-
};
|
|
89
|
+
export declare const CRAFT_CAPABILITY_FLOORS: Partial<Record<keyof typeof CAPABILITY_KEYS, string>>;
|
|
97
90
|
/** The first craft-native whose iOS and Android shells report crashes (CraftCrashReporter). */
|
|
98
91
|
export declare const CRAFT_CRASH_REPORTING_FLOOR: '0.0.179';
|
|
99
92
|
export declare const CRAFT_NATIVE_FONTS_FLOOR: '0.0.229';
|
|
@@ -144,4 +137,8 @@ export declare interface CraftIosConfig {
|
|
|
144
137
|
orientations?: IosMobileConfig['orientations']
|
|
145
138
|
deviceFamilies?: IosMobileConfig['deviceFamilies']
|
|
146
139
|
}
|
|
147
|
-
export {
|
|
140
|
+
export declare interface UnsupportedCraftCapability {
|
|
141
|
+
capability: keyof typeof CRAFT_CAPABILITY_FLOORS
|
|
142
|
+
needs: string
|
|
143
|
+
}
|
|
144
|
+
export { CAPABILITY_KEYS as IOS_CAPABILITY_KEYS };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { MobileCapabilities } from '@stacksjs/types';
|
|
2
|
+
/** Only serialize flags the selected builder advertises, including explicit false. */
|
|
3
|
+
export declare function nativeSensorCapabilityKeys(platform: 'ios' | 'android', supported: readonly string[] | undefined): Partial<Record<keyof MobileCapabilities, `enable${string}`>>;
|
|
2
4
|
/** Check the actual builder instead of inventing a version for unreleased support. */
|
|
3
5
|
export declare function assertCraftSupportsNativeSensors(platform: 'ios' | 'android', capabilities: MobileCapabilities | undefined, supported: readonly string[] | undefined): void;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The config files of the features that are off, by name (`cms` for
|
|
3
|
+
* `config/cms.ts`). Settings leaves them out, for the same reason the sidebar
|
|
4
|
+
* leaves out their sections: an app that never installed commerce has no
|
|
5
|
+
* commerce to configure, and the file is where `./buddy commerce:install`
|
|
6
|
+
* turns it on, not the dashboard.
|
|
7
|
+
*/
|
|
8
|
+
export declare function disabledFeatureConfigs(enabled: (feature: DashboardViewFeature) => boolean): Set<string>;
|
|
1
9
|
/** The page directories under `frameworkDashboard` to leave out of serving. */
|
|
2
10
|
export declare function disabledFeatureViews(frameworkDashboard: string, enabled: (feature: DashboardViewFeature) => boolean): string[];
|
|
3
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join}from"node:path";export const FEATURE_DASHBOARD_VIEWS={cms:["content"],commerce:["commerce","analytics/commerce","marketing/abandoned-carts","marketing/reviews"]};export function disabledFeatureViews(frameworkDashboard,enabled){const out=[];for(const feature of Object.keys(FEATURE_DASHBOARD_VIEWS)){if(enabled(feature))continue;for(const relative of FEATURE_DASHBOARD_VIEWS[feature])out.push(join(frameworkDashboard,relative))}return out}
|
|
1
|
+
import{join}from"node:path";export const FEATURE_DASHBOARD_VIEWS={cms:["content"],commerce:["commerce","analytics/commerce","marketing/abandoned-carts","marketing/reviews"]};export function disabledFeatureConfigs(enabled){return new Set(Object.keys(FEATURE_DASHBOARD_VIEWS).filter((feature)=>!enabled(feature)))}export function disabledFeatureViews(frameworkDashboard,enabled){const out=[];for(const feature of Object.keys(FEATURE_DASHBOARD_VIEWS)){if(enabled(feature))continue;for(const relative of FEATURE_DASHBOARD_VIEWS[feature])out.push(join(frameworkDashboard,relative))}return out}
|
package/dist/dev/dashboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import process from"node:process";import{existsSync,mkdirSync}from"node:fs";import{connect}from"node:net";import{bold,cyan,dim,green}from"@stacksjs/cli";import{defaultsPath,projectPath,publicPath,storagePath}from"@stacksjs/path";import{seedCsrfPageResponse,validateDevCsrfRequest}from"./csrf";import{resolveComponentsLibraryRoot}from"./defaults-resources";import{shouldDelegateDashboardRequest}from"./dashboard-request-routing";import{resolveDashboardCraftExecutable}from"./dashboard-native";import{resolveDashboardDomain,resolveDashboardProxyStrategy}from"./dashboard-proxy";import{buildManifest,discoverProjectModels,findAvailablePort,modelsWithEnabledFeatures,waitForServer,writeFileIfChanged}from"./dashboard-utils";import{runDashboardSupervisor}from"./dashboard-supervisor";import{ensureDiscoveredPackages}from"../discover-packages";import{resolveStxSource}from"../stx-source";if(process.env.STACKS_DASHBOARD_WORKER!=="1"){const exitCode=await runDashboardSupervisor(import.meta.path,process.argv.slice(2));process.exit(exitCode)}process.env.STX_DIR=storagePath("framework/runtime/dashboard-stx");const verboseIdx=process.argv.indexOf("--verbose");const verbose=verboseIdx!==-1&&process.argv[verboseIdx+1]!=="false";const startTime=Bun.nanoseconds();const originalConsoleLog=console.log;const originalConsoleWarn=console.warn;const bufferedLogs=[];console.log=(...args)=>{bufferedLogs.push(args.map(String).join(" "))};console.warn=(...args)=>{bufferedLogs.push(args.map(String).join(" "))};const dashboardPath=defaultsPath("views/dashboard");const userDashboardPath=projectPath("resources/views/dashboard");const dashboardComponentsPath=defaultsPath("resources/components/Dashboard");const userDashboardComponentsPath=projectPath("resources/components/Dashboard");const preferredPort=Number(process.env.PORT_ADMIN)||3002;const dashboardPort=await findAvailablePort(preferredPort);const appUrl=process.env.APP_URL||"";const dashboardDomain=resolveDashboardDomain(appUrl,process.env.STACKS_DEV_LOCALHOST==="1");const sslBasePath=`${process.env.HOME}/.stacks/ssl`;function restoreConsole(){console.log=originalConsoleLog;console.warn=(...args)=>{const msg=args.map(String).join(" ");if(msg.includes("[STX] DOM API violation")||msg.includes("unsafe expression"))return;originalConsoleWarn(...args)}}async function startStxServer(){const{overridesReady}=await import("@stacksjs/config");const{autoImportsAreStale,generateAutoImportFiles,injectGlobalAutoImports}=await import("@stacksjs/server");await overridesReady;await ensureDiscoveredPackages();if(!existsSync(storagePath("framework/auto-imports/models.ts"))||autoImportsAreStale())await generateAutoImportFiles();await injectGlobalAutoImports();const serveSource=resolveStxSource({value:process.env.BUN_PLUGIN_STX_SRC});if(serveSource.kind==="missing"){throw new Error(`BUN_PLUGIN_STX_SRC points at ${serveSource.path}, which does not exist. Unset it to use the installed bun-plugin-stx.`)}let serve;if(serveSource.kind==="override"){serve=(await import(serveSource.path)).serve;console.log(`[Dashboard] bun-plugin-stx from ${serveSource.path}`)}else{serve=(await import("bun-plugin-stx/serve")).serve}const stxSource=resolveStxSource({value:process.env.STX_SRC});if(stxSource.kind==="missing"){throw new Error(`STX_SRC points at ${stxSource.path}, which does not exist. Unset it to use the installed @stacksjs/stx.`)}let stxModule;if(stxSource.kind==="override"){stxModule=await import(stxSource.path);console.log(`[Dashboard] stx from ${stxSource.path}`)}const{listConfigFiles,readConfig,updateConfigKeys}=await import(defaultsPath("resources/functions/dashboard/config-io.ts"));const localTsChartsRoot=process.env.TS_CHARTS_SRC;const dependencyBundles=new Map;function resolveTsChartsSource(packageName){const candidates=[...localTsChartsRoot?[`${localTsChartsRoot}/packages/${packageName}/src/index.ts`]:[],projectPath(`node_modules/@ts-charts/${packageName}/src/index.ts`)];return candidates.find(existsSync)||null}const tsChartsEntry=[...localTsChartsRoot?[`${localTsChartsRoot}/packages/ts-charts/src/index.ts`]:[],projectPath("node_modules/ts-charts/src/index.ts")].find(existsSync);async function buildDashboardDependency(entrypoint){const cached=dependencyBundles.get(entrypoint);if(cached)return cached;const build=(async()=>{const result=await Bun.build({entrypoints:[entrypoint],target:"browser",format:"esm",minify:true,plugins:[{name:"dashboard-ts-charts-source",setup(builder){builder.onResolve({filter:/^@ts-charts\/[a-z0-9-]+$/},(args)=>{const packageName=args.path.slice("@ts-charts/".length);const source=resolveTsChartsSource(packageName);if(source)return{path:source};return null})}}]});if(!result.success){const errors=result.logs.filter((log)=>log.level==="error").map((log)=>log.message).join(`
|
|
2
|
-
`);throw new Error(errors||`Failed to bundle ${entrypoint}`)}const output=result.outputs.find((file)=>file.path.endsWith(".js"));if(!output)throw new Error(`No JavaScript output produced for ${entrypoint}`);return output.text()})();dependencyBundles.set(entrypoint,build);return build}function browserDependencyRoute(entrypoint){return async()=>{try{return new Response(await buildDashboardDependency(entrypoint),{headers:{"content-type":"text/javascript; charset=utf-8","cache-control":"no-cache"}})}catch(error){dependencyBundles.delete(entrypoint);return new Response(`throw new Error(${JSON.stringify(error.message)})`,{status:500,headers:{"content-type":"text/javascript; charset=utf-8"}})}}}let dashboardIconCss=null;async function buildDashboardIconCss(){const{generateCss}=await import("@stacksjs/stx");const dirs=[dashboardPath,userDashboardPath,dashboardComponentsPath,userDashboardComponentsPath,projectPath("app/Models"),defaultsPath("app/Models"),defaultsPath("functions"),defaultsPath("resources/functions")];const icons=new Set;for(const dir of dirs){if(!existsSync(dir))continue;const glob=new Bun.Glob("**/*.{stx,ts}");for await(const file of glob.scan({cwd:dir,absolute:true})){const text=await Bun.file(file).text();for(const match of text.matchAll(/\bi-[a-z][a-z0-9]*(?:-[a-z0-9]+)+/g))icons.add(match[0])}}if(icons.size===0)return"";return generateCss(`<div class="${[...icons].join(" ")}"></div>`,process.cwd())}const configRoutes={"/__deps/charts.js":browserDependencyRoute(storagePath("framework/core/charts/src/index.ts")),"/__deps/ts-charts.js":browserDependencyRoute(tsChartsEntry||`${localTsChartsRoot}/packages/ts-charts/src/index.ts`),"/__deps/dashboard-icons.css":async()=>{if(!dashboardIconCss)dashboardIconCss=buildDashboardIconCss();return new Response(await dashboardIconCss,{headers:{"content-type":"text/css; charset=utf-8","cache-control":"no-cache"}})},"/api/config/list":async()=>{try{return Response.json({ok:true,files:listConfigFiles()})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/read":async(req)=>{try{const url=new URL(req.url);const name=url.searchParams.get("name")||"";if(!/^[\w-]+$/.test(name))return Response.json({ok:false,error:"Invalid config name"},{status:400});const result=await readConfig(name);if(!result)return Response.json({ok:false,error:"Not found"},{status:404});return Response.json({ok:true,name,fields:result.fields})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/source":async(req)=>{try{const url=new URL(req.url);const name=url.searchParams.get("name")||"";if(!/^[\w-]+$/.test(name))return Response.json({ok:false,error:"Invalid config name"},{status:400});const result=await readConfig(name);if(!result)return Response.json({ok:false,error:"Not found"},{status:404});return new Response(result.source,{headers:{"content-type":"text/plain; charset=utf-8"}})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/update":async(req)=>{if(req.method!=="POST")return Response.json({ok:false,error:"Method not allowed"},{status:405});try{await validateDevCsrfRequest(req);const body=await req.json();const file=body.file?.replace(/\.ts$/,"");if(!file||!/^[\w-]+$/.test(file))return Response.json({ok:false,error:"Invalid file"},{status:400});const updates=[];if(Array.isArray(body.updates)){for(const u of body.updates){const k=u.key??u.path;if(typeof k==="string")updates.push({key:k,value:u.value})}}else if(body.key){updates.push({key:body.key,value:body.value})}if(updates.length===0)return Response.json({ok:false,error:"No updates supplied"},{status:400});const invalid=updates.find((update)=>!/^[A-Za-z_$][\w$]*$/.test(update.key)||typeof update.value!=="string"&&typeof update.value!=="number"&&typeof update.value!=="boolean"||typeof update.value==="number"&&!Number.isFinite(update.value));if(invalid)return Response.json({ok:false,error:`Invalid value for configuration key "${invalid.key}"`},{status:400});const typedUpdates=updates;try{await updateConfigKeys(file,typedUpdates)}catch(err){const error=err?.message||"Configuration values could not be updated.";const results=typedUpdates.map((update)=>({key:update.key,ok:false,error}));return Response.json({ok:false,file,results,error},{status:422})}const results=typedUpdates.map((update)=>({key:update.key,ok:true,newValue:update.value}));return Response.json({ok:true,file,results})}catch(e){if(e?.status===403)return Response.json({ok:false,error:"Forbidden",message:"CSRF token mismatch"},{status:403});return Response.json({ok:false,error:e?.message},{status:500})}}};const router=await import("@stacksjs/router");await router.loadRoutes(await router.appRouteRegistry());await router.route.register(defaultsPath("routes/dashboard-api.ts"));const stacksRoute=router.route;const{feature}=await import("@stacksjs/config");const{disabledFeatureViews}=await import("./dashboard-feature-views");const serverPromise=serve({root:projectPath("resources"),patterns:[userDashboardPath,dashboardPath],exclude:disabledFeatureViews(dashboardPath,feature),port:dashboardPort,componentsDir:userDashboardComponentsPath,additionalComponentsDirs:[dashboardComponentsPath],fallbackComponentsDir:resolveComponentsLibraryRoot(),layoutsDir:projectPath("resources/views/dashboard/layouts"),fallbackLayoutsDir:defaultsPath("views/dashboard/layouts"),partialsDir:dashboardPath,publicDir:publicPath(),renderCache:true,renderCacheVary:"source",prewarmRenderCache:false,renderCachePersist:true,watchDirs:[projectPath("resources/functions"),defaultsPath("resources/functions"),defaultsPath("functions"),projectPath("config"),storagePath("framework/runtime/dashboard")],quiet:true,routes:configRoutes,onRequest:async(req)=>{const url=new URL(req.url);const pathname=url.pathname;if(shouldDelegateDashboardRequest(pathname,req.method))return stacksRoute.handleRequest(req);return null},onResponse:seedCsrfPageResponse,auth:false,...stxModule&&{stxModule}});serverPromise.catch((err)=>{restoreConsole();console.error(`
|
|
1
|
+
import process from"node:process";import{existsSync,mkdirSync}from"node:fs";import{connect}from"node:net";import{bold,cyan,dim,green}from"@stacksjs/cli";import{defaultsPath,projectPath,publicPath,storagePath}from"@stacksjs/path";import{seedCsrfPageResponse,validateDevCsrfRequest}from"./csrf";import{resolveComponentsLibraryRoot}from"./defaults-resources";import{shouldDelegateDashboardRequest}from"./dashboard-request-routing";import{resolveDashboardCraftExecutable}from"./dashboard-native";import{resolveDashboardDomain,resolveDashboardProxyStrategy}from"./dashboard-proxy";import{buildManifest,discoverProjectModels,findAvailablePort,modelsWithEnabledFeatures,waitForServer,writeFileIfChanged}from"./dashboard-utils";import{runDashboardSupervisor}from"./dashboard-supervisor";import{ensureDiscoveredPackages}from"../discover-packages";import{resolveStxSource}from"../stx-source";if(process.env.STACKS_DASHBOARD_WORKER!=="1"){const exitCode=await runDashboardSupervisor(import.meta.path,process.argv.slice(2));process.exit(exitCode)}process.env.STX_DIR=storagePath("framework/runtime/dashboard-stx");const verboseIdx=process.argv.indexOf("--verbose");const verbose=verboseIdx!==-1&&process.argv[verboseIdx+1]!=="false";const startTime=Bun.nanoseconds();const originalConsoleLog=console.log;const originalConsoleWarn=console.warn;const bufferedLogs=[];console.log=(...args)=>{bufferedLogs.push(args.map(String).join(" "))};console.warn=(...args)=>{bufferedLogs.push(args.map(String).join(" "))};const dashboardPath=defaultsPath("views/dashboard");const userDashboardPath=projectPath("resources/views/dashboard");const dashboardComponentsPath=defaultsPath("resources/components/Dashboard");const userDashboardComponentsPath=projectPath("resources/components/Dashboard");const preferredPort=Number(process.env.PORT_ADMIN)||3002;const dashboardPort=await findAvailablePort(preferredPort);const appUrl=process.env.APP_URL||"";const dashboardDomain=resolveDashboardDomain(appUrl,process.env.STACKS_DEV_LOCALHOST==="1");const sslBasePath=`${process.env.HOME}/.stacks/ssl`;function restoreConsole(){console.log=originalConsoleLog;console.warn=(...args)=>{const msg=args.map(String).join(" ");if(msg.includes("[STX] DOM API violation")||msg.includes("unsafe expression"))return;originalConsoleWarn(...args)}}async function startStxServer(){const{overridesReady}=await import("@stacksjs/config");const{autoImportsAreStale,generateAutoImportFiles,injectGlobalAutoImports}=await import("@stacksjs/server");await overridesReady;await ensureDiscoveredPackages();if(!existsSync(storagePath("framework/auto-imports/models.ts"))||autoImportsAreStale())await generateAutoImportFiles();await injectGlobalAutoImports();const serveSource=resolveStxSource({value:process.env.BUN_PLUGIN_STX_SRC});if(serveSource.kind==="missing"){throw new Error(`BUN_PLUGIN_STX_SRC points at ${serveSource.path}, which does not exist. Unset it to use the installed bun-plugin-stx.`)}let serve;if(serveSource.kind==="override"){serve=(await import(serveSource.path)).serve;console.log(`[Dashboard] bun-plugin-stx from ${serveSource.path}`)}else{serve=(await import("bun-plugin-stx/serve")).serve}const stxSource=resolveStxSource({value:process.env.STX_SRC});if(stxSource.kind==="missing"){throw new Error(`STX_SRC points at ${stxSource.path}, which does not exist. Unset it to use the installed @stacksjs/stx.`)}let stxModule;if(stxSource.kind==="override"){stxModule=await import(stxSource.path);console.log(`[Dashboard] stx from ${stxSource.path}`)}const{listConfigFiles,readConfig,updateConfigKeys}=await import(defaultsPath("resources/functions/dashboard/config-io.ts"));const{disabledFeatureConfigs}=await import("./dashboard-feature-views");async function hiddenConfigs(){const{feature}=await import("@stacksjs/config");return disabledFeatureConfigs(feature)}const localTsChartsRoot=process.env.TS_CHARTS_SRC;const dependencyBundles=new Map;function resolveTsChartsSource(packageName){const candidates=[...localTsChartsRoot?[`${localTsChartsRoot}/packages/${packageName}/src/index.ts`]:[],projectPath(`node_modules/@ts-charts/${packageName}/src/index.ts`)];return candidates.find(existsSync)||null}const tsChartsEntry=[...localTsChartsRoot?[`${localTsChartsRoot}/packages/ts-charts/src/index.ts`]:[],projectPath("node_modules/ts-charts/src/index.ts")].find(existsSync);async function buildDashboardDependency(entrypoint){const cached=dependencyBundles.get(entrypoint);if(cached)return cached;const build=(async()=>{const result=await Bun.build({entrypoints:[entrypoint],target:"browser",format:"esm",minify:true,plugins:[{name:"dashboard-ts-charts-source",setup(builder){builder.onResolve({filter:/^@ts-charts\/[a-z0-9-]+$/},(args)=>{const packageName=args.path.slice("@ts-charts/".length);const source=resolveTsChartsSource(packageName);if(source)return{path:source};return null})}}]});if(!result.success){const errors=result.logs.filter((log)=>log.level==="error").map((log)=>log.message).join(`
|
|
2
|
+
`);throw new Error(errors||`Failed to bundle ${entrypoint}`)}const output=result.outputs.find((file)=>file.path.endsWith(".js"));if(!output)throw new Error(`No JavaScript output produced for ${entrypoint}`);return output.text()})();dependencyBundles.set(entrypoint,build);return build}function browserDependencyRoute(entrypoint){return async()=>{try{return new Response(await buildDashboardDependency(entrypoint),{headers:{"content-type":"text/javascript; charset=utf-8","cache-control":"no-cache"}})}catch(error){dependencyBundles.delete(entrypoint);return new Response(`throw new Error(${JSON.stringify(error.message)})`,{status:500,headers:{"content-type":"text/javascript; charset=utf-8"}})}}}let dashboardIconCss=null;async function buildDashboardIconCss(){const{generateCss}=await import("@stacksjs/stx");const dirs=[dashboardPath,userDashboardPath,dashboardComponentsPath,userDashboardComponentsPath,projectPath("app/Models"),defaultsPath("app/Models"),defaultsPath("functions"),defaultsPath("resources/functions")];const icons=new Set;for(const dir of dirs){if(!existsSync(dir))continue;const glob=new Bun.Glob("**/*.{stx,ts}");for await(const file of glob.scan({cwd:dir,absolute:true})){const text=await Bun.file(file).text();for(const match of text.matchAll(/\bi-[a-z][a-z0-9]*(?:-[a-z0-9]+)+/g))icons.add(match[0])}}if(icons.size===0)return"";return generateCss(`<div class="${[...icons].join(" ")}"></div>`,process.cwd())}const configRoutes={"/__deps/charts.js":browserDependencyRoute(storagePath("framework/core/charts/src/index.ts")),"/__deps/ts-charts.js":browserDependencyRoute(tsChartsEntry||`${localTsChartsRoot}/packages/ts-charts/src/index.ts`),"/__deps/dashboard-icons.css":async()=>{if(!dashboardIconCss)dashboardIconCss=buildDashboardIconCss();return new Response(await dashboardIconCss,{headers:{"content-type":"text/css; charset=utf-8","cache-control":"no-cache"}})},"/api/config/list":async()=>{try{const hidden=await hiddenConfigs();return Response.json({ok:true,files:listConfigFiles().filter((file)=>!hidden.has(file.name.replace(/\.ts$/,"")))})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/read":async(req)=>{try{const url=new URL(req.url);const name=url.searchParams.get("name")||"";if(!/^[\w-]+$/.test(name))return Response.json({ok:false,error:"Invalid config name"},{status:400});if((await hiddenConfigs()).has(name))return Response.json({ok:false,error:"Not found"},{status:404});const result=await readConfig(name);if(!result)return Response.json({ok:false,error:"Not found"},{status:404});return Response.json({ok:true,name,fields:result.fields})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/source":async(req)=>{try{const url=new URL(req.url);const name=url.searchParams.get("name")||"";if(!/^[\w-]+$/.test(name))return Response.json({ok:false,error:"Invalid config name"},{status:400});if((await hiddenConfigs()).has(name))return Response.json({ok:false,error:"Not found"},{status:404});const result=await readConfig(name);if(!result)return Response.json({ok:false,error:"Not found"},{status:404});return new Response(result.source,{headers:{"content-type":"text/plain; charset=utf-8"}})}catch(e){return Response.json({ok:false,error:e?.message},{status:500})}},"/api/config/update":async(req)=>{if(req.method!=="POST")return Response.json({ok:false,error:"Method not allowed"},{status:405});try{await validateDevCsrfRequest(req);const body=await req.json();const file=body.file?.replace(/\.ts$/,"");if(!file||!/^[\w-]+$/.test(file))return Response.json({ok:false,error:"Invalid file"},{status:400});if((await hiddenConfigs()).has(file))return Response.json({ok:false,error:"Not found"},{status:404});const updates=[];if(Array.isArray(body.updates)){for(const u of body.updates){const k=u.key??u.path;if(typeof k==="string")updates.push({key:k,value:u.value})}}else if(body.key){updates.push({key:body.key,value:body.value})}if(updates.length===0)return Response.json({ok:false,error:"No updates supplied"},{status:400});const invalid=updates.find((update)=>!/^[A-Za-z_$][\w$]*$/.test(update.key)||typeof update.value!=="string"&&typeof update.value!=="number"&&typeof update.value!=="boolean"||typeof update.value==="number"&&!Number.isFinite(update.value));if(invalid)return Response.json({ok:false,error:`Invalid value for configuration key "${invalid.key}"`},{status:400});const typedUpdates=updates;try{await updateConfigKeys(file,typedUpdates)}catch(err){const error=err?.message||"Configuration values could not be updated.";const results=typedUpdates.map((update)=>({key:update.key,ok:false,error}));return Response.json({ok:false,file,results,error},{status:422})}const results=typedUpdates.map((update)=>({key:update.key,ok:true,newValue:update.value}));return Response.json({ok:true,file,results})}catch(e){if(e?.status===403)return Response.json({ok:false,error:"Forbidden",message:"CSRF token mismatch"},{status:403});return Response.json({ok:false,error:e?.message},{status:500})}}};const router=await import("@stacksjs/router");await router.loadRoutes(await router.appRouteRegistry());await router.route.register(defaultsPath("routes/dashboard-api.ts"));const stacksRoute=router.route;const{feature}=await import("@stacksjs/config");const{disabledFeatureViews}=await import("./dashboard-feature-views");const serverPromise=serve({root:projectPath("resources"),patterns:[userDashboardPath,dashboardPath],exclude:disabledFeatureViews(dashboardPath,feature),port:dashboardPort,componentsDir:userDashboardComponentsPath,additionalComponentsDirs:[dashboardComponentsPath],fallbackComponentsDir:resolveComponentsLibraryRoot(),layoutsDir:projectPath("resources/views/dashboard/layouts"),fallbackLayoutsDir:defaultsPath("views/dashboard/layouts"),partialsDir:dashboardPath,publicDir:publicPath(),renderCache:true,renderCacheVary:"source",prewarmRenderCache:false,renderCachePersist:true,watchDirs:[projectPath("resources/functions"),defaultsPath("resources/functions"),defaultsPath("functions"),projectPath("config"),storagePath("framework/runtime/dashboard")],quiet:true,routes:configRoutes,onRequest:async(req)=>{const url=new URL(req.url);const pathname=url.pathname;if(shouldDelegateDashboardRequest(pathname,req.method))return stacksRoute.handleRequest(req);return null},onResponse:seedCsrfPageResponse,auth:false,...stxModule&&{stxModule}});serverPromise.catch((err)=>{restoreConsole();console.error(`
|
|
3
3
|
Failed to start dashboard server: ${err?.message||err}
|
|
4
4
|
`);process.exit(1)})}function portAnswers(port,timeoutMs=800){return new Promise((resolve)=>{const socket=connect({port,host:"127.0.0.1"});const finish=(answered)=>{try{socket.destroy()}catch{}resolve(answered)};socket.once("connect",()=>finish(true));socket.once("error",()=>finish(false));setTimeout(()=>finish(false),timeoutMs).unref?.()})}async function registerWithRpxDaemon(domainToServe){const{writeEntry}=await import("@stacksjs/rpx");await writeEntry({id:`${domainToServe}-dashboard`,from:`localhost:${dashboardPort}`,to:domainToServe,cwd:process.cwd(),createdAt:new Date().toISOString(),pid:process.pid},undefined,verbose);return true}async function startReverseProxy(){if(!dashboardDomain)return false;try{let rpx;const loadRpx=async()=>rpx??=await import("@stacksjs/rpx");const strategy=await resolveDashboardProxyStrategy(dashboardDomain,{proxyManagedExternally:Boolean(process.env.STACKS_PROXY_MANAGED),isDaemonRunning:async()=>(await loadRpx()).isDaemonRunning(),httpsPortAnswers:()=>portAnswers(443)});if(strategy==="origin-only")return false;if(strategy==="parent-managed")return true;if(strategy==="daemon-route")return await registerWithRpxDaemon(dashboardDomain);await(await loadRpx()).startProxies({proxies:[{from:`localhost:${dashboardPort}`,to:dashboardDomain,cleanUrls:false}],https:{basePath:sslBasePath,validityDays:825},regenerateUntrustedCerts:false,verbose});return await portAnswers(443)}catch(error){if(verbose)originalConsoleLog(` ${dim(`Proxy: ${error}`)}`);return false}}const[,allDiscoveredModels]=await Promise.all([startStxServer(),discoverProjectModels()]);const{loadDashboardConfig}=await import(defaultsPath("resources/functions/dashboard/toggles.ts"));const{feature:featureEnabled}=await import("@stacksjs/config");const{toggles:dashboardToggles,nav:dashboardNav}=await loadDashboardConfig(projectPath("config/dashboard.ts"),featureEnabled);const{frameworkModelFeature}=await import("@stacksjs/orm");const discoveredModels=modelsWithEnabledFeatures(allDiscoveredModels,frameworkModelFeature,(name)=>featureEnabled(name));const manifestDir=storagePath("framework/runtime/dashboard");const manifestPath=storagePath("framework/runtime/dashboard/.discovered-models.json");mkdirSync(manifestDir,{recursive:true});const{resolveModelSources}=await import("@stacksjs/database/model-sources");const manifestPayload={models:buildManifest(discoveredModels),schemaModels:(resolveModelSources()?.models??[]).map((model)=>model.name),sections:dashboardToggles,nav:dashboardNav};writeFileIfChanged(manifestPath,JSON.stringify(manifestPayload,null,2));const serverReady=await waitForServer(dashboardPort);restoreConsole();const proxyStarted=await startReverseProxy().catch((err)=>{if(verbose)console.warn("[Dashboard] Reverse proxy failed:",err);return false});const dashboardHttpsUrl=dashboardDomain?`https://${dashboardDomain}`:null;const dashboardLocalUrl=`http://localhost:${dashboardPort}`;const initialUrl=dashboardHttpsUrl&&proxyStarted?`${dashboardHttpsUrl}/`:`${dashboardLocalUrl}/`;const elapsedMs=(Bun.nanoseconds()-startTime)/1e6;console.log();console.log(` ${bold(cyan("stacks dashboard"))}`);console.log();if(dashboardHttpsUrl&&proxyStarted){console.log(` ${green("➜")} ${bold("Local")}: ${cyan(dashboardHttpsUrl)}`);console.log(` ${dim("➜")} ${dim("Origin")}: ${dim(dashboardLocalUrl)}`)}else{console.log(` ${green("➜")} ${bold("Local")}: ${cyan(dashboardLocalUrl)}`);if(dashboardHttpsUrl)console.log(` ${dim("➜")} ${dim("Pretty")}: ${dim(`${dashboardHttpsUrl} needs the rpx proxy - run \`buddy dev\``)}`)}console.log(` ${green("➜")} ${bold("Window")}: ${dim("Stacks Dashboard")} ${dim("1400×900")}`);console.log(` ${green("➜")} ${bold("Models")}: ${dim(`${discoveredModels.length} discovered`)}`);if(dashboardPort!==preferredPort){console.log(` ${dim("➜")} ${dim(`Port ${preferredPort} in use, using ${dashboardPort}`)}`)}if(!serverReady){console.log(` ${dim("⚠")} ${dim("Dev server may not be ready yet")}`)}console.log();console.log(` ${dim(`ready in ${elapsedMs.toFixed(0)} ms`)}`);if(verbose){console.log();console.log(` ${dim("➜")} ${dim("URL")}: ${dim(initialUrl)}`);if(dashboardDomain){console.log(` ${dim("➜")} ${dim("SSL")}: ${dim(sslBasePath)}`);console.log(` ${dim("➜")} ${dim("Proxy")}: ${dim(`localhost:${dashboardPort} → ${dashboardDomain}`)}`)}if(bufferedLogs.length>0){console.log();for(const line of bufferedLogs){console.log(` ${dim(line)}`)}}}console.log();let createApp;let resolveCraftBinary;const nativeDisabled=process.env.STACKS_NO_NATIVE==="1";const explicitCraftSdk=process.env.CRAFT_SDK_SRC;if(!nativeDisabled&&explicitCraftSdk){if(!existsSync(explicitCraftSdk))throw new Error(`CRAFT_SDK_SRC not found: ${explicitCraftSdk}`);try{({createApp,resolveCraftBinary}=await import(explicitCraftSdk));if(!createApp||!resolveCraftBinary)throw new Error("CRAFT_SDK_SRC must export createApp and resolveCraftBinary")}catch(error){throw new Error(`Could not load CRAFT_SDK_SRC ${explicitCraftSdk}: ${error instanceof Error?error.message:String(error)}`)}}if(!nativeDisabled&&!explicitCraftSdk){try{({createApp,resolveCraftBinary}=await import("craft-native"))}catch{}}const craftBinaryPath=createApp&&resolveCraftBinary?resolveDashboardCraftExecutable(resolveCraftBinary):undefined;if(createApp&&craftBinaryPath){const userIconPath=projectPath("resources/assets/images/app-icon.png");const defaultIconPath=defaultsPath("resources/assets/images/app-icon.png");const appIconPath=await Bun.file(userIconPath).exists()?userIconPath:await Bun.file(defaultIconPath).exists()?defaultIconPath:undefined;const app=createApp({url:dashboardLocalUrl,quiet:!verbose,craftPath:craftBinaryPath,window:{title:"Stacks Dashboard",width:1400,height:900,titlebarHidden:true,webSidebarMaterial:true,webSidebarWidth:250,...appIconPath&&{icon:appIconPath}}});process.on("SIGINT",()=>{app.close();process.exit(0)});process.on("SIGTERM",()=>{app.close();process.exit(0)});try{await app.show();process.exit(0)}catch(error){const fallbackUrl=dashboardHttpsUrl||dashboardLocalUrl;console.log(` ${dim("Native Craft window failed:")} ${dim(error instanceof Error?error.message:String(error))}`);console.log(` ${dim("Dashboard available at:")} ${cyan(fallbackUrl)}
|
|
5
5
|
`);await new Promise(()=>{})}}else{const nativeMessage=nativeDisabled?"Native window disabled by STACKS_NO_NATIVE=1. Open the URL above in a browser.":"Native window unavailable. Run pantry install craft, set CRAFT_BIN, or open the URL above in a browser.";console.log(` ${dim(nativeMessage)}
|
package/dist/dev/views.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{join}from"node:path";import{config,enterRequestScope,feature,installRequestScope,overridesReady,resolveViewPatterns}from"@stacksjs/config";import{log}from"@stacksjs/logging";import{projectPath,siteConfigPath}from"@stacksjs/path";import{serverRequestBodyOptions}from"@stacksjs/server/request-body";import{seedCsrfPageResponse}from"./csrf";import{resolveDefaultsResources}from"./defaults-resources";import{exitWithParent}from"./exit-with-parent";import{beginRequestCapture,finishRequestCapture}from"@stacksjs/router/request-capture";installRequestScope();exitWithParent();const projectServe=projectPath("serve.ts");try{const file=Bun.file(projectServe);if(await file.exists()){await import(projectServe)}else{await startDefaultServer()}}catch{await startDefaultServer()}async function startDefaultServer(){await overridesReady;const{applyResponseHeaders,applyViewSecurityHeaders,describeApiProxyRules,describeRedirectRules,describeRewriteRules,injectGlobalAutoImports,isApiBoundRequest,loadRouteRedirects,proxyToBackend,resolveApiProxyRules,resolveEmbeddableRules,resolveRedirect,resolveRedirectRules,resolveRewrite,resolveRewriteRules,viewClientAddress}=await import("@stacksjs/server");const{applyRequestLocale}=await import("@stacksjs/i18n");await injectGlobalAutoImports();const{serve}=await import("bun-plugin-stx/serve");const{site:siteConfig,i18n:i18nConfig}=await loadStxSiteConfig();const defaultsResources=resolveDefaultsResources();const userViewsPath="resources/views";const defaultViewsPath=join(defaultsResources,"views");const userComponentsPath=await firstExistingPath(["resources/components","components"])??"resources/components";const userLayoutsPath=await firstExistingPath(["resources/views/layouts","resources/layouts"])??"resources/views/layouts";const defaultLayoutsPath=join(defaultsResources,"layouts");const userPartialsPath=await firstExistingPath(["resources/partials","resources/views/partials","partials","resources/components"]);const preferredPort=Number(process.env.PORT)||3000;const apiPort=Number(process.env.PORT_API)||3008;const docsPort=Number(process.env.PORT_DOCS)||config.ports?.docs||3006;const apiBase=`http://127.0.0.1:${apiPort}`;const docsBase=`http://127.0.0.1:${docsPort}`;const apiProxyRules=resolveApiProxyRules(config.server?.proxy);const redirectRules=resolveRedirectRules({...await loadRouteRedirects(),...config.server?.redirects});const rewriteRules=resolveRewriteRules(config.server?.rewrites);const embeddableRules=resolveEmbeddableRules(config.server?.security?.embeddable);if(apiProxyRules.paths.length>0||apiProxyRules.prefixes.length>1){console.log(` API proxy: ${describeApiProxyRules(apiProxyRules)}`)}if(embeddableRules.paths.length>0||embeddableRules.prefixes.length>0){console.log(` Frameable by other origins: ${[...embeddableRules.paths,...embeddableRules.prefixes].join(" ")}`)}if(redirectRules.size>0){console.log(` Redirects: ${describeRedirectRules(redirectRules)}`)}if(rewriteRules.size>0){console.log(` Rewrites: ${describeRewriteRules(rewriteRules)}`)}const{createSiteSeoHandler,describeSeoAtBoot}=await import("../seo");const seoOptions={root:projectPath(),seo:config.app?.seo,appUrl:config.app?.url};const siteSeo=createSiteSeoHandler({...seoOptions,cacheTtlMs:0});for(const note of await describeSeoAtBoot(seoOptions).catch(()=>[]))log.warn(note);const hasUserDocsView=["docs.stx","docs/index.stx"].some((rel)=>existsSync(projectPath(`${userViewsPath}/${rel}`)));const hasDocsSite=existsSync(projectPath("docs"));const docsProxyEnabled=!hasUserDocsView&&hasDocsSite;const{authCookieName,stxPageAuthMiddleware}=await import("@stacksjs/auth");const{enhanceRequest,loadMiddlewareHandlers,registerPeerSource}=await import("@stacksjs/router");const authCookie=authCookieName();const pageMiddleware=await loadMiddlewareHandlers();const{mountedDefaultRouteBundles}=await import("@stacksjs/router");const viewPatterns=resolveViewPatterns(userViewsPath,defaultViewsPath,config?.ui?.defaultViews,(path)=>existsSync(projectPath(path)),undefined,mountedDefaultRouteBundles(feature));for(const name of viewPatterns.missing)log.warn(`ui.defaultViews lists "${name}", which does not exist under ${defaultViewsPath} - ignoring.`);if(viewPatterns.withheld.length>0)log.debug(`Default views without a mounted route bundle behind them, not served: ${viewPatterns.withheld.join(", ")}`);await serve({...serverRequestBodyOptions(config.server?.maxRequestBodySize),patterns:viewPatterns.patterns,exclude:viewPatterns.exclude,port:preferredPort,componentsDir:userComponentsPath,fallbackComponentsDir:join(defaultsResources,"components"),layoutsDir:userLayoutsPath,...userPartialsPath&&{partialsDir:userPartialsPath},fallbackLayoutsDir:defaultLayoutsPath,fallbackPartialsDir:defaultViewsPath,quiet:true,openPath:process.env.STACKS_DEV_ENTRY_PATH||"/",...i18nConfig&&{i18n:i18nConfig},...siteConfig?.url&&{site:siteConfig},...config.server?.domains&&{domains:config.server.domains},auth:{cookieName:authCookie,redirectTo:"/login"},middleware:{...pageMiddleware,...stxPageAuthMiddleware({cookieName:authCookie,redirectTo:"/login"})},prepareMiddlewareRequest:(request)=>enhanceRequest(request),clientAddress:viewClientAddress,onRequest:async(req,server)=>{beginRequestCapture(req);const snapshot=enterRequestScope(req);registerPeerSource(server);const url=new URL(req.url);const{maintenanceGate}=await import("@stacksjs/server");const gated=await maintenanceGate(req);if(gated)return gated;const redirected=resolveRedirect(url,redirectRules);if(redirected)return redirected;const rewritten=resolveRewrite(url.pathname,rewriteRules);if(rewritten){const target=new URL(`${rewritten}${url.search}`,url.origin);return proxyToBackend(new Request(target,req),apiBase,undefined,req)}const seoFile=await siteSeo(req);if(seoFile)return seoFile;if(existsSync(projectPath("resources/views/blog.stx"))){const{renderBlogFeed}=await import("../blog");const feed=await renderBlogFeed(req);if(feed)return feed}else{const{renderBlog}=await import("../blog");const blogResponse=await renderBlog(req);if(blogResponse)return blogResponse}if(docsProxyEnabled&&(url.pathname==="/docs"||url.pathname.startsWith("/docs/")))return proxyToBackend(req,docsBase,"/docs");if(isApiBoundRequest(req,url.pathname,apiProxyRules))return proxyToBackend(req,apiBase);if(i18nConfig&&req.method==="GET"){const localeSwitch=url.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);if(localeSwitch){const{createLocaleSwitchResponse}=await import("@stacksjs/i18n");return createLocaleSwitchResponse(req,localeSwitch[1],i18nConfig)}}snapshot.locale=await applyRequestLocale(req);if(config.sites?.enabled){const sites=await import("@stacksjs/sites");const resolved=await sites.resolveSiteByHost(sites.requestHost(req.headers,sites.sitesOptions()));sites.setCurrentSite(resolved);snapshot.site=sites.toSiteSnapshot(resolved)}if(config.analytics?.capturePageviews){import("@stacksjs/analytics").then(({recordPageview})=>recordPageview(req)).catch(()=>{})}return null},onResponse:async(req,response)=>{const securityResponse=applyViewSecurityHeaders(req,response,embeddableRules);const secured=applyResponseHeaders(req,securityResponse??response,config.server?.headers)??securityResponse;const baseline=secured??response;let current=baseline;if(current.status===404&&config.sites?.enabled){try{const{cmsNotFoundFallback}=await import("@stacksjs/cms");const cmsResponse=await cmsNotFoundFallback(req);if(cmsResponse)current=cmsResponse}catch(error){log.debug(`CMS fallback skipped: ${error.message}`)}}const seeded=await seedCsrfPageResponse(req,current);finishRequestCapture(req,seeded??current);return seeded??(current===baseline?secured:current)}})}async function firstExistingPath(candidates){const existing=candidates.filter((candidate)=>existsSync(projectPath(candidate)));if(existing.length===0)return null;for(const candidate of existing){if(containsTemplates(projectPath(candidate)))return candidate}return existing[0]}function containsTemplates(dir){try{return[...new Bun.Glob("**/*.stx").scanSync({cwd:dir,onlyFiles:true})].length>0}catch{return false}}function fallbackI18nFromSite(site){const locales=site.i18n.locales;const defaultLocale=site.i18n.defaultLocale??locales[0];return{locales,defaultLocale,labels:site.i18n.labels??Object.fromEntries(locales.map((c)=>[c,c.toUpperCase()])),translations:{},pickerSelector:site.i18n.pickerSelector??"#lang-picker"}}async function resolveSiteI18n(site){try{const{resolveI18n}=await import("@stacksjs/stx");if(typeof resolveI18n==="function"){const i18n=resolveI18n(site,projectPath());if(i18n)return i18n}}catch{}return fallbackI18nFromSite(site)}async function loadStxSiteConfig(){const sitePath=siteConfigPath();if(!existsSync(sitePath))return{};try{const mod=await import(sitePath);const site=mod.default??mod.site??mod.config;if(!site)return{};if(!site.i18n)return{site};const i18n=await resolveSiteI18n(site);return{site,i18n}}catch{}return{}}
|
|
1
|
+
import{existsSync}from"node:fs";import{join}from"node:path";import{config,enterRequestScope,feature,installRequestScope,overridesReady,resolveViewPatterns}from"@stacksjs/config";import{log}from"@stacksjs/logging";import{projectPath,siteConfigPath}from"@stacksjs/path";import{serverRequestBodyOptions}from"@stacksjs/server/request-body";import{seedCsrfPageResponse}from"./csrf";import{resolveDefaultsResources}from"./defaults-resources";import{exitWithParent}from"./exit-with-parent";import{beginRequestCapture,finishRequestCapture}from"@stacksjs/router/request-capture";installRequestScope();exitWithParent();const projectServe=projectPath("serve.ts");try{const file=Bun.file(projectServe);if(await file.exists()){await import(projectServe)}else{await startDefaultServer()}}catch{await startDefaultServer()}async function startDefaultServer(){await overridesReady;const{applyResponseHeaders,applyViewSecurityHeaders,describeApiProxyRules,describeRedirectRules,describeRewriteRules,injectGlobalAutoImports,isApiBoundRequest,loadRouteRedirects,proxyToBackend,resolveApiProxyRules,resolveEmbeddableRules,resolveRedirect,resolveRedirectRules,resolveRewrite,resolveRewriteRules,viewClientAddress}=await import("@stacksjs/server");const{applyRequestLocale}=await import("@stacksjs/i18n");await injectGlobalAutoImports();const{serve}=await import("bun-plugin-stx/serve");const{site:siteConfig,i18n:i18nConfig}=await loadStxSiteConfig();const defaultsResources=resolveDefaultsResources();const userViewsPath="resources/views";const defaultViewsPath=join(defaultsResources,"views");const userComponentsPath=await firstExistingPath(["resources/components","components"])??"resources/components";const userLayoutsPath=await firstExistingPath(["resources/views/layouts","resources/layouts"])??"resources/views/layouts";const defaultLayoutsPath=join(defaultsResources,"layouts");const userPartialsPath=await firstExistingPath(["resources/partials","resources/views/partials","partials","resources/components"]);const preferredPort=Number(process.env.PORT)||3000;const apiPort=Number(process.env.PORT_API)||3008;const docsPort=Number(process.env.PORT_DOCS)||config.ports?.docs||3006;const apiBase=`http://127.0.0.1:${apiPort}`;const docsBase=`http://127.0.0.1:${docsPort}`;const apiProxyRules=resolveApiProxyRules(config.server?.proxy);const redirectRules=resolveRedirectRules({...await loadRouteRedirects(),...config.server?.redirects});const rewriteRules=resolveRewriteRules(config.server?.rewrites);const embeddableRules=resolveEmbeddableRules(config.server?.security?.embeddable);if(apiProxyRules.paths.length>0||apiProxyRules.prefixes.length>1){console.log(` API proxy: ${describeApiProxyRules(apiProxyRules)}`)}if(embeddableRules.paths.length>0||embeddableRules.prefixes.length>0){console.log(` Frameable by other origins: ${[...embeddableRules.paths,...embeddableRules.prefixes].join(" ")}`)}if(redirectRules.size>0){console.log(` Redirects: ${describeRedirectRules(redirectRules)}`)}if(rewriteRules.size>0){console.log(` Rewrites: ${describeRewriteRules(rewriteRules)}`)}const{createSiteSeoHandler,describeSeoAtBoot}=await import("../seo");const seoOptions={root:projectPath(),seo:config.app?.seo,appUrl:config.app?.url};const siteSeo=createSiteSeoHandler({...seoOptions,cacheTtlMs:0});for(const note of await describeSeoAtBoot(seoOptions).catch(()=>[]))log.warn(note);const hasUserDocsView=["docs.stx","docs/index.stx"].some((rel)=>existsSync(projectPath(`${userViewsPath}/${rel}`)));const hasDocsSite=existsSync(projectPath("docs"));const docsProxyEnabled=!hasUserDocsView&&hasDocsSite;const{authCookieName,stxPageAuthMiddleware}=await import("@stacksjs/auth");const{enhanceRequest,loadMiddlewareHandlers,registerPeerSource}=await import("@stacksjs/router");const authCookie=authCookieName();const pageMiddleware=await loadMiddlewareHandlers();const{mountedDefaultRouteBundles}=await import("@stacksjs/router");const viewPatterns=resolveViewPatterns(userViewsPath,defaultViewsPath,config?.ui?.defaultViews,(path)=>existsSync(projectPath(path)),undefined,mountedDefaultRouteBundles(feature));for(const name of viewPatterns.missing)log.warn(`ui.defaultViews lists "${name}", which does not exist under ${defaultViewsPath} - ignoring.`);if(viewPatterns.withheld.length>0)log.debug(`Default views without a mounted route bundle behind them, not served: ${viewPatterns.withheld.join(", ")}`);await serve({...serverRequestBodyOptions(config.server?.maxRequestBodySize),patterns:viewPatterns.patterns,exclude:viewPatterns.exclude,port:preferredPort,componentsDir:userComponentsPath,fallbackComponentsDir:join(defaultsResources,"components"),layoutsDir:userLayoutsPath,...userPartialsPath&&{partialsDir:userPartialsPath},fallbackLayoutsDir:defaultLayoutsPath,fallbackPartialsDir:defaultViewsPath,quiet:true,openPath:process.env.STACKS_DEV_ENTRY_PATH||"/",...i18nConfig&&{i18n:i18nConfig},...siteConfig?.url&&{site:siteConfig},...config.server?.domains&&{domains:config.server.domains},auth:{cookieName:authCookie,redirectTo:"/login"},middleware:{...pageMiddleware,...stxPageAuthMiddleware({cookieName:authCookie,redirectTo:"/login"})},prepareMiddlewareRequest:(request)=>enhanceRequest(request),clientAddress:viewClientAddress,onRequest:async(req,server)=>{beginRequestCapture(req);const snapshot=enterRequestScope(req);registerPeerSource(server);const url=new URL(req.url);const{maintenanceGate}=await import("@stacksjs/server");const gated=await maintenanceGate(req);if(gated)return gated;const redirected=resolveRedirect(url,redirectRules);if(redirected)return redirected;const rewritten=resolveRewrite(url.pathname,rewriteRules);if(rewritten){const target=new URL(`${rewritten}${url.search}`,url.origin);return proxyToBackend(new Request(target,req),apiBase,undefined,req)}const seoFile=await siteSeo(req);if(seoFile)return seoFile;if(existsSync(projectPath("resources/views/blog.stx"))){const{renderBlogFeed}=await import("../blog");const feed=await renderBlogFeed(req);if(feed)return feed}else{const{renderBlog}=await import("../blog");const blogResponse=await renderBlog(req);if(blogResponse)return blogResponse}if(docsProxyEnabled&&(url.pathname==="/docs"||url.pathname.startsWith("/docs/")))return proxyToBackend(req,docsBase,"/docs");if(isApiBoundRequest(req,url.pathname,apiProxyRules))return proxyToBackend(req,apiBase);if(i18nConfig&&req.method==="GET"){const localeSwitch=url.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);if(localeSwitch){const{createLocaleSwitchResponse}=await import("@stacksjs/i18n");return createLocaleSwitchResponse(req,localeSwitch[1],i18nConfig)}}snapshot.locale=await applyRequestLocale(req);if(config.sites?.enabled){const sites=await import("@stacksjs/sites");const resolved=await sites.resolveSiteByHost(sites.requestHost(req.headers,sites.sitesOptions()));sites.setCurrentSite(resolved);snapshot.site=sites.toSiteSnapshot(resolved)}if(config.analytics?.capturePageviews){import("@stacksjs/analytics").then(({recordPageview})=>recordPageview(req)).catch(()=>{})}return null},onResponse:async(req,response)=>{const securityResponse=applyViewSecurityHeaders(req,response,embeddableRules);const secured=applyResponseHeaders(req,securityResponse??response,config.server?.headers)??securityResponse;const baseline=secured??response;let current=baseline;if(current.status===404&&config.sites?.enabled&&feature("cms")){try{const{cmsNotFoundFallback}=await import("@stacksjs/cms");const cmsResponse=await cmsNotFoundFallback(req);if(cmsResponse)current=cmsResponse}catch(error){log.debug(`CMS fallback skipped: ${error.message}`)}}const seeded=await seedCsrfPageResponse(req,current);finishRequestCapture(req,seeded??current);return seeded??(current===baseline?secured:current)}})}async function firstExistingPath(candidates){const existing=candidates.filter((candidate)=>existsSync(projectPath(candidate)));if(existing.length===0)return null;for(const candidate of existing){if(containsTemplates(projectPath(candidate)))return candidate}return existing[0]}function containsTemplates(dir){try{return[...new Bun.Glob("**/*.stx").scanSync({cwd:dir,onlyFiles:true})].length>0}catch{return false}}function fallbackI18nFromSite(site){const locales=site.i18n.locales;const defaultLocale=site.i18n.defaultLocale??locales[0];return{locales,defaultLocale,labels:site.i18n.labels??Object.fromEntries(locales.map((c)=>[c,c.toUpperCase()])),translations:{},pickerSelector:site.i18n.pickerSelector??"#lang-picker"}}async function resolveSiteI18n(site){try{const{resolveI18n}=await import("@stacksjs/stx");if(typeof resolveI18n==="function"){const i18n=resolveI18n(site,projectPath());if(i18n)return i18n}}catch{}return fallbackI18nFromSite(site)}async function loadStxSiteConfig(){const sitePath=siteConfigPath();if(!existsSync(sitePath))return{};try{const mod=await import(sitePath);const site=mod.default??mod.site??mod.config;if(!site)return{};if(!site.i18n)return{site};const i18n=await resolveSiteI18n(site);return{site,i18n}}catch{}return{}}
|
|
@@ -12,7 +12,22 @@ export declare function installedStacksVersion(projectRoot: string): string | nu
|
|
|
12
12
|
export declare function needsFrameworkInstall(projectRoot: string, target: string, runtimePins?: Record<string, string>): boolean;
|
|
13
13
|
/** The plain versions the manifest declares for `names` (direct declarations only). */
|
|
14
14
|
export declare function declaredPins(pkg: PkgJson, names: string[]): Record<string, string>;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Independently versioned frontend packages paired with a published framework:
|
|
17
|
+
* the release the framework was built and tested against.
|
|
18
|
+
*
|
|
19
|
+
* A framework release names that release one of two ways. Exactly
|
|
20
|
+
* (`0.2.807`), as releases did for a while. Or as the floor of a range
|
|
21
|
+
* (`^0.2.842`), so that an app on a newer STX patch installs one copy of STX
|
|
22
|
+
* and not the framework's beside its own (stacksjs/stacks#3260); the release
|
|
23
|
+
* it was tested against is then the floor.
|
|
24
|
+
*
|
|
25
|
+
* A range is only read that way when the runtime, its components and its
|
|
26
|
+
* compiler all name the same floor. Older releases declared loose ranges with
|
|
27
|
+
* a different floor each (`^0.2.408` beside `^0.2.406`), which described no
|
|
28
|
+
* tested release, and taking a pin from one of those would align an app to a
|
|
29
|
+
* version nobody chose.
|
|
30
|
+
*/
|
|
16
31
|
export declare function publishedRuntimePins(dependencies: Record<string, string>): Record<string, string>;
|
|
17
32
|
/** Read the exact STX release's nested runtime pins before changing an app. */
|
|
18
33
|
export declare function resolvePublishedRuntimePins(dependencies: Record<string, string>, read?: typeof fetch): Promise<Record<string, string>>;
|
package/dist/upgrade/packages.js
CHANGED
|
@@ -2,7 +2,7 @@ import{existsSync,lstatSync,readdirSync,readFileSync,writeFileSync}from"node:fs"
|
|
|
2
2
|
Standalone package detected. No Stacks framework source is installed.`);if(options.dryRun){console.log(" --dry-run: would refresh the package dependencies with `bun update`. No files were changed.\n");process.exit(0)}if(options.noPostinstall){console.log(" --no-postinstall: skipping the dependency refresh. Run `bun update` when ready.\n");process.exit(0)}console.log(` Refreshing declared dependencies...
|
|
3
3
|
`);const result=await runCommand(standalonePackageUpdateCommand(),{cwd:projectRoot});if(result.isErr){console.error("\n✗ The dependency refresh failed. Resolve the reported error and re-run `buddy update`.\n");process.exit(1)}console.log(`
|
|
4
4
|
✔ Standalone package dependencies are up to date.
|
|
5
|
-
`);process.exit(0)}export function declaredPins(pkg,names){const declared={...pkg.devDependencies,...pkg.dependencies};const pins={};for(const name of names){const spec=declared[name];if(typeof spec==="string"&&/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(spec))pins[name]=baseVersion(spec)}return pins}async function resolveTarget(options){const res=await fetch("https://registry.npmjs.org/stacks").catch(()=>null);if(!res||!res.ok)throw new Error("Could not reach the npm registry to resolve the target `stacks` version.");const meta=await res.json();const distTags=meta["dist-tags"]??{};const versions=meta.versions??{};let version;if(options.version){if(!versions[options.version])throw new Error(`stacks@${options.version} was not found on the npm registry.`);version=options.version}else{const tag=options.canary?"canary":"latest";const resolved=distTags[tag];if(!resolved)throw new Error(`The \`${tag}\` dist-tag is not published for \`stacks\`.`);version=resolved}const metaDeps=versions[version]?.dependencies??{};const actions=await fetch(`https://registry.npmjs.org/@stacksjs%2factions/${version}`);if(!actions.ok)throw new Error(`Could not resolve the frontend dependencies shipped by @stacksjs/actions@${version}.`);const manifest=await actions.json();if(manifest.version!==version)throw new Error("The published actions manifest does not match the requested framework release.");return{version,metaDeps,runtimePins:await resolvePublishedRuntimePins(manifest.dependencies??{}),craftFloor:craftFloor(manifest)}}
|
|
5
|
+
`);process.exit(0)}export function declaredPins(pkg,names){const declared={...pkg.devDependencies,...pkg.dependencies};const pins={};for(const name of names){const spec=declared[name];if(typeof spec==="string"&&/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(spec))pins[name]=baseVersion(spec)}return pins}async function resolveTarget(options){const res=await fetch("https://registry.npmjs.org/stacks").catch(()=>null);if(!res||!res.ok)throw new Error("Could not reach the npm registry to resolve the target `stacks` version.");const meta=await res.json();const distTags=meta["dist-tags"]??{};const versions=meta.versions??{};let version;if(options.version){if(!versions[options.version])throw new Error(`stacks@${options.version} was not found on the npm registry.`);version=options.version}else{const tag=options.canary?"canary":"latest";const resolved=distTags[tag];if(!resolved)throw new Error(`The \`${tag}\` dist-tag is not published for \`stacks\`.`);version=resolved}const metaDeps=versions[version]?.dependencies??{};const actions=await fetch(`https://registry.npmjs.org/@stacksjs%2factions/${version}`);if(!actions.ok)throw new Error(`Could not resolve the frontend dependencies shipped by @stacksjs/actions@${version}.`);const manifest=await actions.json();if(manifest.version!==version)throw new Error("The published actions manifest does not match the requested framework release.");return{version,metaDeps,runtimePins:await resolvePublishedRuntimePins(manifest.dependencies??{}),craftFloor:craftFloor(manifest)}}const RUNTIME_PACKAGES=["@stacksjs/stx","@stacksjs/components","bun-plugin-stx","@stacksjs/desktop","@stacksjs/sanitizer","stx-router"];const RUNTIME_COHORT=["@stacksjs/stx","@stacksjs/components","bun-plugin-stx"];export function publishedRuntimePins(dependencies){const exact=/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/;const pins={};for(const name of RUNTIME_PACKAGES){const version=dependencies[name];if(version&&exact.test(version))pins[name]=version}const floors=RUNTIME_COHORT.map((name)=>/^\^(\d+\.\d+\.\d+(?:-[\w.-]+)?)$/.exec(dependencies[name]??"")?.[1]);const floor=floors[0];if(floor&&floors.every((candidate)=>candidate===floor)){for(const name of RUNTIME_PACKAGES){if(dependencies[name]===`^${floor}`)pins[name]=floor}}return pins}export async function resolvePublishedRuntimePins(dependencies,read=fetch){const pins=publishedRuntimePins(dependencies);const version=pins["@stacksjs/stx"];if(!version)return pins;const response=await read(`https://registry.npmjs.org/@stacksjs%2fstx/${version}`);if(!response.ok)throw new Error(`Could not resolve the runtime dependencies shipped by @stacksjs/stx@${version}.`);const manifest=await response.json();if(manifest.name!=="@stacksjs/stx"||manifest.version!==version)throw new Error("The published STX manifest does not match the requested runtime release.");for(const[name,target]of Object.entries(publishedRuntimePins(manifest.dependencies??{}))){if(pins[name]&&pins[name]!==target)throw new Error(`The published framework and STX manifests disagree on ${name}.`);pins[name]=target}return pins}export function keepsNewerRelease(spec,target){const declared=baseVersion(spec);const plain=/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/;return plain.test(declared)&&plain.test(target)&&Bun.semver.order(declared,target)>=0&&Bun.semver.satisfies(declared,`^${target}`)}export function applyRuntimePins(pkg,pins,options={}){const changes=[];for(const field of["dependencies","devDependencies","overrides","resolutions"]){const declarations=pkg[field];if(!declarations||typeof declarations!=="object"||Array.isArray(declarations))continue;for(const[name,target]of Object.entries(pins)){const spec=declarations[name];if(typeof spec!=="string"||!/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(spec))continue;if(!options.exact&&keepsNewerRelease(spec,target))continue;const next=`${/^[\^~]/.test(spec)?spec[0]:""}${target}`;if(next===spec)continue;changes.push({name,from:spec,to:next,...field==="overrides"||field==="resolutions"?{field}:{}});declarations[name]=next}}return changes}export function isCraftPackage(name){return name==="craft-native"||/^@craft-native\/[a-z0-9][\w.-]*$/.test(name)}export function craftFloor(manifest){const range=manifest.peerDependencies?.["craft-native"]??manifest.dependencies?.["craft-native"];return range?.match(/^>=\s*(\d+\.\d+\.\d+)$/)?.[1]}export function declaredCraftPackages(pkg){const names=new Set;for(const field of["dependencies","devDependencies","overrides","resolutions"]){const declarations=pkg[field];if(declarations&&typeof declarations==="object"&&!Array.isArray(declarations))Object.keys(declarations).filter(isCraftPackage).forEach((name)=>names.add(name))}return[...names].sort()}export async function resolveCraftPins(pkg,floor,read=fetch){const pins={};if(!floor)return pins;for(const name of declaredCraftPackages(pkg)){const response=await read(`https://registry.npmjs.org/${name.replace("/","%2f")}/${floor}`).catch(()=>null);const manifest=response?.ok?await response.json().catch(()=>null):null;if(manifest?.name===name&&manifest.version===floor)pins[name]=floor;else console.warn(` ${name}@${floor} is not published; leaving ${name} as declared.`)}return pins}export function applyCraftFloor(pkg,pins){const changes=[];for(const field of["dependencies","devDependencies","overrides","resolutions"]){const declarations=pkg[field];if(!declarations||typeof declarations!=="object"||Array.isArray(declarations))continue;for(const[name,floor]of Object.entries(pins)){const spec=declarations[name];const match=typeof spec==="string"?/^(\^|~|>=\s*)?(\d+\.\d+\.\d+(?:-[\w.-]+)?)$/.exec(spec):null;if(!match||Bun.semver.order(match[2],floor)>=0)continue;const next=`${(match[1]??"").replace(/\s+/,"")}${floor}`;changes.push({name,from:spec,to:next,...field==="overrides"||field==="resolutions"?{field}:{}});declarations[name]=next}}return changes}export function lockfileVersion(projectRoot){const path=join(projectRoot,"bun.lock");if(!existsSync(path))return null;const match=/"lockfileVersion"\s*:\s*(\d+)/.exec(readFileSync(path,"utf8"));return match?Number(match[1]):null}export function lockfileOnlyAddCommands(pkg,names){const wanted=new Set(names);const commands=[];for(const[field,flag]of[["dependencies",""],["devDependencies"," --dev"]]){const specs=Object.entries(pkg[field]??{}).filter(([name,spec])=>wanted.has(name)&&/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(spec)&&/^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/.test(name)).map(([name,spec])=>`${name}@${spec}`);if(specs.length)commands.push(`bun add --exact --lockfile-only${flag} ${specs.join(" ")}`)}return commands}export function baseVersion(range){return range.replace(/^[\^~>=<\s]+/,"").trim()}export function isDowngrade(from,to){const before=baseVersion(from);const after=baseVersion(to);const plain=/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/;return plain.test(before)&&plain.test(after)&&Bun.semver.order(after,before)<0}export function lockstepPackages(metaDeps,target){const lockstep=new Set(["stacks"]);for(const[name,range]of Object.entries(metaDeps)){if(name.startsWith("@stacksjs/")&&baseVersion(range)===target)lockstep.add(name)}return lockstep}export function applyBumps(pkg,target,lockstep){const changes=[];for(const field of["dependencies","devDependencies"]){const deps=pkg[field];if(!deps)continue;for(const[name,spec]of Object.entries(deps)){if(!lockstep.has(name))continue;const prefix=/^[\^~]/.test(spec)?spec[0]:/^\d/.test(spec)?"":"^";const next=`${prefix}${target}`;if(spec!==next){changes.push({name,from:spec,to:next});deps[name]=next}}}for(const field of["overrides","resolutions"]){const rules=pkg[field];if(!rules||typeof rules!=="object"||Array.isArray(rules))continue;for(const[name,spec]of Object.entries(rules)){if(!lockstep.has(name)||typeof spec!=="string"||!/^[\^~]?\d/.test(spec))continue;const next=resolveManifestSpec(name,spec,target);if(!next)continue;changes.push({name,from:spec,to:next,field});rules[name]=next}}return changes}export async function upgradeStacksPackages(projectRoot,options){const pkgPath=join(projectRoot,"package.json");if(!existsSync(pkgPath)){console.error("No package.json found - nothing to upgrade.");process.exit(1)}const raw=readFileSync(pkgPath,"utf-8");const pkg=JSON.parse(raw);const current=pkg.dependencies?.stacks??pkg.devDependencies?.stacks;if(!hasStacksDependency(pkg))return updateStandalonePackage(projectRoot,options);const{version:target,metaDeps,runtimePins,craftFloor:floor}=await resolveTarget(options).catch((err)=>{console.error(`✗ ${err.message}`);process.exit(1)});const craftPins=await resolveCraftPins(pkg,floor);console.log(`
|
|
6
6
|
Upgrading the Stacks framework${options.canary?" (canary)":""} → ${target}`);if(current)console.log(` current \`stacks\` constraint: ${current}
|
|
7
7
|
`);const lockstep=lockstepPackages(metaDeps,target);const changes=[...applyBumps(pkg,target,lockstep),...applyRuntimePins(pkg,runtimePins,{exact:options.allowDowngrade}),...applyCraftFloor(pkg,craftPins)];const installedPins=declaredPins(pkg,[...Object.keys(runtimePins),...Object.keys(craftPins)]);const projectManifestChanges=migratePackageProjectManifest(pkg);const manifestContext={lockstep,metaDeps};const manifestChanges=reconcileVendoredManifests(projectRoot,target,{dryRun:true,context:manifestContext});const backwards=(change)=>isDowngrade(change.from,change.to);const forwards=changes.filter((change)=>!backwards(change));const downgrades=[...changes.filter(backwards).map((change)=>({...change,label:change.field?`${change.name} (${change.field})`:change.name,where:""})),...manifestChanges.filter(backwards).map((change)=>({...change,label:change.name,where:` ${change.file}`}))];if(forwards.length>0){console.log(" The following dependencies will be updated:");const reported=forwards.map((change)=>({...change,label:change.field?`${change.name} (${change.field})`:change.name}));const width=Math.max(...reported.map((c)=>c.label.length));for(const c of reported)console.log(` ${c.label.padEnd(width)} ${c.from} → ${c.to}`);console.log("")}const vendoredForwards=manifestChanges.filter((change)=>!backwards(change));if(vendoredForwards.length>0){console.log(` Vendored manifests under storage/framework (${vendoredForwards.length}):`);const width=Math.max(...vendoredForwards.map((c)=>c.name.length));for(const c of vendoredForwards)console.log(` ${c.name.padEnd(width)} ${c.from} → ${c.to} ${c.file}`);console.log("")}if(downgrades.length>0){const verb=options.allowDowngrade?"will be downgraded":"would be downgraded";console.log(` The following dependencies ${verb}, because stacks@${target} declares older versions than this app does:`);const width=Math.max(...downgrades.map((c)=>c.label.length));for(const c of downgrades)console.log(` ${c.label.padEnd(width)} ${c.from} → ${c.to} (downgrade)${c.where}`);console.log("");if(!options.allowDowngrade){const advice=options.version?[` --version ${target} asks for an older release than this app declares. Re-run with --allow-downgrade to confirm it.
|
|
8
8
|
`]:[` Wait for a framework release that declares these versions or newer, or re-run with --allow-downgrade to accept them.`,` Checking for one: \`npm view stacks versions\`, then \`buddy upgrade --version <version> --dry-run\`.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.542",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -66,59 +66,59 @@
|
|
|
66
66
|
"prepublishOnly": "bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stacksjs/action-runner": "0.75.
|
|
70
|
-
"@stacksjs/ai": "0.75.
|
|
71
|
-
"@stacksjs/analytics": "0.75.
|
|
72
|
-
"@stacksjs/api": "0.75.
|
|
73
|
-
"@stacksjs/auth": "0.75.
|
|
74
|
-
"@stacksjs/build": "0.75.
|
|
69
|
+
"@stacksjs/action-runner": "0.75.542",
|
|
70
|
+
"@stacksjs/ai": "0.75.542",
|
|
71
|
+
"@stacksjs/analytics": "0.75.542",
|
|
72
|
+
"@stacksjs/api": "0.75.542",
|
|
73
|
+
"@stacksjs/auth": "0.75.542",
|
|
74
|
+
"@stacksjs/build": "0.75.542",
|
|
75
75
|
"@stacksjs/bumpx": "^0.2.26",
|
|
76
76
|
"@stacksjs/bunpress": "^0.2.15",
|
|
77
|
-
"@stacksjs/cli": "0.75.
|
|
78
|
-
"@stacksjs/cloud": "0.75.
|
|
79
|
-
"@stacksjs/cms": "0.75.
|
|
80
|
-
"@stacksjs/components": "0.2.842",
|
|
81
|
-
"@stacksjs/config": "0.75.
|
|
82
|
-
"@stacksjs/database": "0.75.
|
|
83
|
-
"@stacksjs/desktop-build": "0.75.
|
|
84
|
-
"@stacksjs/dns": "0.75.
|
|
85
|
-
"@stacksjs/docs": "0.75.
|
|
86
|
-
"@stacksjs/enums": "0.75.
|
|
87
|
-
"@stacksjs/env": "0.75.
|
|
88
|
-
"@stacksjs/error-handling": "0.75.
|
|
89
|
-
"@stacksjs/github": "0.75.
|
|
77
|
+
"@stacksjs/cli": "0.75.542",
|
|
78
|
+
"@stacksjs/cloud": "0.75.542",
|
|
79
|
+
"@stacksjs/cms": "0.75.542",
|
|
80
|
+
"@stacksjs/components": "^0.2.842",
|
|
81
|
+
"@stacksjs/config": "0.75.542",
|
|
82
|
+
"@stacksjs/database": "0.75.542",
|
|
83
|
+
"@stacksjs/desktop-build": "0.75.542",
|
|
84
|
+
"@stacksjs/dns": "0.75.542",
|
|
85
|
+
"@stacksjs/docs": "0.75.542",
|
|
86
|
+
"@stacksjs/enums": "0.75.542",
|
|
87
|
+
"@stacksjs/env": "0.75.542",
|
|
88
|
+
"@stacksjs/error-handling": "0.75.542",
|
|
89
|
+
"@stacksjs/github": "0.75.542",
|
|
90
90
|
"@stacksjs/gitit": "^0.2.5",
|
|
91
|
-
"@stacksjs/i18n": "0.75.
|
|
92
|
-
"@stacksjs/image": "0.75.
|
|
93
|
-
"@stacksjs/logging": "0.75.
|
|
91
|
+
"@stacksjs/i18n": "0.75.542",
|
|
92
|
+
"@stacksjs/image": "0.75.542",
|
|
93
|
+
"@stacksjs/logging": "0.75.542",
|
|
94
94
|
"@stacksjs/logsmith": "^0.2.11",
|
|
95
|
-
"@stacksjs/mobile": "0.75.
|
|
96
|
-
"@stacksjs/orm": "0.75.
|
|
97
|
-
"@stacksjs/path": "0.75.
|
|
98
|
-
"@stacksjs/payments": "0.75.
|
|
99
|
-
"@stacksjs/queue": "0.75.
|
|
100
|
-
"@stacksjs/registry": "0.75.
|
|
101
|
-
"@stacksjs/router": "0.75.
|
|
95
|
+
"@stacksjs/mobile": "0.75.542",
|
|
96
|
+
"@stacksjs/orm": "0.75.542",
|
|
97
|
+
"@stacksjs/path": "0.75.542",
|
|
98
|
+
"@stacksjs/payments": "0.75.542",
|
|
99
|
+
"@stacksjs/queue": "0.75.542",
|
|
100
|
+
"@stacksjs/registry": "0.75.542",
|
|
101
|
+
"@stacksjs/router": "0.75.542",
|
|
102
102
|
"@stacksjs/rpx": "^0.11.54",
|
|
103
|
-
"@stacksjs/scheduler": "0.75.
|
|
104
|
-
"@stacksjs/search-engine": "0.75.
|
|
105
|
-
"@stacksjs/security": "0.75.
|
|
106
|
-
"@stacksjs/server": "0.75.
|
|
107
|
-
"@stacksjs/sites": "0.75.
|
|
108
|
-
"@stacksjs/storage": "0.75.
|
|
109
|
-
"@stacksjs/strings": "0.75.
|
|
110
|
-
"@stacksjs/stx": "0.2.842",
|
|
103
|
+
"@stacksjs/scheduler": "0.75.542",
|
|
104
|
+
"@stacksjs/search-engine": "0.75.542",
|
|
105
|
+
"@stacksjs/security": "0.75.542",
|
|
106
|
+
"@stacksjs/server": "0.75.542",
|
|
107
|
+
"@stacksjs/sites": "0.75.542",
|
|
108
|
+
"@stacksjs/storage": "0.75.542",
|
|
109
|
+
"@stacksjs/strings": "0.75.542",
|
|
110
|
+
"@stacksjs/stx": "^0.2.842",
|
|
111
111
|
"@stacksjs/tlsx": "^0.13.19",
|
|
112
112
|
"@stacksjs/ts-cloud": "^0.16.109",
|
|
113
113
|
"@stacksjs/ts-md": "^0.1.1",
|
|
114
|
-
"@stacksjs/tunnel": "0.75.
|
|
115
|
-
"@stacksjs/types": "0.75.
|
|
116
|
-
"@stacksjs/utils": "0.75.
|
|
117
|
-
"@stacksjs/whois": "0.75.
|
|
118
|
-
"bun-plugin-stx": "0.2.842"
|
|
114
|
+
"@stacksjs/tunnel": "0.75.542",
|
|
115
|
+
"@stacksjs/types": "0.75.542",
|
|
116
|
+
"@stacksjs/utils": "0.75.542",
|
|
117
|
+
"@stacksjs/whois": "0.75.542",
|
|
118
|
+
"bun-plugin-stx": "^0.2.842"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
|
-
"craft-native": ">=0.0.
|
|
121
|
+
"craft-native": ">=0.0.497",
|
|
122
122
|
"pickier": "^0.1.75"
|
|
123
123
|
},
|
|
124
124
|
"peerDependenciesMeta": {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
133
|
-
"@stacksjs/validation": "0.75.
|
|
133
|
+
"@stacksjs/validation": "0.75.542",
|
|
134
134
|
"better-dx": "^0.2.24"
|
|
135
135
|
}
|
|
136
136
|
}
|