ssqch 0.5.2 → 0.6.1

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/lib/assets.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/assets is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/assets only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
@@ -0,0 +1,3 @@
1
+ // ssqch/elements is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/elements only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/image.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/image is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/image only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/links.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/links is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/links only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/minify.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/minify is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/minify only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
@@ -0,0 +1,3 @@
1
+ // ssqch/redirects is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/redirects only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/rss.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/rss is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/rss only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/sass.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/sass is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/sass only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/lib/sitemap.js ADDED
@@ -0,0 +1,3 @@
1
+ // ssqch/sitemap is built into the ssqch binary, which runs ssqch.config.js and data files itself.
2
+ // This file is here so editors and linters can find the module (its types are in ../types).
3
+ throw new Error("ssqch/sitemap only works in files ssqch runs (ssqch.config.js, data files): build with ssqch, not node");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ssqch",
3
3
  "description": "SiteSquatch, a fast static site generator configured with JavaScript",
4
- "version": "0.5.2",
4
+ "version": "0.6.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/reverentgeek/sitesquatch#readme",
7
7
  "repository": {
@@ -20,17 +20,63 @@
20
20
  "bin": {
21
21
  "ssqch": "bin/ssqch.js"
22
22
  },
23
+ "types": "./types/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./types/index.d.ts",
27
+ "default": "./lib/index.js"
28
+ },
29
+ "./image": {
30
+ "types": "./types/image.d.ts",
31
+ "default": "./lib/image.js"
32
+ },
33
+ "./rss": {
34
+ "types": "./types/rss.d.ts",
35
+ "default": "./lib/rss.js"
36
+ },
37
+ "./minify": {
38
+ "types": "./types/minify.d.ts",
39
+ "default": "./lib/minify.js"
40
+ },
41
+ "./assets": {
42
+ "types": "./types/assets.d.ts",
43
+ "default": "./lib/assets.js"
44
+ },
45
+ "./links": {
46
+ "types": "./types/links.d.ts",
47
+ "default": "./lib/links.js"
48
+ },
49
+ "./sitemap": {
50
+ "types": "./types/sitemap.d.ts",
51
+ "default": "./lib/sitemap.js"
52
+ },
53
+ "./elements": {
54
+ "types": "./types/elements.d.ts",
55
+ "default": "./lib/elements.js"
56
+ },
57
+ "./redirects": {
58
+ "types": "./types/redirects.d.ts",
59
+ "default": "./lib/redirects.js"
60
+ },
61
+ "./sass": {
62
+ "types": "./types/sass.d.ts",
63
+ "default": "./lib/sass.js"
64
+ },
65
+ "./package.json": "./package.json"
66
+ },
23
67
  "files": [
24
68
  "bin",
69
+ "lib",
70
+ "types",
25
71
  "platforms.json"
26
72
  ],
27
73
  "engines": {
28
74
  "node": ">=18"
29
75
  },
30
76
  "optionalDependencies": {
31
- "@ssqch/darwin-arm64": "0.5.2",
32
- "@ssqch/darwin-x64": "0.5.2",
33
- "@ssqch/linux-x64": "0.5.2",
34
- "@ssqch/win32-x64": "0.5.2"
77
+ "@ssqch/darwin-arm64": "0.6.1",
78
+ "@ssqch/darwin-x64": "0.6.1",
79
+ "@ssqch/linux-x64": "0.6.1",
80
+ "@ssqch/win32-x64": "0.6.1"
35
81
  }
36
82
  }
