@athrio/loom 0.0.14 → 0.0.15

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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { t as loadActive } from "./LanguageLoader-BnifC_28.js";
3
+ export { loadActive };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { o as __toESM, t as __commonJSMin } from "./rolldown-runtime-YU9U6SYh.js";
3
3
  import { $r as get, An as forEach, Bi as getOrElse$1, Br as dropRight, Bt as Struct, Dt as ArraySchema, Fi as filter, Ft as Number$1, Gi as isSome, Gr as filter$1, Gt as Unknown, Hi as getOrThrowWith, Ii as flatMap$1, Ir as chop, It as Option, Ji as match, Jt as decodeUnknownResult, Kn as orDie, Kr as findFirst, Li as flatMapNullishOr, Lr as dedupe, Lt as ReadonlyMap, Mi as all, Mt as Int, Nn as fromNullishOr$1, Nr as TaggedError, Nt as Literal, Oi as Service, On as flatMap$2, Ot as Boolean$1, Pi as exists, Pn as gen, Pr as taggedEnum, Pt as Literals, Qi as toArray, Qr as fromIterable, Qt as optional, Ri as fromNullishOr, Rn as logError, Rt as Record, S as withReturnType, Si as zip, Ti as match$1, Tn as fail, U as make, Ui as getOrUndefined, Ur as ensure, Ut as Tuple, Vi as getOrThrow, Vn as map$1, Vr as dropWhile, W as mapAccum, Wi as isNone, Wr as every, Wt as Union, X as runCollect, Xi as orElse$1, Xr as flatMap, Xt as isGreaterThan, Yi as none, Yr as findLastIndex, Zi as some, Zr as flatten, Zt as makeFilter, _ as orElse, _i as reverse, _n as catchCause, ai as isArray, ar as sync, b as when, bi as span$2, bn as catchTags, ci as last, d as get$1, di as mapAccum$1, ea as Number$2, ei as getSomes, en as tag, et as unfold, f as make$1, fn as andThen, g as exhaustive, gi as reduce, gr as provide, h as defined, hi as range, hr as mergeAll, ia as flip, ii as headNonEmpty, li as lastNonEmpty, lr as try_, m as update, mr as effect, na as combine, ni as groupWith, nn as withConstructorDefault, oa as mapInput, oi as isReadonlyArrayNonEmpty, p as modifyEffect, pi as matchLeft, pn as as, qi as map$2, qn as orElseSucceed, qr as findFirstIndex, qt as decodeUnknownOption, ra as combineAll, ri as head, rr as succeed, si as join$1, ta as String$2, ui as map$3, v as tag$1, vi as some$1, wi as getOrElse, x as whenOr, xi as takeRight, y as value, ya as pipe, yi as sort, yn as catchTag, zr as drop, zt as String$1 } from "./dist-NXZtp5_0.js";
4
- import { b as symbolsOf, o as isWorkspace, v as profileOf, y as symbolAt } from "./LoomStore-Bcx6V9HH.js";
4
+ import { b as symbolsOf, o as isWorkspace, v as profileOf, y as symbolAt } from "./LoomStore-C5R57cqa.js";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
6
6
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
7
7
  //#region ../loom-ast/src/ast/LoomNode.ts
@@ -1903,7 +1903,7 @@ var specifierLanguage = (label, sink, defaultLang, pkg) => {
1903
1903
  if (id === "toc") return "prose";
1904
1904
  return id;
1905
1905
  };
