@dogsbay/ssg-cli 0.2.0-beta.167.1 → 0.2.0-beta.170

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.
@@ -10480,9 +10480,13 @@ var LOADERS = {
10480
10480
  "graphql": () => import("./graphql-H4XAFKUQ.mjs"),
10481
10481
  "nginx": () => import("./nginx-THNEASQW.mjs"),
10482
10482
  "hcl": () => import("./hcl-OV4NBCSV.mjs"),
10483
- "http": () => import("./http-POY7GQIM.mjs")
10483
+ "http": () => import("./http-POY7GQIM.mjs"),
10484
+ "asciidoc": () => import("./asciidoc-JYFSFYLA.mjs"),
10485
+ "jinja": () => import("./jinja-45KAG6FY.mjs")
10484
10486
  };
10485
10487
  var SPELLINGS = {
10488
+ "adoc": "asciidoc",
10489
+ "asciidoc": "asciidoc",
10486
10490
  "bash": "bash",
10487
10491
  "bat": "bat",
10488
10492
  "batch": "bat",
@@ -10512,6 +10516,8 @@ var SPELLINGS = {
10512
10516
  "ini": "ini",
10513
10517
  "java": "java",
10514
10518
  "javascript": "javascript",
10519
+ "jinja": "jinja",
10520
+ "jinja-html": "jinja",
10515
10521
  "js": "javascript",
10516
10522
  "json": "json",
10517
10523
  "jsonc": "jsonc",
@@ -10593,9 +10599,44 @@ var LAZY_EMBEDS = {
10593
10599
  "javascript": ["(\\s*):javascript", "(\\s*)%script"],
10594
10600
  "markdown": ["(\\s*)(:markdown)"],
10595
10601
  "ruby": ["(\\s*):ruby", "(\\s*):ruby$", "\\s*(?:((%)([-:\\w]+))|(?=[#.]))", "(\\s*):(ruby|opal)$", "(\\s*)(:ruby)", "#\\{", "!?==", "\\{", "(&amp|!)?([-=~])"]
10602
+ },
10603
+ "asciidoc": {
10604
+ "bat": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(bat(?:|ch)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(bat(?:|ch))((\\s+|[,:?{])[^`]*)?$)"],
10605
+ "c": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:([ch]))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:([ch])((\\s+|[,:?{])[^`]*)?$)"],
10606
+ "cpp": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(c(?:pp|\\+\\+|xx)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(c(?:pp|\\+\\+|xx))((\\s+|[,:?{])[^`]*)?$)"],
10607
+ "csharp": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(c(?:s|sharp|#)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(c(?:s|sharp|#))((\\s+|[,:?{])[^`]*)?$)"],
10608
+ "css": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(css(?:|.erb)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(css(?:|.erb))((\\s+|[,:?{])[^`]*)?$)"],
10609
+ "diff": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(patch|diff|rej))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(patch|diff|rej)((\\s+|[,:?{])[^`]*)?$)"],
10610
+ "docker": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:([Dd]ockerfile))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:([Dd]ockerfile)((\\s+|[,:?{])[^`]*)?$)"],
10611
+ "go": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(go(?:|lang)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(go(?:|lang))((\\s+|[,:?{])[^`]*)?$)"],
10612
+ "groovy": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(g(?:roovy|vy)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(g(?:roovy|vy))((\\s+|[,:?{])[^`]*)?$)"],
10613
+ "html": ["(?:(?<!\\\\)(\\[([^]]+?)]))?\\\\{0,2}(?<delim>\\+{2,3}|\\${2})(.*?)(\\k<delim>)", "(?<!\\\\)(pass:)([,a-z]*)(\\[)", "(?=(?>\\[(pass)([#%,.][^]]+)*]$))", "(\\+{4,})$", "(?=(?>\\[(source)[#,]\\p{blank}*(?i:(html?|shtml|xhtml|inc|tmpl|tpl))([#,][^]]+)*]$))", "(?=(?>\\[(source)[#,]\\p{blank}*(?i:(php3??|php4|php5|phpt|phtml|aw|ctp))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(html?|shtml|xhtml|inc|tmpl|tpl)((\\s+|[,:?{])[^`]*)?$)", "(|)(`{3,})\\s*(?i:(php3??|php4|php5|phpt|phtml|aw|ctp)((\\s+|[,:?{])[^`]*)?$)"],
10614
+ "ini": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(ini|conf))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(ini|conf)((\\s+|[,:?{])[^`]*)?$)"],
10615
+ "java": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(java|bsh))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(java|bsh)((\\s+|[,:?{])[^`]*)?$)"],
10616
+ "javascript": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(jsx??|javascript|es6|mjs|cjs|dataviewjs|\\{\\.js.+?}))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(jsx??|javascript|es6|mjs|cjs|dataviewjs|\\{\\.js.+?})((\\s+|[,:?{])[^`]*)?$)"],
10617
+ "json": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(json5??|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(json5??|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)((\\s+|[,:?{])[^`]*)?$)"],
10618
+ "jsonc": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(jsonc))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(jsonc)((\\s+|[,:?{])[^`]*)?$)"],
10619
+ "kotlin": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(k(?:otlin|t)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(k(?:otlin|t))((\\s+|[,:?{])[^`]*)?$)"],
10620
+ "lua": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(lua))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(lua)((\\s+|[,:?{])[^`]*)?$)"],
10621
+ "make": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:((?:[Mm]|GNUm|OCamlM)akefile))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:((?:[Mm]|GNUm|OCamlM)akefile)((\\s+|[,:?{])[^`]*)?$)"],
10622
+ "markdown": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(m(?:arkdown|d)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(m(?:arkdown|d))((\\s+|[,:?{])[^`]*)?$)"],
10623
+ "powershell": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(p(?:owershell|s1|sm1|sd1|wsh)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(p(?:owershell|s1|sm1|sd1|wsh))((\\s+|[,:?{])[^`]*)?$)"],
10624
+ "python": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(python|py3??|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gypi??|\\{\\.python.+?}))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(python|py3??|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gypi??|\\{\\.python.+?})((\\s+|[,:?{])[^`]*)?$)"],
10625
+ "regexp": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(re))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(re)((\\s+|[,:?{])[^`]*)?$)"],
10626
+ "ruby": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(ruby|rbx??|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(ruby|rbx??|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)((\\s+|[,:?{])[^`]*)?$)"],
10627
+ "rust": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(rust|rs|\\{\\.rust.+?}))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(rust|rs|\\{\\.rust.+?})((\\s+|[,:?{])[^`]*)?$)"],
10628
+ "scss": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(scss))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(scss)((\\s+|[,:?{])[^`]*)?$)"],
10629
+ "shellscript": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\{\\.bash.+?}))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\{\\.bash.+?})((\\s+|[,:?{])[^`]*)?$)"],
10630
+ "sql": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(sql|ddl|dml))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(sql|ddl|dml)((\\s+|[,:?{])[^`]*)?$)"],
10631
+ "tsx": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(tsx))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(tsx)((\\s+|[,:?{])[^`]*)?$)"],
10632
+ "typescript": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(t(?:ypescript|s)))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(t(?:ypescript|s))((\\s+|[,:?{])[^`]*)?$)"],
10633
+ "xml": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)((\\s+|[,:?{])[^`]*)?$)"],
10634
+ "xsl": ["(?=(?>\\[(source)[#,]\\p{blank}*(?i:(xslt??))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(xslt??)((\\s+|[,:?{])[^`]*)?$)"],
10635
+ "yaml": ["(-{3})$", "(?=(?>\\[(source)[#,]\\p{blank}*(?i:(ya?ml))([#,][^]]+)*]$))", "(|)(`{3,})\\s*(?i:(ya?ml)((\\s+|[,:?{])[^`]*)?$)"]
10596
10636
  }
