@stacksjs/actions 0.74.64 → 0.74.65
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/blog.js +2 -2
- package/package.json +42 -42
package/dist/blog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync,mkdirSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{join}from"node:path";const CONTENT_DIR=join(process.cwd(),"content/blog"),THEME_FILE=join(CONTENT_DIR,".theme.css"),
|
|
1
|
+
import{existsSync,mkdirSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{join}from"node:path";const CONTENT_DIR=join(process.cwd(),"content/blog"),THEME_FILE=join(CONTENT_DIR,".theme.css");function blogDefaults(){const appName=(process.env.APP_NAME||"").trim(),appUrl=(process.env.APP_URL||"").trim().replace(/\/+$/,""),title=appName?`${appName} Blog`:"Blog";return{title,description:"",siteTitle:title,author:appName,url:appUrl&&!/^https?:\/\//.test(appUrl)?`https://${appUrl}`:appUrl,nav:[{text:"Home",link:"/"},{text:"Blog",link:"/blog"}],themes:["colored","light","dark"],defaultTheme:"colored",colophon:'<a href="/blog/feed.xml">RSS</a>',emptyTitle:"No posts yet",emptyText:"The first one is in the works. Leave your email and it will land in your inbox the moment it ships."}}let sitePromise=null;function site(){if(!sitePromise)sitePromise=(async()=>{try{const cfg=(await import(join(process.cwd(),"config/blog.ts"))).default??{},merged={...blogDefaults(),...cfg};if(!cfg.siteTitle&&cfg.title)merged.siteTitle=cfg.title;return merged}catch{return blogDefaults()}})();return sitePromise}let bunpressPromise=null;async function loadBunPress(){if(!bunpressPromise)bunpressPromise=(async()=>{const candidates=[join(homedir(),"Code/Tools/bunpress/packages/bunpress/dist/src/index.js"),join(process.cwd(),"pantry/@stacksjs/bunpress/dist/src/index.js")].filter((entry)=>existsSync(entry));try{candidates.push(Bun.resolveSync("@stacksjs/bunpress",import.meta.dir))}catch{}for(const entry of new Set(candidates))try{return await import(entry)}catch(cause){const detail=cause instanceof Error?cause.message:String(cause);throw Error(`[blog] Failed to import BunPress from ${entry}: ${detail}`,{cause})}return null})();return bunpressPromise}function escapeHtml(s){return String(s).replace(/[&<>"]/g,(c)=>({"&":"&","<":"<",">":">",'"':"""})[c])}function escapeXml(s){return String(s).replace(/[&<>"']/g,(c)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[c])}export function usableOrigin(value){if(!value)return"";try{const url=new URL(/^https?:\/\//.test(value)?value:`https://${value}`);if(url.protocol!=="http:"&&url.protocol!=="https:")return"";if(!url.hostname.includes(".")||!/^[a-z0-9.-]+$/i.test(url.hostname))return"";return url.origin}catch{return""}}function postUrl(baseUrl,slug){return`${baseUrl.replace(/\/$/,"")}/blog/${slug}`}function rssDate(date){if(!date)return"";const parsed=new Date(date);return Number.isNaN(parsed.getTime())?date:parsed.toUTCString()}async function fallbackFeedXml(baseUrl){const cfg=await site(),origin=usableOrigin(baseUrl)||usableOrigin(cfg.url)||cfg.url,items=listPosts().slice(0,50).map((p)=>{const url=postUrl(origin,p.slug);return` <item>
|
|
2
2
|
<title>${escapeXml(p.fm.title||p.slug)}</title>
|
|
3
3
|
<link>${escapeXml(url)}</link>
|
|
4
4
|
<guid>${escapeXml(url)}</guid>
|
|
@@ -19,7 +19,7 @@ ${items}
|
|
|
19
19
|
${[`${origin}/blog`,...listPosts().map((p)=>postUrl(origin,p.slug))].map((url)=>` <url><loc>${escapeXml(url)}</loc></url>`).join(`
|
|
20
20
|
`)}
|
|
21
21
|
</urlset>`}function parseFrontmatter(md){const m=md.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!m)return{data:{},body:md};const data={},frontmatter=m[1]??"";for(const line of frontmatter.split(`
|
|
22
|
-
`)){const i=line.indexOf(":");if(i===-1)continue;const key=line.slice(0,i).trim();let val=line.slice(i+1).trim();if(val.startsWith('"')&&val.endsWith('"')||val.startsWith("'")&&val.endsWith("'"))val=val.slice(1,-1);data[key]=val}return{data,body:m[2]??""}}function formatDate(d){if(!d)return"";const date=new Date(d);if(Number.isNaN(date.getTime()))return d;return`${["January","February","March","April","May","June","July","August","September","October","November","December"][date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}`}const THEME_BUTTONS={colored:{label:"Glacier theme",glyph:"\uD83C\uDF32"},light:{label:"Light theme",glyph:"\u2600"},dark:{label:"Dark theme",glyph:"\uD83C\uDF19"}};async function blogChrome(){const cfg=await site(),modes=cfg.themes.length?cfg.themes:
|
|
22
|
+
`)){const i=line.indexOf(":");if(i===-1)continue;const key=line.slice(0,i).trim();let val=line.slice(i+1).trim();if(val.startsWith('"')&&val.endsWith('"')||val.startsWith("'")&&val.endsWith("'"))val=val.slice(1,-1);data[key]=val}return{data,body:m[2]??""}}function formatDate(d){if(!d)return"";const date=new Date(d);if(Number.isNaN(date.getTime()))return d;return`${["January","February","March","April","May","June","July","August","September","October","November","December"][date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}`}const THEME_BUTTONS={colored:{label:"Glacier theme",glyph:"\uD83C\uDF32"},light:{label:"Light theme",glyph:"\u2600"},dark:{label:"Dark theme",glyph:"\uD83C\uDF19"}};async function blogChrome(){const cfg=await site(),modes=cfg.themes.length?cfg.themes:blogDefaults().themes,fallback=modes.includes(cfg.defaultTheme)?cfg.defaultTheme:modes[0],buttons=modes.map((m)=>`<button type="button" data-t="${m}" title="${THEME_BUTTONS[m].label}" aria-label="${THEME_BUTTONS[m].label}" onclick="stxBlogTheme('${m}')">${THEME_BUTTONS[m].glyph}</button>`).join(`
|
|
23
23
|
`),toggle=modes.length>1?`<div class="blog-theme-toggle" role="group" aria-label="Theme">
|
|
24
24
|
${buttons}
|
|
25
25
|
</div>`:"";return`<script>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.65",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -60,53 +60,53 @@
|
|
|
60
60
|
"prepublishOnly": "bun run build"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@stacksjs/action-runner": "0.74.
|
|
64
|
-
"@stacksjs/ai": "0.74.
|
|
65
|
-
"@stacksjs/analytics": "0.74.
|
|
66
|
-
"@stacksjs/api": "0.74.
|
|
67
|
-
"@stacksjs/auth": "0.74.
|
|
68
|
-
"@stacksjs/build": "0.74.
|
|
63
|
+
"@stacksjs/action-runner": "0.74.65",
|
|
64
|
+
"@stacksjs/ai": "0.74.65",
|
|
65
|
+
"@stacksjs/analytics": "0.74.65",
|
|
66
|
+
"@stacksjs/api": "0.74.65",
|
|
67
|
+
"@stacksjs/auth": "0.74.65",
|
|
68
|
+
"@stacksjs/build": "0.74.65",
|
|
69
69
|
"@stacksjs/bumpx": "^0.2.6",
|
|
70
70
|
"@stacksjs/bunpress": "^0.2.8",
|
|
71
|
-
"@stacksjs/cli": "0.74.
|
|
72
|
-
"@stacksjs/cloud": "0.74.
|
|
73
|
-
"@stacksjs/cms": "0.74.
|
|
74
|
-
"@stacksjs/components": "^0.2.
|
|
75
|
-
"@stacksjs/config": "0.74.
|
|
76
|
-
"@stacksjs/database": "0.74.
|
|
77
|
-
"@stacksjs/desktop-build": "0.74.
|
|
78
|
-
"@stacksjs/dns": "0.74.
|
|
79
|
-
"@stacksjs/enums": "0.74.
|
|
80
|
-
"@stacksjs/env": "0.74.
|
|
81
|
-
"@stacksjs/error-handling": "0.74.
|
|
71
|
+
"@stacksjs/cli": "0.74.65",
|
|
72
|
+
"@stacksjs/cloud": "0.74.65",
|
|
73
|
+
"@stacksjs/cms": "0.74.65",
|
|
74
|
+
"@stacksjs/components": "^0.2.306",
|
|
75
|
+
"@stacksjs/config": "0.74.65",
|
|
76
|
+
"@stacksjs/database": "0.74.65",
|
|
77
|
+
"@stacksjs/desktop-build": "0.74.65",
|
|
78
|
+
"@stacksjs/dns": "0.74.65",
|
|
79
|
+
"@stacksjs/enums": "0.74.65",
|
|
80
|
+
"@stacksjs/env": "0.74.65",
|
|
81
|
+
"@stacksjs/error-handling": "0.74.65",
|
|
82
82
|
"@stacksjs/gitit": "^0.2.5",
|
|
83
|
-
"@stacksjs/i18n": "0.74.
|
|
84
|
-
"@stacksjs/image": "0.74.
|
|
85
|
-
"@stacksjs/logging": "0.74.
|
|
83
|
+
"@stacksjs/i18n": "0.74.65",
|
|
84
|
+
"@stacksjs/image": "0.74.65",
|
|
85
|
+
"@stacksjs/logging": "0.74.65",
|
|
86
86
|
"@stacksjs/logsmith": "^0.2.3",
|
|
87
|
-
"@stacksjs/orm": "0.74.
|
|
88
|
-
"@stacksjs/path": "0.74.
|
|
89
|
-
"@stacksjs/payments": "0.74.
|
|
90
|
-
"@stacksjs/queue": "0.74.
|
|
91
|
-
"@stacksjs/registry": "0.74.
|
|
92
|
-
"@stacksjs/router": "0.74.
|
|
87
|
+
"@stacksjs/orm": "0.74.65",
|
|
88
|
+
"@stacksjs/path": "0.74.65",
|
|
89
|
+
"@stacksjs/payments": "0.74.65",
|
|
90
|
+
"@stacksjs/queue": "0.74.65",
|
|
91
|
+
"@stacksjs/registry": "0.74.65",
|
|
92
|
+
"@stacksjs/router": "0.74.65",
|
|
93
93
|
"@stacksjs/rpx": "^0.11.54",
|
|
94
|
-
"@stacksjs/scheduler": "0.74.
|
|
95
|
-
"@stacksjs/search-engine": "0.74.
|
|
96
|
-
"@stacksjs/security": "0.74.
|
|
97
|
-
"@stacksjs/server": "0.74.
|
|
98
|
-
"@stacksjs/sites": "0.74.
|
|
99
|
-
"@stacksjs/storage": "0.74.
|
|
100
|
-
"@stacksjs/strings": "0.74.
|
|
101
|
-
"@stacksjs/stx": "^0.2.
|
|
94
|
+
"@stacksjs/scheduler": "0.74.65",
|
|
95
|
+
"@stacksjs/search-engine": "0.74.65",
|
|
96
|
+
"@stacksjs/security": "0.74.65",
|
|
97
|
+
"@stacksjs/server": "0.74.65",
|
|
98
|
+
"@stacksjs/sites": "0.74.65",
|
|
99
|
+
"@stacksjs/storage": "0.74.65",
|
|
100
|
+
"@stacksjs/strings": "0.74.65",
|
|
101
|
+
"@stacksjs/stx": "^0.2.306",
|
|
102
102
|
"@stacksjs/tlsx": "^0.13.19",
|
|
103
|
-
"@stacksjs/ts-cloud": "^0.16.
|
|
103
|
+
"@stacksjs/ts-cloud": "^0.16.11",
|
|
104
104
|
"@stacksjs/ts-md": "^0.1.1",
|
|
105
|
-
"@stacksjs/tunnel": "0.74.
|
|
106
|
-
"@stacksjs/types": "0.74.
|
|
107
|
-
"@stacksjs/utils": "0.74.
|
|
108
|
-
"@stacksjs/whois": "0.74.
|
|
109
|
-
"bun-plugin-stx": "^0.2.
|
|
105
|
+
"@stacksjs/tunnel": "0.74.65",
|
|
106
|
+
"@stacksjs/types": "0.74.65",
|
|
107
|
+
"@stacksjs/utils": "0.74.65",
|
|
108
|
+
"@stacksjs/whois": "0.74.65",
|
|
109
|
+
"bun-plugin-stx": "^0.2.306"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"craft-native": ">=0.0.72",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@stacksjs/validation": "0.74.
|
|
124
|
+
"@stacksjs/validation": "0.74.65",
|
|
125
125
|
"better-dx": "^0.2.24"
|
|
126
126
|
}
|
|
127
127
|
}
|