ssqch 0.8.0 → 0.9.0

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.
Files changed (52) hide show
  1. package/README.md +2 -0
  2. package/bundled/README.md +144 -77
  3. package/bundled/ssqch.d.ts +17 -9
  4. package/bundled/trailheads/from-jekyll.md +79 -0
  5. package/lib/assets.js +7 -7
  6. package/lib/{chunk-RI2L3VGO.js → chunk-3A647I3N.js} +19 -11
  7. package/lib/{chunk-AMBFWPZ4.js → chunk-3K3ANWZ2.js} +3 -3
  8. package/lib/{chunk-WMOVCQO6.js → chunk-47P4YREZ.js} +6 -6
  9. package/lib/{chunk-C35KIPAR.js → chunk-76NTVE34.js} +98 -7
  10. package/lib/{chunk-TWCVHOKO.js → chunk-7PWCYHTJ.js} +125 -4
  11. package/lib/{chunk-JSPSMIJ2.js → chunk-7RDRZHJD.js} +9 -9
  12. package/lib/{chunk-JRT7TQQP.js → chunk-7SD7K567.js} +1 -1
  13. package/lib/{chunk-IRHRK7XB.js → chunk-7XLK2GEG.js} +1 -1
  14. package/lib/{chunk-YSH2NMIE.js → chunk-BEGC7YP6.js} +6 -6
  15. package/lib/{chunk-HR2RU2LY.js → chunk-CZ4XQC56.js} +6 -6
  16. package/lib/{chunk-DHHQKW4F.js → chunk-D2XE2GTY.js} +7 -7
  17. package/lib/{chunk-BOBPVAX2.js → chunk-DELWRJAO.js} +373 -52
  18. package/lib/{chunk-6XYSFG6V.js → chunk-GRWMGC7D.js} +15 -3
  19. package/lib/{chunk-N5QTGQ5N.js → chunk-GUKSZ2XM.js} +1 -1
  20. package/lib/{chunk-TDGBQNGW.js → chunk-HPXAZ2HU.js} +1 -1
  21. package/lib/{chunk-3PHCFZEU.js → chunk-II5DEH3Q.js} +2 -2
  22. package/lib/{chunk-FYGE634X.js → chunk-IJWHOFRP.js} +9 -9
  23. package/lib/{chunk-UGEGUUBT.js → chunk-LPHNACE4.js} +8 -8
  24. package/lib/{chunk-KBGE5MCY.js → chunk-MI6EJWA2.js} +1 -1
  25. package/lib/{chunk-EIT4ZDT4.js → chunk-NCWFYT74.js} +61 -5
  26. package/lib/{chunk-VVPZ5PDP.js → chunk-NNUKIGOO.js} +11 -11
  27. package/lib/{chunk-TN6EEDX2.js → chunk-R7K3D5W5.js} +28 -6
  28. package/lib/{chunk-37KSIVNY.js → chunk-RNJFPFXE.js} +3 -3
  29. package/lib/{chunk-CDEPYU7W.js → chunk-SF4I6Z7S.js} +2 -2
  30. package/lib/{chunk-GSKVRAHF.js → chunk-SURPOAW7.js} +6 -6
  31. package/lib/{chunk-BRK4MXXO.js → chunk-SXMJ52IK.js} +18 -11
  32. package/lib/{chunk-EZZUUPI4.js → chunk-TICWN55Z.js} +2 -2
  33. package/lib/{chunk-NUKCUDC4.js → chunk-TVU3OPPK.js} +3 -3
  34. package/lib/{chunk-GOE4ZSAB.js → chunk-XMXBHXZR.js} +9 -9
  35. package/lib/{chunk-WP3RPVUM.js → chunk-YTHQBMDJ.js} +1 -1
  36. package/lib/cli.js +32 -25
  37. package/lib/elements.js +7 -7
  38. package/lib/image.js +8 -8
  39. package/lib/links.js +7 -7
  40. package/lib/minify.js +7 -7
  41. package/lib/redirects.js +7 -7
  42. package/lib/rss.js +8 -8
  43. package/lib/sass.js +45 -10
  44. package/lib/sitemap.js +36 -11
  45. package/lib/ssqch.js +4 -4
  46. package/package.json +1 -1
  47. package/types/image.d.ts +5 -5
  48. package/types/index.d.ts +10 -4
  49. package/types/sitemap.d.ts +2 -0
  50. package/wasm/markdown.wasm +0 -0
  51. /package/lib/{chunk-BOBPVAX2.js.LEGAL.txt → chunk-DELWRJAO.js.LEGAL.txt} +0 -0
  52. /package/lib/{chunk-6XYSFG6V.js.LEGAL.txt → chunk-GRWMGC7D.js.LEGAL.txt} +0 -0