1906
- var sectionLanguage$1 = (section, defaultLang, pkg) => {
1906
+ var sectionLanguage = (section, defaultLang, pkg) => {
1907
1907
  const { specifier, sink } = section.heading;
1908
1908
  if (specifier !== void 0) return specifierLanguage(specifier.label.value, fromNullishOr(sink), defaultLang, pkg);
1909
1909
  if (sink === void 0) return defaultLang;
@@ -1912,7 +1912,7 @@ var sectionLanguage$1 = (section, defaultLang, pkg) => {
1912
1912
  var nameIndex = (sections, defaultLang, pkg) => pipe(sections, map$3((s) => map$2(fromNullishOr(s.heading.title), (title) => [title.source, {
1913
1913
  name: sectionNameOf(s),
1914
1914
  pos: title.position,
1915
- language: sectionLanguage$1(s, defaultLang, pkg)
1915
+ language: sectionLanguage(s, defaultLang, pkg)
1916
1916
  }])), getSomes, reduce(/* @__PURE__ */ new Map(), (index, [title, entry]) => new Map(index).set(title, [...index.get(title) ?? [], entry])));
1917
1917
  var frontmatterLanguage = (frontmatter) => pipe(frontmatter, flatMapNullishOr((f) => f.language), map$2((l) => l.value.trim().toLowerCase()));
1918
1918
  var languageByExtension = /* @__PURE__ */ new Map([
@@ -1958,7 +1958,7 @@ var buildSection = (index, defaultLang, modulePath, pkg, variables) => (section)
1958
1958
  const code = buildCode(section, valueWarps(section.preamble.flatMap((w) => w.warps), variables), index, {
1959
1959
  path: modulePath,
1960
1960
  name: sectionNameOf(section)
1961
- }, sectionLanguage$1(section, defaultLang, pkg));
1961
+ }, sectionLanguage(section, defaultLang, pkg));
1962
1962
  return {
1963
1963
  code,
1964
1964
  file: tangleFile(section, pkg, code)
@@ -8577,6 +8577,7 @@ var WovenPageSchema = Struct({
8577
8577
  slug: String$1,
8578
8578
  title: String$1,
8579
8579
  part: optional(String$1),
8580
+ frontmatter: optional(String$1),
8580
8581
  blocks: ArraySchema(WovenBlockSchema)
8581
8582
  });
8582
8583
  var WovenNavEntrySchema = Struct({
@@ -8584,7 +8585,8 @@ var WovenNavEntrySchema = Struct({
8584
8585
  title: String$1,
8585
8586
  slug: String$1,
8586
8587
  status: optional(String$1),
8587
- priority: optional(String$1)
8588
+ priority: optional(String$1),
8589
+ language: optional(String$1)
8588
8590
  });
8589
8591
  var WovenPartSchema = Struct({
8590
8592
  number: String$1,
@@ -8603,6 +8605,7 @@ var TocChapterSchema = Struct({
8603
8605
  title: String$1,
8604
8606
  status: optional(String$1),
8605
8607
  priority: optional(String$1),
8608
+ language: optional(String$1),
8606
8609
  path: String$1
8607
8610
  });
8608
8611
  var TocPartSchema = Struct({
@@ -8646,6 +8649,7 @@ var chapterDeclOf = (module) => pipe(fromNullishOr(module.doc.frontmatter), flat
8646
8649
  title: title.value,
8647
8650
  status: frontmatter.status?.value,
8648
8651
  priority: frontmatter.priority?.value,
8652
+ language: frontmatter.language?.value,
8649
8653
  path: module.path
8650
8654
  }))));
8651
8655
  var toTocChapter = (chapter) => TocChapterSchema.make({
@@ -8653,6 +8657,7 @@ var toTocChapter = (chapter) => TocChapterSchema.make({
8653
8657
  title: chapter.title,
8654
8658
  status: chapter.status,
8655
8659
  priority: chapter.priority,
8660
+ language: chapter.language,
8656
8661
  path: chapter.path
8657
8662
  });
8658
8663
  var romanUnits = {
@@ -8776,7 +8781,8 @@ var wovenEntry = (chapter) => WovenNavEntrySchema.make({
8776
8781
  title: chapter.title,
8777
8782
  slug: slugFor(chapter.path),
8778
8783
  status: chapter.status,
8779
- priority: chapter.priority
8784
+ priority: chapter.priority,
8785
+ language: chapter.language
8780
8786
  });
8781
8787
  var wovenPart = (part) => WovenPartSchema.make({
8782
8788
  number: part.number,
@@ -8795,6 +8801,7 @@ var buildPage = (module, indexes, partOfSlug) => isBookRoot(module) ? none() : m
8795
8801
  slug,
8796
8802
  title,
8797
8803
  part: partOfSlug.get(slug),
8804
+ frontmatter: module.doc.frontmatter?.source,
8798
8805
  blocks: buildBlocks(module, indexes)
8799
8806
  });
8800
8807
  });
@@ -8842,8 +8849,10 @@ var runSpan = (run) => {
8842
8849
  end: lastNonEmpty(kept).end
8843
8850
  }) : none();
8844
8851
  };
8845
- var reservedSpecifiers = /* @__PURE__ */ new Set(["tangle", "toc"]);
8846
- var sectionLanguage = (module, section) => pipe(fromNullishOr(section.heading.specifier), map$2((s) => s.label.value.toLowerCase()), filter((id) => !reservedSpecifiers.has(id)), orElse$1(() => map$2(fromNullishOr(module.doc.frontmatter?.language), (l) => l.value.trim().toLowerCase())), getOrElse$1(() => "plaintext"));
8852
+ var codeLanguage = (module, section) => {
8853
+ const frontmatter = fromNullishOr(module.doc.frontmatter);
8854
+ return sectionLanguage(section, pipe(frontmatter, flatMapNullishOr((f) => f.language), map$2((language) => language.value.trim().toLowerCase()), getOrElse$1(() => "plaintext")), pipe(frontmatter, flatMapNullishOr((f) => f.package), map$2((pkg) => pkg.value)));
8855
+ };
8847
8856
  var notePattern = /^[ \t]*:::\[Note\][^\n]*\n([\s\S]*?)\n[ \t]*:::(?:[ \t])*$/gm;
8848
8857
  var proseBlockOf = (markdown, source) => markdown.trim().length === 0 ? [] : [ProseBlockSchema.make({
8849
8858
  source,
@@ -8871,7 +8880,7 @@ var proseBlocks = (markdown, source) => {
8871
8880
  };
8872
8881
  var codeBlock = (module, indexes, section, source, run, span) => CodeBlockSchema.make({
8873
8882
  source,
8874
- language: sectionLanguage(module, section),
8883
+ language: codeLanguage(module, section),
8875
8884
  code: sliceContent(module.text, span),
8876
8885
  links: pipe(flatMap(run, (weft) => weft.anchors), filter$1((anchor) => anchor.position.start.offset >= span.start && anchor.position.end.offset <= span.end), map$3((anchor) => resolveLink(module, indexes, span.start, anchor)), getSomes)
8877
8886
  });
@@ -9390,4 +9399,4 @@ var LoomFormatter = class extends Service()("LoomFormatter", { make: gen(functio
9390
9399
  //#endregion
9391
9400
  export { holds as a, storeDirs as c, ReadError as d, stringSnapshot as i, PackageConfig as l, DocumentSource as n, loomsIn as o, LoomCompiler as r, projectIn as s, LoomFormatter as t, LoomConfig as u };
9392
9401
 
9393
- //# sourceMappingURL=LoomFormatter-CcAXsbSL.js.map
9402
+ //# sourceMappingURL=LoomFormatter-BHgesYCg.js.map