@stacksjs/stx 0.2.26 → 0.2.29
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/cli.js +571 -564
- package/dist/index.d.ts +17 -0
- package/dist/index.js +550 -543
- package/dist/site-builder/build.d.ts +18 -0
- package/dist/site-builder/index.d.ts +13 -0
- package/dist/site-builder/robots.d.ts +2 -0
- package/dist/site-builder/router.d.ts +10 -0
- package/dist/site-builder/seo.d.ts +8 -0
- package/dist/site-builder/sitemap.d.ts +10 -0
- package/dist/site-builder/types.d.ts +54 -0
- package/package.json +5 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BuildOptions, SiteConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Build a static stx site end-to-end:
|
|
4
|
+
* 1. Bundle all pages with bun-plugin-stx
|
|
5
|
+
* 2. Inject Crosswind CSS into each HTML file
|
|
6
|
+
* 3. Replace stx default SEO tags with site-specific ones
|
|
7
|
+
* 4. Drop the empty bundle chunks bun-plugin-stx leaves behind
|
|
8
|
+
* 5. Copy public/ assets verbatim
|
|
9
|
+
* 6. Synthesize 404.html (uses pages/404.stx if present, else clones index)
|
|
10
|
+
* 7. Generate sitemap.xml and robots.txt
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildStaticSite(options: BuildOptions): Promise<BuildResult>;
|
|
13
|
+
export declare function defineSiteConfig<T extends SiteConfig>(config: T): T;
|
|
14
|
+
export declare interface BuildResult {
|
|
15
|
+
outDir: string
|
|
16
|
+
pages: string[]
|
|
17
|
+
durationMs: number
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
BuildOptions,
|
|
3
|
+
PageMeta,
|
|
4
|
+
SiteConfig,
|
|
5
|
+
SiteRouterOptions,
|
|
6
|
+
SiteSeo,
|
|
7
|
+
SiteSocial,
|
|
8
|
+
} from './types';
|
|
9
|
+
export { buildStaticSite, defineSiteConfig, type BuildResult } from './build';
|
|
10
|
+
export { injectSeo } from './seo';
|
|
11
|
+
export { generateSitemap, type SitemapEntry } from './sitemap';
|
|
12
|
+
export { generateRobots } from './robots';
|
|
13
|
+
export { injectRouterScript, type RouterOptions } from './router';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SiteRouterOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Inject the stx SPA router into HTML. The script is appended just
|
|
4
|
+
* before `</body>` (or at the end of the document if there is no body
|
|
5
|
+
* close). Configuration from `options` is exposed as
|
|
6
|
+
* `window.__stxRouterConfig` ahead of the runtime so the runtime picks
|
|
7
|
+
* it up on init.
|
|
8
|
+
*/
|
|
9
|
+
export declare function injectRouterScript(html: string, options?: RouterOptions): string;
|
|
10
|
+
export type RouterOptions = SiteRouterOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PageMeta, SiteConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Replace stx's auto-injected default SEO block (which says "stx Project")
|
|
4
|
+
* with site-specific tags. Looks for the marker comment stx inserts and
|
|
5
|
+
* swaps the wrapped meta tags. If the block isn't found, prepends the
|
|
6
|
+
* tags after <head>.
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectSeo(html: string, site: SiteConfig, page?: PageMeta, pagePath?: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PageMeta, SiteConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate sitemap.xml content from a list of built pages.
|
|
4
|
+
* Pages with `sitemap: false` in their config are excluded.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateSitemap(site: SiteConfig, entries: SitemapEntry[]): string;
|
|
7
|
+
export declare interface SitemapEntry {
|
|
8
|
+
path: string
|
|
9
|
+
page?: PageMeta
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare interface SiteSeo {
|
|
2
|
+
title?: string
|
|
3
|
+
description?: string
|
|
4
|
+
siteName?: string
|
|
5
|
+
image?: string
|
|
6
|
+
twitter?: string
|
|
7
|
+
locale?: string
|
|
8
|
+
type?: string
|
|
9
|
+
favicon?: string
|
|
10
|
+
}
|
|
11
|
+
export declare interface SiteSocial {
|
|
12
|
+
twitter?: string
|
|
13
|
+
instagram?: string
|
|
14
|
+
youtube?: string
|
|
15
|
+
github?: string
|
|
16
|
+
linkedin?: string
|
|
17
|
+
[k: string]: string | undefined
|
|
18
|
+
}
|
|
19
|
+
export declare interface SiteConfig {
|
|
20
|
+
name: string
|
|
21
|
+
url: string
|
|
22
|
+
description?: string
|
|
23
|
+
social?: SiteSocial
|
|
24
|
+
seo?: SiteSeo
|
|
25
|
+
pagesDir?: string
|
|
26
|
+
publicDir?: string
|
|
27
|
+
outDir?: string
|
|
28
|
+
sitemap?: boolean
|
|
29
|
+
robots?: boolean | 'allow' | 'disallow' | string
|
|
30
|
+
pages?: Record<string, PageMeta>
|
|
31
|
+
spa?: boolean
|
|
32
|
+
router?: SiteRouterOptions
|
|
33
|
+
}
|
|
34
|
+
export declare interface PageMeta {
|
|
35
|
+
title?: string
|
|
36
|
+
description?: string
|
|
37
|
+
image?: string
|
|
38
|
+
sitemap?: boolean
|
|
39
|
+
priority?: number
|
|
40
|
+
changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'
|
|
41
|
+
}
|
|
42
|
+
export declare interface BuildOptions extends SiteConfig {
|
|
43
|
+
noClean?: boolean
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* SPA router options (subset — see RouterOptions in router.ts).
|
|
47
|
+
* Inlined to avoid a circular import in this types file.
|
|
48
|
+
*/
|
|
49
|
+
export declare interface SiteRouterOptions {
|
|
50
|
+
color?: string
|
|
51
|
+
progress?: boolean
|
|
52
|
+
prefetch?: boolean
|
|
53
|
+
cache?: boolean
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.29",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -116,12 +116,12 @@
|
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"@cwcss/crosswind": "^0.2.0",
|
|
118
118
|
"@stacksjs/clapp": "^0.2.0",
|
|
119
|
-
"@stacksjs/desktop": "0.2.
|
|
120
|
-
"@stacksjs/sanitizer": "0.2.
|
|
119
|
+
"@stacksjs/desktop": "0.2.27",
|
|
120
|
+
"@stacksjs/sanitizer": "0.2.27",
|
|
121
121
|
"@stacksjs/ts-craft": "^0.0.2",
|
|
122
|
-
"bun-plugin-stx": "0.2.
|
|
122
|
+
"bun-plugin-stx": "0.2.29",
|
|
123
123
|
"bunfig": "^0.15.6",
|
|
124
|
-
"stx-router": "0.2.
|
|
124
|
+
"stx-router": "0.2.27",
|
|
125
125
|
"ts-broadcasting": "^0.0.4",
|
|
126
126
|
"ts-syntax-highlighter": "^0.2.1"
|
|
127
127
|
}
|