@@ -0,0 +1,15 @@
1
+ // ssqch/assets: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface AssetsPluginOptions {
6
+ /** URL paths of files in the output to fingerprint, like `["/assets/index.css"]`. */
7
+ files: string[];
8
+ /** Default: production builds only. */
9
+ fingerprint?: boolean;
10
+ /** Add `integrity="sha384-..."` (subresource integrity) to the `<link>` and `<script>` elements that load a fingerprinted file. Default `false`. */
11
+ integrity?: boolean;
12
+ }
13
+
14
+ /** Renames each file to `name.<hash>.ext` in production builds and rewrites the links to it. */
15
+ export function assetsPlugin(options: AssetsPluginOptions): BuiltinPlugin;
@@ -0,0 +1,15 @@
1
+ // ssqch/elements: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface ElementsPluginOptions {
6
+ /** The folder with the elements' files, relative to the project root. Default: `elements` in the input folder. */
7
+ dir?: string;
8
+ /** Where that folder goes in the output. Default `"/elements/"`. */
9
+ url?: string;
10
+ /** When scripts load, for tags without `ssqch:load`: with the page (`"eager"`, the default), when the browser is idle, or when the element scrolls into view. */
11
+ load?: "eager" | "idle" | "visible";
12
+ }
13
+
14
+ /** Custom elements: `like-button.js` in the elements folder loads on the pages that have a `<like-button>`, and nowhere else. */
15
+ export function elementsPlugin(options?: ElementsPluginOptions): BuiltinPlugin;
@@ -0,0 +1,22 @@
1
+ // Type definitions for ssqch.config.js and the modules built into ssqch.
2
+ // Written by `ssqch types`. Editors use them for autocomplete and checking;
3
+ // the build doesn't read them. Regenerate after upgrading ssqch.
4
+
5
+ // The parts of Node's `process` that ssqch provides to configs and data files. Declared
6
+ // the way @types/node declares it, so a project that installs those types gets theirs too.
7
+ declare namespace NodeJS {
8
+ interface ProcessEnv {
9
+ /** The build's environment (`--env`): `"production"` for `ssqch build`, `"development"` for `ssqch serve`. */
10
+ SSQCH_ENV?: string;
11
+ [name: string]: string | undefined;
12
+ }
13
+ interface Process {
14
+ /** The environment variables, with `SSQCH_ENV` set to the build's environment when it isn't set. */
15
+ env: ProcessEnv;
16
+ /** The project root. */
17
+ cwd(): string;
18
+ /** `"darwin"`, `"linux"` or `"win32"`. */
19
+ platform: string;
20
+ }
21
+ }
22
+ declare var process: NodeJS.Process;
@@ -0,0 +1,79 @@
1
+ // ssqch/image: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export type ImageFormat = "avif" | "webp" | "jpeg" | "jpg" | "png" | "gif" | "svg" | "auto";
6
+ /** A format name. Known names autocomplete; ssqch rejects an unknown one when it builds. */
7
+ type FormatName = ImageFormat | (string & {});
8
+
9
+ export interface ImagePluginOptions {
10
+ /** Output formats; the last is the `<img>` fallback. `"auto"` keeps the source's format. */
11
+ formats?: FormatName[];
12
+ /** Widths to generate (never wider than the original). */
13
+ widths?: number[];
14
+ /** Attributes added to every `<img>`, like `{ loading: "lazy" }`. */
15
+ defaultAttributes?: Record<string, string>;
16
+ /** Folder in the output for generated images. Default `img`. */
17
+ outputDir?: string;
18
+ /** URL path they're served from. Default `/img/`. */
19
+ urlPath?: string;
20
+ webpQuality?: number;
21
+ avifQuality?: number;
22
+ /** 1 (slowest, smallest) to 10 (fastest). Default 8. */
23
+ avifSpeed?: number;
24
+ jpegQuality?: number;
25
+ minimumThreshold?: number;
26
+ /** Delete generated images the build didn't use. Only for full builds. */
27
+ prune?: boolean;
28
+ /** Remember image ids between builds in `.cache/ssqch`. Default `true`. */
29
+ hashCache?: boolean;
30
+ /** Point links to local images at a generated copy. Default `true`. */
31
+ linkedImages?: boolean;
32
+ /** Where images are encoded and kept between builds, from the project root; the output gets links to them. Default `.cache/ssqch/img`. `false` encodes straight into the output. */
33
+ cacheDir?: string | false;
34
+ }
35
+
36
+ /** One generated file. */
37
+ export interface ImageEntry {
38
+ format: string;
39
+ width: number;
40
+ height: number;
41
+ url: string;
42
+ /** The MIME type, like `image/webp`. */
43
+ sourceType: string;
44
+ /** `url width`, for a `srcset`. */
45
+ srcset: string;
46
+ filename: string;
47
+ outputPath: string;
48
+ size: number;
49
+ }
50
+
51
+ /** Turns every local `<img>` in HTML output into a `<picture>`. */
52
+ export function imagePlugin(options?: ImagePluginOptions): BuiltinPlugin;
53
+
54
+ /** Generate one image's files with the plugin's settings and cache. Keyed by format, smallest first; with `"auto"` in `formats`, its files are under `auto` too. */
55
+ export function image(src: string, options?: ImageCallOptions): Promise<Record<string, ImageEntry[]>>;
56
+
57
+ /** One generated copy of an image, from `imageUrl()`. A remote URL comes back as only `{ url }`. */
58
+ export interface ImageUrl {
59
+ url: string;
60
+ width?: number;
61
+ height?: number;
62
+ /** The MIME type, like `image/png`. */
63
+ type?: string;
64
+ /** The format it's in, like `png`. */
65
+ format?: string;
66
+ }
67
+
68
+ /** The URL (and size and type) of one generated copy of an image, for `og:image`, JSON-LD and feeds: `imageUrl("/content/logo.png", { width: 1200 })`. `src` is a site path, from the input folder. Also a template function. */
69
+ export function imageUrl(src: string, options?: { width?: number | "auto"; format?: FormatName }): ImageUrl;
70
+
71
+ /** What `image()` takes for one image. Encoder settings go on `imagePlugin()`. */
72
+ export interface ImageCallOptions {
73
+ /** Widths to generate; `"auto"` is the original's. Default `["auto"]`. */
74
+ widths?: Array<number | "auto">;
75
+ /** Output formats. Default `["webp", "jpeg"]`. */
76
+ formats?: FormatName[];
77
+ /** The output's URL path without the width and extension, instead of a name from a hash: `"/assets/sponsors/acme"` writes `/assets/sponsors/acme-200.webp`. Without a leading `/`, it's inside the image output folder. */
78
+ name?: string;
79
+ }
@@ -0,0 +1,234 @@
1
+ // ssqch: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ /** What a config function gets: which build this is. */
4
+ export interface ConfigContext {
5
+ /** `"production"` for `ssqch build`, `"development"` for `ssqch serve` (unless `--env` says otherwise). */
6
+ env: "production" | "development";
7
+ /** True while running `ssqch serve`. */
8
+ serving: boolean;
9
+ }
10
+
11
+ /** The data of the pages each schema covers, by schema name. `ssqch types` fills this in from the config's `schemas`. */
12
+ export interface Schemas {}
13
+
14
+ /** A page in a collection, oldest first. */
15
+ export interface CollectionItem<Data = Record<string, any>> {
16
+ /** The page's URL, or `false` for `permalink: false`. */
17
+ url: string | false;
18
+ date: Date;
19
+ /** The template's path, like `./src/posts/pine.md`. */
20
+ inputPath: string;
21
+ /** The file name without extensions (`pine` for `pine.md`; empty for an `index` page). */
22
+ fileSlug: string;
23
+ filePathStem: string;
24
+ /** Where the page is written, or `false`. */
25
+ outputPath: string | false;
26
+ /** `url`, `inputPath`, `date` and the rest, plus `headings` from the rendered body. */
27
+ page: Record<string, unknown> & { headings?: Heading[]; excerpt?: string; lastModified?: Date };
28
+ /** The page's data: front matter, data files and the rest of the cascade. */
29
+ data: Data & Record<string, any>;
30
+ /** The rendered body, without layouts. */
31
+ templateContent: string;
32
+ content: string;
33
+ }
34
+
35
+ /** A heading in a page's rendered body (`page.headings`). */
36
+ export interface Heading {
37
+ level: number;
38
+ /** The heading's `id`, if it has one. */
39
+ id?: string;
40
+ /** Its text, without tags or anything marked `aria-hidden="true"`. */
41
+ text: string;
42
+ }
43
+
44
+ /** What a token is: its `hl-*` class without the prefix. */
45
+ export type TokenKind = "comment" | "keyword" | "operator" | "string" | "regexp" | "escape" | "number" | "constant" | "builtin" | "property" | "attribute" | "function" | "type" | "parameter" | "tag" | "heading" | "strong" | "emphasis" | "link" | "inserted" | "deleted";
46
+
47
+ /** A piece of highlighted code. Without a `kind` (or as a string), it's plain text. */
48
+ export type Token = [text: string, kind?: TokenKind | null] | { text: string; kind?: TokenKind | null } | string;
49
+
50
+ /** A site's language for `markdown.highlight.languages`: a function that cuts the code into tokens whose text adds up to the code, another language's name (`"chordpro"`, an alias), or the path of a `.sublime-syntax` grammar from the project root. */
51
+ export type Highlighter = ((code: string, lang: string) => Token[]) | string;
52
+
53
+ /** How Markdown renders. */
54
+ export interface MarkdownOptions {
55
+ /** Automatic heading `id`s: `"github"` (the default), `"blackfriday"` (Hugo's older style: `a-b` for `A -- B`), or `false` for none. A `{#id}` on the heading always wins. */
56
+ headingIds?: "github" | "blackfriday" | "ascii" | false | ((text: string) => string);
57
+ /** `## Heading {#id .class key=value}`. Default `true`. */
58
+ headingAttributes?: boolean;
59
+ /** `[^1]` references, with the notes at the end of the page. Default `true`. */
60
+ footnotes?: boolean;
61
+ /** `- [ ]` and `- [x]` items. Default `true`. */
62
+ taskLists?: boolean;
63
+ /** Bare `https://` and `www.` URLs become links. Default `true`. */
64
+ autolinks?: boolean;
65
+ /** GitHub's `> [!NOTE]` alerts: note, tip, important, warning and caution. Default `true`. */
66
+ alerts?: boolean;
67
+ /** `::: name args` blocks, rendered by `_includes/containers/name.*`. Default `true`. */
68
+ containers?: boolean;
69
+ /** A term, then `: definition` lines. Default `false`. */
70
+ definitionLists?: boolean;
71
+ /** Curly quotes, dashes and ellipses. Default `false`. */
72
+ smartPunctuation?: boolean;
73
+ /** Lines indented four spaces are code blocks. `false` renders them as ordinary Markdown (HTML indented inside Markdown, say); fences are still code. Default `true`. */
74
+ indentedCode?: boolean;
75
+ /** Highlight fenced code at build time, with `hl-*` classes. The build writes their stylesheet to `/highlight.css`, or to `css` (a URL path), or not at all with `css: false`. `languages` adds languages or replaces built-in ones. Default `false`. */
76
+ highlight?: boolean | { css?: string | false; languages?: Record<string, Highlighter> };
77
+ }
78
+
79
+ /** What a collection function gets. */
80
+ export interface Pages {
81
+ /** Every page in collections, oldest first. */
82
+ all(): CollectionItem[];
83
+ /** Pages with this tag. A tag with a schema gives pages with that schema's fields. */
84
+ byTag<Tag extends keyof Schemas>(tag: Tag): CollectionItem<Schemas[Tag]>[];
85
+ byTag(tag: string): CollectionItem[];
86
+ /** Pages with all of these tags. */
87
+ byTags(...tags: string[]): CollectionItem[];
88
+ /** Pages whose input path matches a glob (or any of several): `"src/posts/*.md"`. */
89
+ byGlob(glob: string | string[]): CollectionItem[];
90
+ }
91
+
92
+ /** What a transform gets with the content. */
93
+ export interface TransformPage {
94
+ url: string;
95
+ inputPath: string;
96
+ outputPath: string;
97
+ }
98
+
99
+ /** What `beforeBuild` and `afterBuild` hooks get. */
100
+ export interface BuildEvent {
101
+ env: "production" | "development";
102
+ serving: boolean;
103
+ /** Folders relative to the project root, like `./src/`. */
104
+ dirs: { input: string; output: string; includes: string; data: string };
105
+ /** The files the build wrote (`afterBuild` only). */
106
+ written?: string[];
107
+ }
108
+
109
+ type MaybePromise<T> = T | Promise<T>;
110
+ /** A function, or `{ run: "command" }` to run a program in the project root (through `sh -c`, or `cmd /C` on Windows). It gets `SSQCH_ENV`, `SSQCH_SERVING`, `SSQCH_INPUT` and `SSQCH_OUTPUT`; a failure fails the build. */
111
+ type Hook = ((event: BuildEvent) => MaybePromise<void>) | { run: string };
112
+ /** Renders a template's body (front matter removed) with the page's data. */
113
+ type EngineRender = (source: string, data: Record<string, any>) => MaybePromise<string>;
114
+
115
+ /**
116
+ * A field's type: `"string"`, `"number"`, `"integer"`, `"boolean"`, `"date"`, `"file"` (a path to a file that exists), `"object"`, `"array"` or `"any"`;
117
+ * a literal (`"'draft'"`, `"1"`, `"true"`, `"null"`); a union (`"'draft' | 'published'"`); a list (`"string[]"`); and `?` at the end for optional (`"string?"`).
118
+ * Or an object of fields, a one-item array (`[{ name: "string" }]` is a list of objects), or a function that returns `true`, `false` or what's wrong.
119
+ */
120
+ export type SchemaType = string | ((value: any, page: Record<string, any>) => boolean | string | void) | SchemaFields | [SchemaType];
121
+ /** `{ field: type }`. A key ending in `?` is optional too: `"author?": { name: "string" }`. */
122
+ export interface SchemaFields {
123
+ [field: string]: SchemaType;
124
+ }
125
+ /** What a kind of page's data has to look like. Checked on every build; a problem names the file and the field. */
126
+ export interface Schema {
127
+ fields: SchemaFields;
128
+ /** Globs (relative to the input folder) of the files this covers. Without it, the schema covers the pages tagged with its name (`all` is every page in collections). */
129
+ files?: string | string[];
130
+ /** Front matter keys that aren't fields: `"allow"` (the default), `"warn"` or `"error"`. */
131
+ unknown?: "allow" | "warn" | "error";
132
+ }
133
+
134
+ /** Where a theme comes from: a folder, a pinned git URL, or the same as an object. */
135
+ export type ThemeSource = string | { git: string; ref: string; dir?: string };
136
+
137
+ /** A built-in plugin, as returned by `imagePlugin()` and the others. */
138
+ export interface BuiltinPlugin {
139
+ name: string;
140
+ builtin: string;
141
+ options?: Record<string, unknown>;
142
+ }
143
+
144
+ /** Everything a plugin can add. The config itself can set these too. */
145
+ export interface ConfigParts {
146
+ /** Shows up in error messages. */
147
+ name?: string;
148
+ /** Functions templates can call: `{{ slug(title) }}`. Async functions are awaited. */
149
+ filters?: Record<string, (...args: any[]) => unknown>;
150
+ /** Data for every template. A function (sync or async) is called on each build. */
151
+ data?: Record<string, unknown>;
152
+ /** Custom collections, from the pages in collections. */
153
+ collections?: Record<string, (pages: Pages) => unknown>;
154
+ /** Run on every output file. Return the content, changed or not. */
155
+ transforms?: Record<string, (content: string, page: TransformPage) => MaybePromise<string>>;
156
+ /** Template engines of your own, by file extension: a function, or an object with `render`. Return the rendered text. */
157
+ engines?: Record<string, EngineRender | { render: EngineRender }>;
158
+ /** Files or folders to copy: a path, or `{ from: to }`, or an array of them. */
159
+ passthrough?: string | Record<string, string> | Array<string | Record<string, string>>;
160
+ /** More paths for `ssqch serve` to watch. */
161
+ watch?: string | string[];
162
+ /** Run before each build: a function, `{ run: "command" }`, or a list of them. */
163
+ beforeBuild?: Hook | Hook[];
164
+ /** Run after each build, with `written` (the files the build wrote). */
165
+ afterBuild?: Hook | Hook[];
166
+ /** More config, from plugins. `false`, `null` and `undefined` are skipped. */
167
+ plugins?: Plugin[];
168
+ }
169
+
170
+ export type Plugin =
171
+ | ConfigParts
172
+ | BuiltinPlugin
173
+ | ((context: ConfigContext) => MaybePromise<ConfigParts | BuiltinPlugin | false | null | undefined>)
174
+ | false
175
+ | null
176
+ | undefined;
177
+
178
+ export interface Config extends ConfigParts {
179
+ /** Folders. `includes` and `data` are relative to `input`. */
180
+ dirs?: {
181
+ /** Default `.`. */
182
+ input?: string;
183
+ /** Default `_site`. */
184
+ output?: string;
185
+ /** Default `_includes`. */
186
+ includes?: string;
187
+ /** Default `_data`. */
188
+ data?: string;
189
+ };
190
+ /** File extensions to render. Default `["jinja", "md", "html"]`. Add `"edge"` for Edge, `"liquid"` for Liquid, `"njk"` for Nunjucks, `"j2"` for Jinja in `.j2` files, `"hbs"` / `"handlebars"` for Handlebars, `"mustache"`, or `"ejs"` for EJS. */
191
+ templateFormats?: string[];
192
+ /** The engine that runs over `.md` files first: `"jinja"` (the default), `"edge"`, `"liquid"`, `"njk"`, `"hbs"`, `"ejs"`, or `false` for none. */
193
+ markdownEngine?: string | false;
194
+ /** The engine that runs over `.html` files first. Default `"jinja"`; `false` for none. */
195
+ htmlEngine?: string | false;
196
+ /** Heading IDs, footnotes and the other Markdown extensions. */
197
+ markdown?: MarkdownOptions;
198
+ /** Merge objects and concatenate arrays through the data cascade. Default `true`. */
199
+ deepMerge?: boolean;
200
+ /** Delete output files an earlier build wrote or copied that this one didn't (a deleted post's page). Files other tools write are never touched. Default `false`. */
201
+ leaveNoTrace?: boolean;
202
+ /** Another name for `leaveNoTrace`. Set one of them. */
203
+ clean?: boolean;
204
+ /** Globs (relative to the input folder) of files that aren't pages, like `["drafts/**", "notes/*.wip.md"]`. */
205
+ ignore?: string | string[];
206
+ /** Page bundles: copy the other files in a folder whose page is `index.*` (images, downloads) next to the page. Default `false`. */
207
+ bundles?: boolean;
208
+ /** Printing an undefined value (`{{ titel }}`) is an error, in every template language. Conditionals and defaults still work. Default `false`. */
209
+ strict?: boolean;
210
+ /** `page.lastModified`: `"git"` for the last commit that changed the page's file (its modification time when it has uncommitted changes), or `"file"` for the modification time. Off by default. Needs the full history in CI (`fetch-depth: 0`). */
211
+ lastModified?: "git" | "file" | false;
212
+ /** The path the site is served under, when that isn't the root of its domain: `"/repo/"` for `https://you.github.io/repo/`. Templates and `page.url` stay as they are; ssqch adds the base to URLs from the site's root in the HTML it writes. Use the `withBase()` filter outside HTML attributes. */
213
+ base?: string;
214
+ /** A theme under the site: a folder (`"themes/docs"`), or a git repository pinned to a tag or a commit's full hash (`"https://github.com/you/theme#v1.2.0"`, with `#v1.2.0:folder` for a theme in a folder of its repository), fetched once and kept in `.cache/ssqch/themes/`. The site's own includes, data, pages and files win over the theme's, one by one. In a list, earlier themes sit on top of later ones. */
215
+ theme?: ThemeSource | ThemeSource[];
216
+ /** Content schemas, by name: `{ posts: { fields: { title: "string", date: "date" } } }` checks every page tagged `posts`. */
217
+ schemas?: Record<string, Schema>;
218
+ /** Size budgets by kind of file, checked after each build: a file over its kind's budget is an `over-budget` warning. Sizes are bytes or strings like `"150 KB"` and `"1.5 MB"` (powers of 1,000). */
219
+ budgets?: Partial<Record<"pages" | "images" | "css" | "javascript" | "fonts" | "media" | "documents" | "data" | "other" | "total", number | string>>;
220
+ /** What `ssqch serve` runs besides the server. */
221
+ serve?: {
222
+ /** Programs to start with the server and stop with it, like the watchers of your CSS and JavaScript tools: `["npx postcss src/app.css -o dist/app.css --watch"]`. Their output is shown with the tool's name in front. Builds don't run them. */
223
+ run?: string | string[];
224
+ };
225
+ }
226
+
227
+ /** Returns its argument. It's there so the config reads as one, and for these types. */
228
+ export function defineConfig<T extends Config | ((context: ConfigContext) => MaybePromise<Config>)>(config: T): T;
229
+ /** Render Markdown with the site's `markdown` options (render hooks and containers are for templates). `inline` drops the `<p>` around a single paragraph. */
230
+ export function markdown(text: string, options?: { inline?: boolean }): string;
231
+ /** Read a JSON, YAML or TOML file (from the project root) into data: `readData("src/_data/sites/en.yml")`. */
232
+ export function readData(path: string): any;
233
+ const ssqch: { defineConfig: typeof defineConfig; markdown: typeof markdown; readData: typeof readData };
234
+ export default ssqch;
@@ -0,0 +1,17 @@
1
+ // ssqch/links: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface LinksPluginOptions {
6
+ /** Check `#fragments` against the target page's ids. Default `true`. */
7
+ anchors?: boolean;
8
+ /** URL path prefixes to skip, like `["/downloads/"]`. */
9
+ ignore?: string[];
10
+ /** Fail the build on a broken link. Default: production builds only. */
11
+ fail?: boolean;
12
+ /** The site's address, like `"https://example.com"`, so absolute links to it are checked too. Default: the address `sitemap.xml` uses. */
13
+ url?: string;
14
+ }
15
+
16
+ /** Checks every internal link and anchor after each build: in HTML attributes, `<meta>` URLs, JSON-LD, and feeds and other XML. */
17
+ export function linksPlugin(options?: LinksPluginOptions): BuiltinPlugin;
@@ -0,0 +1,19 @@
1
+ // ssqch/minify: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface MinifyOptions {
6
+ /** Default `true`. */
7
+ collapseWhitespace?: boolean;
8
+ /** Default `true`. */
9
+ removeComments?: boolean;
10
+ /** Default `true`. */
11
+ shortDoctype?: boolean;
12
+ /** Drop boolean attributes' values (`defer="defer"` to `defer`) and extra whitespace in `class`, `srcset`, URLs and the viewport `<meta>`. Default `true`. */
13
+ shortenAttributes?: boolean;
14
+ }
15
+
16
+ /** Minifies HTML output, after the image transform. */
17
+ export function minifyPlugin(options?: MinifyOptions): BuiltinPlugin;
18
+ /** Minify one string of HTML, with the plugin's options. */
19
+ export function minify(html: string, options?: MinifyOptions): string;
@@ -0,0 +1,15 @@
1
+ // ssqch/redirects: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface RedirectsPluginOptions {
6
+ /** Write a redirect page (meta refresh, canonical link, `noindex`) at each old URL. Default `true`. */
7
+ pages?: boolean;
8
+ /** Add `/old /new 301` lines to `_redirects`, after any your own `_redirects` template writes. Default `false`. */
9
+ netlify?: boolean;
10
+ /** Redirects that aren't a page's `aliases`: `{ "/old/": "/new/" }`. The new URL can be on another site. */
11
+ redirects?: Record<string, string>;
12
+ }
13
+
14
+ /** Redirects from each page's `aliases` front matter and from `redirects`. */
15
+ export function redirectsPlugin(options?: RedirectsPluginOptions): BuiltinPlugin;
package/types/rss.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ // ssqch/rss: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ /** Adds the filters getNewestCollectionItemDate, dateToRfc3339, dateToRfc822, absoluteUrl, htmlToAbsoluteUrls and feedHtml. */
6
+ export function rssPlugin(): BuiltinPlugin;
7
+ /** The newest `date` in a collection, for a feed's `updated`. */
8
+ export function getNewestCollectionItemDate(collection: unknown[]): Date | undefined;
9
+ /** A date as RFC 3339 (`2024-06-01T00:00:00Z`), for Atom feeds. */
10
+ export function dateToRfc3339(date: Date | string): string;
11
+ /** A date as RFC 822 (`Sat, 01 Jun 2024 00:00:00 +0000`), for RSS feeds. */
12
+ export function dateToRfc822(date: Date | string): string;
13
+ /** A URL made absolute against the site's address: `absoluteUrl(post.url, "https://example.com")`. */
14
+ export function absoluteUrl(url: string, base: string): string;
15
+ /** Every link and image in some HTML made absolute, for a feed's content. */
16
+ export function htmlToAbsoluteUrls(html: string, base: string): string;
17
+ /** A post's HTML for a feed: each local image points at one generated copy (`width` 1200 and the source's format by default), page-only attributes go, and every URL is made absolute against `base`, the post's address. */
18
+ export function feedHtml(html: string, base: string, options?: { width?: number | "auto"; format?: string }): string;
@@ -0,0 +1,15 @@
1
+ // ssqch/sass: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface SassPluginOptions {
6
+ /** Sources (relative to the project root) to output URL paths. A folder compiles every `.scss` and `.sass` file in it that doesn't start with `_`, keeping their paths: `{ "src/scss": "/css" }`. A file compiles to the path given: `{ "src/app.scss": "/app.css" }`. */
7
+ files: Record<string, string>;
8
+ /** Default: `"compressed"` for production builds, `"expanded"` otherwise. */
9
+ style?: "compressed" | "expanded";
10
+ /** More folders `@use` and `@import` look in, relative to the project root. */
11
+ loadPaths?: string[];
12
+ }
13
+
14
+ /** Compiles Sass at the start of each build, so fingerprinting and the link checker see the CSS. */
15
+ export function sassPlugin(options: SassPluginOptions): BuiltinPlugin;
@@ -0,0 +1,19 @@
1
+ // ssqch/sitemap: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+
5
+ export interface SitemapPluginOptions {
6
+ /** The site's address, like `"https://example.com"`. */
7
+ url: string;
8
+ /** URL globs to leave out, like `["/tags/**"]`. Pages with `sitemap: false` and 404 pages are always left out. */
9
+ exclude?: string[];
10
+ /** Add `<lastmod>` from each page's date. Default `true`. */
11
+ lastmod?: boolean;
12
+ /** Where to write it. Default `"/sitemap.xml"`. */
13
+ output?: string;
14
+ /** List every page of a list split into pages (`/2/`, `/3/`), not just the first. Pagination with `size: 1` (a page per tag, say) is always listed. Default `false`. */
15
+ paginated?: boolean;
16
+ }
17
+
18
+ /** Writes `sitemap.xml` listing every HTML page. */
19
+ export function sitemapPlugin(options: SitemapPluginOptions): BuiltinPlugin;