package/lib/ssqch.js CHANGED
@@ -8,13 +8,13 @@ import {
8
8
  readData,
9
9
  slugger,
10
10
  slugify
11
- } from "./chunk-EIT4ZDT4.js";
11
+ } from "./chunk-NCWFYT74.js";
12
12
  import "./chunk-FVZ5JBRI.js";
13
- import "./chunk-TDGBQNGW.js";
13
+ import "./chunk-HPXAZ2HU.js";
14
14
  import "./chunk-UU43WIZG.js";
15
- import "./chunk-C35KIPAR.js";
15
+ import "./chunk-76NTVE34.js";
16
16
  import "./chunk-CMUWRPSQ.js";
17
- import "./chunk-6XYSFG6V.js";
17
+ import "./chunk-GRWMGC7D.js";
18
18
  import "./chunk-VJWQSYEG.js";
19
19
  import "./chunk-I3PS26CI.js";
20
20
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssqch",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "SiteSquatch (ssqch): a fast static site generator, configured with JavaScript",
5
5
  "keywords": [
6
6
  "static site generator",
package/types/image.d.ts CHANGED
@@ -17,13 +17,13 @@ export interface ImagePluginOptions {
17
17
  outputDir?: string;
18
18
  /** URL path they're served from. Default `/img/`. */
19
19
  urlPath?: string;
20
- /** WebP quality, sharp's: a whole number from 1 to 100. Default 75 (0.7's 75 too: WebP's numbers didn't change). */
20
+ /** WebP quality, sharp's: a whole number from 1 to 100. Default 75. */
21
21
  webpQuality?: number;
22
- /** AVIF quality, sharp's: a whole number from 1 to 100. Default 41, which looks like 0.7's default of 50 (0.7's 60 is 48; the changelog has the table). */
22
+ /** AVIF quality, sharp's: a whole number from 1 to 100. Default 41. */
23
23
  avifQuality?: number;
24
- /** sharp's AVIF effort: a whole number from 0 (fastest) to 9 (slowest, smallest files). Default 2. Replaces 0.7's `avifSpeed`: speed 8 is effort 2, speed 4 is effort 3. */
24
+ /** sharp's AVIF effort: a whole number from 0 (fastest) to 9 (slowest, smallest files). Default 2. */
25
25
  avifEffort?: number;
26
- /** JPEG quality, sharp's (mozjpeg): a whole number from 1 to 100. Default 89, which looks like 0.7's default of 80. */
26
+ /** JPEG quality, sharp's (mozjpeg): a whole number from 1 to 100. Default 89. */
27
27
  jpegQuality?: number;
28
28
  /** A width larger than the original is clamped to it only when the width before it is this many times smaller. Default 1.25. */
29
29
  minimumThreshold?: number;
@@ -52,7 +52,7 @@ export interface ImageEntry {
52
52
  size: number;
53
53
  }
54
54
 
55
- /** Turns every local `<img>` in HTML output into a `<picture>`, encoded by sharp (AVIF needs no build feature). `[ssqch] Encoded ...` lines come as each image's files are done, while pages go on rendering. */
55
+ /** Turns every local `<img>` in HTML output into a `<picture>`, with AVIF, WebP and fallback sources encoded by sharp. `[ssqch] Encoded ...` lines come as each image's files are done, while pages go on rendering. */
56
56
  export function imagePlugin(options?: ImagePluginOptions): BuiltinPlugin;
57
57
 
58
58
  /** 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. */
package/types/index.d.ts CHANGED
@@ -52,7 +52,7 @@ export type Highlighter = ((code: string, lang: string) => Token[]) | string;
52
52
 
53
53
  /** How Markdown renders. */
54
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. */
55
+ /** Automatic heading `id`s: `"github"` (the default: GitHub's and github-slugger's anchors, character for character), `"blackfriday"` (Hugo's older style: `a-b` for `A -- B`), or `false` for none. A `{#id}` on the heading always wins. */
56
56
  headingIds?: "github" | "blackfriday" | "ascii" | false | ((text: string) => string);
57
57
  /** `## Heading {#id .class key=value}`. Default `true`. */
58
58
  headingAttributes?: boolean;
@@ -100,6 +100,10 @@ export interface TransformPage {
100
100
  export interface BuildEvent {
101
101
  env: "production" | "development";
102
102
  serving: boolean;
103
+ /** The build was run with `--quiet`: print only warnings and errors. */
104
+ quiet: boolean;
105
+ /** The build was run with `--verbose`. */
106
+ verbose: boolean;
103
107
  /** Folders relative to the project root, like `./src/`. */
104
108
  dirs: { input: string; output: string; includes: string; data: string };
105
109
  /** The files the build wrote (`afterBuild` only). */
@@ -107,7 +111,7 @@ export interface BuildEvent {
107
111
  }
108
112
 
109
113
  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. */
114
+ /** 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_QUIET`, `SSQCH_INPUT` and `SSQCH_OUTPUT`; a failure fails the build. */
111
115
  type Hook = ((event: BuildEvent) => MaybePromise<void>) | { run: string };
112
116
  /** Renders a template's body (front matter removed) with the page's data. */
113
117
  type EngineRender = (source: string, data: Record<string, any>) => MaybePromise<string>;
@@ -159,7 +163,7 @@ export interface ConfigParts {
159
163
  name?: string;
160
164
  /** Functions templates can call: `{{ slug(title) }}`. Async functions are awaited. */
161
165
  filters?: Record<string, (...args: any[]) => unknown>;
162
- /** Data for every template. A function (sync or async) is called on each build. */
166
+ /** Data for every template. A value that's a function (sync or async) is called on each build, and its answer is that name's value. */
163
167
  data?: Record<string, unknown>;
164
168
  /** Custom collections, from the pages in collections. */
165
169
  collections?: Record<string, (pages: Pages) => unknown>;
@@ -222,6 +226,8 @@ export interface Config extends ConfigParts {
222
226
  strict?: boolean;
223
227
  /** `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`). */
224
228
  lastModified?: "git" | "file" | false;
229
+ /** The time zone the site's own JavaScript runs in, as an IANA name (`"UTC"`, `"America/New_York"`): `Date`'s local methods and libraries like luxon and date-fns, in data files, filters, hooks and Edge templates, so a laptop and CI build the same pages. ssqch's own date filters are UTC whatever this says. Default: the machine's. The config's own top-level code runs before it applies. */
230
+ timeZone?: string;
225
231
  /** 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. */
226
232
  base?: string;
227
233
  /** 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. */
@@ -232,7 +238,7 @@ export interface Config extends ConfigParts {
232
238
  budgets?: Partial<Record<"pages" | "images" | "css" | "javascript" | "fonts" | "media" | "documents" | "data" | "other" | "total", number | string>>;
233
239
  /** What `ssqch serve` runs besides the server. (The server builds in a process of its own, starts it again when the config or a module it imports changes, and listens on 127.0.0.1 only.) */
234
240
  serve?: {
235
- /** 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. */
241
+ /** 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. They get `SSQCH_ENV`, `SSQCH_SERVING` (`true`), `SSQCH_QUIET`, `SSQCH_INPUT` and `SSQCH_OUTPUT`, as build commands do. Builds don't run them. */
236
242
  run?: string | string[];
237
243
  };
238
244
  }
@@ -13,6 +13,8 @@ export interface SitemapPluginOptions {
13
13
  output?: string;
14
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
15
  paginated?: boolean;
16
+ /** A page's translations, as `<xhtml:link rel="alternate" hreflang>` links under its `<loc>` (Google's way to list them): a function that gets each page (`url`, `inputPath`, `outputPath`, `date`, `data`) and returns `[{ hreflang: "fr", href: "/fr/guide/" }]`, the page itself included, or nothing. An `href` from the site's root gets the `url` and `base` in front. It's called at once, for each page in the sitemap. */
17
+ alternates?: (page: { url: string; inputPath: string; outputPath: string; date: Date; data: Record<string, any> }) => Array<{ hreflang: string; href: string }> | undefined | null;
16
18
  }
17
19
 
18
20
  /** Writes `sitemap.xml` listing every HTML page. */
Binary file