10597
10637
  };
10598
10638
  var LAZY_VIA = {
10639
+ "asciidoc": ["asciidoc"],
10599
10640
  "haml": ["haml"],
10600
10641
  "markdown": ["markdown"],
10601
10642
  "ruby": ["haml"]
@@ -10942,6 +10983,10 @@ var ALIASES = {
10942
10983
  py: "python",
10943
10984
  rb: "ruby",
10944
10985
  md: "markdown",
10986
+ // A grammar that embeds lazily must be reached by its own name (LAZY_VIA): its other spellings come here
10987
+ adoc: "asciidoc",
10988
+ jinja2: "jinja",
10989
+ j2: "jinja",
10945
10990
  terraform: "hcl",
10946
10991
  tf: "hcl"
10947
10992
  };
@@ -6072,11 +6072,19 @@ db-nav-tree [data-part="toggle"] {
6072
6072
  /* A section without a page: the toggle carries the label and fills the row. */
6073
6073
  db-nav-tree [data-part="toggle"]:has([data-part="label"]) { @apply h-full min-w-0 flex-1 text-left; }
6074
6074
  db-nav-tree [data-part="toggle"] [data-part="label"] { @apply min-w-0 flex-1 truncate; }
6075
- db-nav-tree [data-part="chevron"] {
6075
+ /* The chevron, drawn here (chevron="css" on the tree, @dogsbay/elements' db-nav-tree): no <svg> in every section. */
6076
+ db-nav-tree[chevron="css"] [data-part="toggle"]::before {
6077
+ content: "";
6076
6078
  @apply size-4 shrink-0 transition-transform duration-200;
6077
6079
  order: -1;
6080
+ background: currentColor;
6081
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat; /* Chromium before 120 */
6082
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
6083
+ }
6084
+ db-nav-tree[chevron="css"] [data-part="toggle"][aria-expanded="true"]::before { transform: rotate(90deg); }
6085
+ @media (forced-colors: active) {
6086
+ db-nav-tree[chevron="css"] [data-part="toggle"]::before { forced-color-adjust: none; background: ButtonText; }
6078
6087
  }
6079
- db-nav-tree [data-part="toggle"][aria-expanded="true"] [data-part="chevron"] { transform: rotate(90deg); }
6080
6088
 
6081
6089
  /* \u2500\u2500\u2500 Version and language switchers (VersionSwitcher look, db-select parts) \u2500 */
6082
6090
  db-select [data-part="trigger"] {
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
- import {
4
- contentType
5
- } from "./chunk-CMGKSS45.mjs";
6
3
  import {
7
4
  cliMemorySettings,
8
5
  diagramRenderers,
@@ -28,6 +25,7 @@ import {
28
25
  readText,
29
26
  readTopicMaps,
30
27
  rebuildUnitLazy,
28
+ servedRoot,
31
29
  siteCssBuilder,
32
30
  siteFileFor,
33
31
  sourceRoot,
@@ -35,7 +33,10 @@ import {
35
33
  translationTables,
36
34
  versionsOf,
37
35
  writeTranslationStubs
38
- } from "./chunk-XYPTZFVB.mjs";
36
+ } from "./chunk-ARP3JAGB.mjs";
37
+ import {
38
+ contentType
39
+ } from "./chunk-CMGKSS45.mjs";
39
40
  import "./chunk-F6VRYHSY.mjs";
40
41
  import "./chunk-YVSP26OS.mjs";
41
42
  import "./chunk-Z7WUDBZV.mjs";
@@ -814,7 +815,7 @@ data: ${data ?? generation}
814
815
  }
815
816
  }
816
817
  const server = createServer(async (req, res) => {
817
- const base = cfg.basePath ? `/${cfg.basePath}` : "";
818
+ const base = servedRoot(cfg).slice(0, -1);
818
819
  try {
819
820
  const url = new URL(`http://x${req.url?.startsWith("/") ? "" : "/"}${req.url ?? "/"}`);
820
821
  if (url.pathname === EVENTS) {
@@ -863,6 +864,13 @@ data: ${generation}
863
864
  report();
864
865
  return res.end(type === HTML ? inject(String(typeof body === "string" ? body : new TextDecoder().decode(body)), generation) : body);
865
866
  }
867
+ if (url.pathname.endsWith("/") && path.endsWith("/") && path.length > 1 && failure === void 0) {
868
+ const page = await session.get(`${path.slice(0, -1)}.html`).catch(() => void 0);
869
+ if (page !== void 0) {
870
+ res.writeHead(301, { location: url.pathname.replace(/^\/+/, "/").replace(/\/+$/, "") + url.search });
871
+ return res.end();
872
+ }
873
+ }
866
874
  let nf;
867
875
  for (let d = path.split("/").slice(0, -1); !nf; d = d.slice(0, -1)) {
868
876
  nf = await session.get([...d, "404.html"].join("/"));
@@ -3,7 +3,7 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
3
3
  import {
4
4
  DEFAULT_HIGHLIGHT_CACHE_CHARS,
5
5
  createHighlighter
6
- } from "./chunk-UKZGJ5AP.mjs";
6
+ } from "./chunk-BYGBEPJ6.mjs";
7
7
  import {
8
8
  parseLineRanges
9
9
  } from "./chunk-YVSP26OS.mjs";
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
+ import {
4
+ html_default
5
+ } from "./chunk-TIRB4ROQ.mjs";
6
+ import "./chunk-CUTL24GH.mjs";
7
+ import "./chunk-JRPXZBM2.mjs";
8
+ import "./chunk-STRHO6SY.mjs";
9
+
10
+ // node_modules/@shikijs/langs/dist/jinja-html.mjs
11
+ var lang = Object.freeze(JSON.parse(`{"displayName":"jinja-html","firstLineMatch":"^\\\\{% extends [\\"'][^\\"']+[\\"'] %}","foldingStartMarker":"(<(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\\\\b.*?>|\\\\{%\\\\s*(block|filter|for|if|macro|raw))","foldingStopMarker":"(</(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\\\\b.*?>|\\\\{%\\\\s*(end(?:block|filter|for|if|macro|raw))\\\\s*%})","name":"jinja-html","patterns":[{"include":"source.jinja"},{"include":"text.html.basic"}],"scopeName":"text.html.jinja","embeddedLangs":["html"]}`));
12
+ var jinja_html_default = [
13
+ ...html_default,
14
+ lang
15
+ ];
16
+
17
+ // node_modules/@shikijs/langs/dist/jinja.mjs
18
+ var lang2 = Object.freeze(JSON.parse(`{"displayName":"Jinja","foldingStartMarker":"(\\\\{%\\\\s*(block|filter|for|if|macro|raw))","foldingStopMarker":"(\\\\{%\\\\s*(end(?:block|filter|for|if|macro|raw))\\\\s*%})","name":"jinja","patterns":[{"begin":"(\\\\{%)\\\\s*(raw)\\\\s*(%})","captures":{"1":{"name":"entity.other.jinja.delimiter.tag"},"2":{"name":"keyword.control.jinja"},"3":{"name":"entity.other.jinja.delimiter.tag"}},"end":"(\\\\{%)\\\\s*(endraw)\\\\s*(%})","name":"comment.block.jinja.raw"},{"include":"#comments"},{"begin":"\\\\{\\\\{-?","captures":[{"name":"variable.entity.other.jinja.delimiter"}],"end":"-?}}","name":"variable.meta.scope.jinja","patterns":[{"include":"#expression"}]},{"begin":"\\\\{%-?","captures":[{"name":"entity.other.jinja.delimiter.tag"}],"end":"-?%}","name":"meta.scope.jinja.tag","patterns":[{"include":"#expression"}]}],"repository":{"comments":{"begin":"\\\\{#-?","captures":[{"name":"entity.other.jinja.delimiter.comment"}],"end":"-?#}","name":"comment.block.jinja","patterns":[{"include":"#comments"}]},"escaped_char":{"match":"\\\\\\\\x[0-9A-F]{2}","name":"constant.character.escape.hex.jinja"},"escaped_unicode_char":{"captures":{"1":{"name":"constant.character.escape.unicode.16-bit-hex.jinja"},"2":{"name":"constant.character.escape.unicode.32-bit-hex.jinja"},"3":{"name":"constant.character.escape.unicode.name.jinja"}},"match":"(\\\\\\\\U\\\\h{8})|(\\\\\\\\u\\\\h{4})|(\\\\\\\\N\\\\{[ A-Za-z]+})"},"expression":{"patterns":[{"captures":{"1":{"name":"keyword.control.jinja"},"2":{"name":"variable.other.jinja.block"}},"match":"\\\\s*\\\\b(block)\\\\s+([A-Z_a-z][0-9A-Z_a-z]*)\\\\b"},{"captures":{"1":{"name":"keyword.control.jinja"},"2":{"name":"variable.other.jinja.filter"}},"match":"\\\\s*\\\\b(filter)\\\\s+([A-Z_a-z][0-9A-Z_a-z]*)\\\\b"},{"captures":{"1":{"name":"keyword.control.jinja"},"2":{"name":"variable.other.jinja.test"}},"match":"\\\\s*\\\\b(is)\\\\s+([A-Z_a-z][0-9A-Z_a-z]*)\\\\b"},{"captures":{"1":{"name":"keyword.control.jinja"}},"match":"(?<=\\\\{%-?)\\\\s*\\\\b([A-Z_a-z][0-9A-Z_a-z]*)\\\\b(?!\\\\s*[,=])"},{"match":"\\\\b(and|else|if|in|import|not|or|recursive|with(out)?\\\\s+context)\\\\b","name":"keyword.control.jinja"},{"match":"\\\\b(true|false|none)\\\\b","name":"constant.language.jinja"},{"match":"\\\\b(loop|super|self|varargs|kwargs)\\\\b","name":"variable.language.jinja"},{"match":"[A-Z_a-z][0-9A-Z_a-z]*","name":"variable.other.jinja"},{"match":"([-+]|\\\\*\\\\*?|//|[%/])","name":"keyword.operator.arithmetic.jinja"},{"captures":{"1":{"name":"punctuation.other.jinja"},"2":{"name":"variable.other.jinja.filter"}},"match":"(\\\\|)([A-Z_a-z][0-9A-Z_a-z]*)"},{"captures":{"1":{"name":"punctuation.other.jinja"},"2":{"name":"variable.other.jinja.attribute"}},"match":"(\\\\.)([A-Z_a-z][0-9A-Z_a-z]*)"},{"begin":"\\\\[","captures":[{"name":"punctuation.other.jinja"}],"end":"]","patterns":[{"include":"#expression"}]},{"begin":"\\\\(","captures":[{"name":"punctuation.other.jinja"}],"end":"\\\\)","patterns":[{"include":"#expression"}]},{"begin":"\\\\{","captures":[{"name":"punctuation.other.jinja"}],"end":"}","patterns":[{"include":"#expression"}]},{"match":"([,.:|])","name":"punctuation.other.jinja"},{"match":"(==|<=|=>|[<>]|!=)","name":"keyword.operator.comparison.jinja"},{"match":"=","name":"keyword.operator.assignment.jinja"},{"begin":"\\"","beginCaptures":[{"name":"punctuation.definition.string.begin.jinja"}],"end":"\\"","endCaptures":[{"name":"punctuation.definition.string.end.jinja"}],"name":"string.quoted.double.jinja","patterns":[{"include":"#string"}]},{"begin":"'","beginCaptures":[{"name":"punctuation.definition.string.begin.jinja"}],"end":"'","endCaptures":[{"name":"punctuation.definition.string.end.jinja"}],"name":"string.quoted.single.jinja","patterns":[{"include":"#string"}]},{"begin":"@/","beginCaptures":[{"name":"punctuation.definition.regexp.begin.jinja"}],"end":"/","endCaptures":[{"name":"punctuation.definition.regexp.end.jinja"}],"name":"string.regexp.jinja","patterns":[{"include":"#simple_escapes"}]}]},"simple_escapes":{"captures":{"1":{"name":"constant.character.escape.newline.jinja"},"2":{"name":"constant.character.escape.backlash.jinja"},"3":{"name":"constant.character.escape.double-quote.jinja"},"4":{"name":"constant.character.escape.single-quote.jinja"},"5":{"name":"constant.character.escape.bell.jinja"},"6":{"name":"constant.character.escape.backspace.jinja"},"7":{"name":"constant.character.escape.formfeed.jinja"},"8":{"name":"constant.character.escape.linefeed.jinja"},"9":{"name":"constant.character.escape.return.jinja"},"10":{"name":"constant.character.escape.tab.jinja"},"11":{"name":"constant.character.escape.vertical-tab.jinja"}},"match":"(\\\\\\\\\\\\n)|(\\\\\\\\\\\\\\\\)|(\\\\\\\\\\")|(\\\\\\\\')|(\\\\\\\\a)|(\\\\\\\\b)|(\\\\\\\\f)|(\\\\\\\\n)|(\\\\\\\\r)|(\\\\\\\\t)|(\\\\\\\\v)"},"string":{"patterns":[{"include":"#simple_escapes"},{"include":"#escaped_char"},{"include":"#escaped_unicode_char"}]}},"scopeName":"source.jinja","embeddedLangs":["jinja-html"]}`));
19
+ var jinja_default = [
20
+ ...jinja_html_default,
21
+ lang2
22
+ ];
23
+ export {
24
+ jinja_default as default
25
+ };
@@ -4,7 +4,7 @@ import {
4
4
  copiedPath,
5
5
  parseConfig,
6
6
  readBuildFiles
7
- } from "./chunk-XYPTZFVB.mjs";
7
+ } from "./chunk-ARP3JAGB.mjs";
8
8
  import "./chunk-F6VRYHSY.mjs";
9
9
  import {
10
10
  UsageError,
@@ -9,13 +9,13 @@ import {
9
9
  releaseDiff,
10
10
  releaseExitCode,
11
11
  releaseRedirects
12
- } from "./chunk-JXFQPMYJ.mjs";
12
+ } from "./chunk-AG37EIJE.mjs";
13
13
  import {
14
14
  buildUnits,
15
15
  parseConfig,
16
16
  readBuildFiles,
17
17
  versionsOf
18
- } from "./chunk-XYPTZFVB.mjs";
18
+ } from "./chunk-ARP3JAGB.mjs";
19
19
  import "./chunk-F6VRYHSY.mjs";
20
20
  import "./chunk-YVSP26OS.mjs";
21
21
  import "./chunk-Z7WUDBZV.mjs";
@@ -9,28 +9,52 @@ import "./chunk-STRHO6SY.mjs";
9
9
  import { createServer } from "node:http";
10
10
  import { readFile, stat } from "node:fs/promises";
11
11
  import { join, normalize, dirname, resolve, sep } from "node:path";
12
- async function isFile(p) {
12
+
13
+ // src/core/etag.ts
14
+ function etagMatches(header, etag) {
15
+ if (!header) return false;
16
+ if (header.trim() === "*") return true;
17
+ const bare = (t) => t.trim().replace(/^W\//, "");
18
+ return header.split(",").some((t) => bare(t) === bare(etag));
19
+ }
20
+
21
+ // src/node/serve.ts
22
+ async function fileTag(p) {
13
23
  try {
14
- return (await stat(p)).isFile();
24
+ const s = await stat(p, { bigint: true });
25
+ return s.isFile() ? `W/"${s.size.toString(16)}-${s.mtimeNs.toString(16)}-${s.ino.toString(16)}"` : void 0;
15
26
  } catch {
16
- return false;
27
+ return void 0;
17
28
  }
18
29
  }
19
- async function handle(root, reqUrl, res) {
30
+ var isFile = async (p) => await fileTag(p) !== void 0;
31
+ async function handle(root, reqUrl, res, ifNoneMatch) {
20
32
  const url = new URL(`http://x${reqUrl.startsWith("/") ? "" : "/"}${reqUrl}`);
21
33
  const path = normalize(decodeURIComponent(url.pathname)).replace(/^(\.\.[/\\])+/, "");
22
34
  const base = join(root, path);
23
35
  const candidates = path.endsWith("/") ? [join(base, "index.html")] : [base, `${base}.html`, join(base, "index.html")];
24
36
  for (const c of candidates) {
25
- if (inside(root, c) && await isFile(c)) {
37
+ const tag = inside(root, c) ? await fileTag(c) : void 0;
38
+ if (tag) {
26
39
  if (c === join(base, "index.html") && !path.endsWith("/")) {
27
40
  res.writeHead(301, { location: url.pathname.replace(/^\/+/, "/") + "/" + url.search });
28
41
  return res.end();
29
42
  }
30
- res.writeHead(200, { "content-type": contentType(c), "cache-control": "no-cache", "x-content-type-options": "nosniff" });
43
+ if (etagMatches(ifNoneMatch, tag)) {
44
+ res.writeHead(304, { etag: tag, "cache-control": "no-cache" });
45
+ return res.end();
46
+ }
47
+ res.writeHead(200, { "content-type": contentType(c), etag: tag, "cache-control": "no-cache", "x-content-type-options": "nosniff" });
31
48
  return res.end(await readFile(c));
32
49
  }
33
50
  }
51
+ if (url.pathname.endsWith("/") && path !== "/") {
52
+ const page = `${base.replace(/[\\/]+$/, "")}.html`;
53
+ if (inside(root, page) && await isFile(page)) {
54
+ res.writeHead(301, { location: url.pathname.replace(/^\/+/, "/").replace(/\/+$/, "") + url.search });
55
+ return res.end();
56
+ }
57
+ }
34
58
  let d = dirname(base);
35
59
  while (inside(root, d)) {
36
60
  const nf = join(d, "404.html");
@@ -51,7 +75,7 @@ function serve(dir, port, host = "127.0.0.1") {
51
75
  const root = resolve(dir);
52
76
  const server = createServer(async (req, res) => {
53
77
  try {
54
- await handle(root, req.url ?? "/", res);
78
+ await handle(root, req.url ?? "/", res, req.headers["if-none-match"]);
55
79
  } catch (e) {
56
80
  if (res.headersSent) return res.destroy();
57
81
  const bad = e instanceof URIError;
package/cli.mjs CHANGED
@@ -37,16 +37,16 @@ async function main() {
37
37
  usage(1);
38
38
  }
39
39
  if (wantsHelp(args)) usage(0, cmd);
40
- if (cmd === "build") return (await import("./chunks/build-command-WQJANVGR.mjs")).runBuild(args, HIGHLIGHT_WORKER);
41
- if (cmd === "assemble") return (await import("./chunks/build-command-WQJANVGR.mjs")).runBuild(args, HIGHLIGHT_WORKER, { assemble: true });
42
- if (cmd === "check") return (await import("./chunks/check-command-QTJ6BUNL.mjs")).runCheck(args);
43
- if (cmd === "publish") return (await import("./chunks/publish-command-J7KGJTLD.mjs")).runPublish(args);
40
+ if (cmd === "build") return (await import("./chunks/build-command-MUROARRP.mjs")).runBuild(args, HIGHLIGHT_WORKER);
41
+ if (cmd === "assemble") return (await import("./chunks/build-command-MUROARRP.mjs")).runBuild(args, HIGHLIGHT_WORKER, { assemble: true });
42
+ if (cmd === "check") return (await import("./chunks/check-command-3VMH7BBN.mjs")).runCheck(args);
43
+ if (cmd === "publish") return (await import("./chunks/publish-command-ALUC7Q3J.mjs")).runPublish(args);
44
44
  if (cmd === "release-diff") {
45
45
  const from = option(args, "--from")[0];
46
46
  const gitFrom = option(args, "--git-from")[0];
47
47
  const o = { from, gitFrom, json: flag(args, "--json"), write: flag(args, "--write"), candidates: flag(args, "--candidates"), strict: flag(args, "--strict") };
48
48
  const project = resolve(positional(args, "."));
49
- const { runReleaseDiff } = await import("./chunks/release-diff-JMNCG2T7.mjs");
49
+ const { runReleaseDiff } = await import("./chunks/release-diff-FN7ECYHE.mjs");
50
50
  process.exitCode = await runReleaseDiff(project, o);
51
51
  return;
52
52
  }
@@ -58,7 +58,7 @@ async function main() {
58
58
  const llms = flag(args, "--llms");
59
59
  const project = resolve(positional(args, "."));
60
60
  const t0 = performance.now();
61
- const { dev, readyLine, serverUrl } = await import("./chunks/dev-X3Y5P4KI.mjs");
61
+ const { dev, readyLine, serverUrl } = await import("./chunks/dev-YGIWDIEE.mjs");
62
62
  const { server } = await dev(project, port, { diagrams: !noDiagrams, lazy, search: noSearchDev ? false : void 0, llms, token: process.env.DOGSBAY_DEV_TOKEN || void 0, listening: (s) => console.log(readyLine(s)) });
63
63
  console.log(`dev server for ${project} at ${serverUrl(server)} (ready in ${Math.round(performance.now() - t0)} ms); watching for changes`);
64
64
  return;
@@ -66,7 +66,7 @@ async function main() {
66
66
  if (cmd === "serve") {
67
67
  const port = Number(option(args, "-p", "--port")[0] ?? 4400);
68
68
  const dir = resolve(positional(args, "out"));
69
- const { serve } = await import("./chunks/serve-CUWABTUV.mjs");
69
+ const { serve } = await import("./chunks/serve-66FDB2G5.mjs");
70
70
  await serve(dir, port);
71
71
  console.log(`serving ${dir} at http://127.0.0.1:${port}/`);
72
72
  return;
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
3
  import {
4
4
  createHighlighter
5
- } from "./chunks/chunk-UKZGJ5AP.mjs";
5
+ } from "./chunks/chunk-BYGBEPJ6.mjs";
6
6
  import "./chunks/chunk-YVSP26OS.mjs";
7
7
  import "./chunks/chunk-G6OTOD3B.mjs";
8
8
  import "./chunks/chunk-STRHO6SY.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/ssg-cli",
3
- "version": "0.2.0-beta.167.1",
3
+ "version": "0.2.0-beta.170",
4
4
  "type": "module",
5
5
  "description": "The dogsbay-ssg command: build, check, preview and publish Dogsbay-MD documentation sites that work offline",
6
6
  "license": "Apache-2.0",
@@ -18,7 +18,7 @@
18
18
  "NOTICE"
19
19
  ],
20
20
  "dependencies": {
21
- "@dogsbay/icons": "0.2.0-beta.167",
21
+ "@dogsbay/icons": "0.2.0-beta.170",
22
22
  "@mermanjs/web-render": "0.9.3"
23
23
  },
24
24
  "publishConfig": {
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
- import {
4
- require_dist
5
- } from "./chunk-IZF74GZZ.mjs";
6
3
  import {
7
4
  lib_default
8
5
  } from "./chunk-Z7WUDBZV.mjs";
6
+ import {
7
+ require_dist
8
+ } from "./chunk-IZF74GZZ.mjs";
9
9
  import {
10
10
  __toESM
11
11
  } from "./chunk-STRHO6SY.mjs";