@dogsbay/ssg-cli 0.2.0-beta.175 → 0.2.0-beta.177

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.
@@ -1,55 +1,55 @@
1
1
  Third-party software in dist/cli.mjs and its chunks
2
2
 
3
3
  ========================================================================
4
- @dogsbay/corpus@0.2.0-beta.175 (MIT)
4
+ @dogsbay/corpus@0.2.0-beta.177 (MIT)
5
5
  https://github.com/dogsbay/dogsbay.git
6
6
 
7
7
  Licensed under MIT; the package ships no licence file.
8
8
 
9
9
  ========================================================================
10
- @dogsbay/detect@0.2.0-beta.175 (MIT)
10
+ @dogsbay/detect@0.2.0-beta.177 (MIT)
11
11
  https://github.com/dogsbay/dogsbay.git
12
12
 
13
13
  Licensed under MIT; the package ships no licence file.
14
14
 
15
15
  ========================================================================
16
- @dogsbay/elements@0.2.0-beta.175 (MIT)
16
+ @dogsbay/elements@0.2.0-beta.177 (MIT)
17
17
  https://github.com/dogsbay/dogsbay.git
18
18
 
19
19
  Licensed under MIT; the package ships no licence file.
20
20
 
21
21
  ========================================================================
22
- @dogsbay/format-dogsbay-md@0.2.0-beta.175 (MIT)
22
+ @dogsbay/format-dogsbay-md@0.2.0-beta.177 (MIT)
23
23
  https://github.com/dogsbay/dogsbay.git
24
24
 
25
25
  Licensed under MIT; the package ships no licence file.
26
26
 
27
27
  ========================================================================
28
- @dogsbay/format-openapi@0.2.0-beta.175 (MIT)
28
+ @dogsbay/format-openapi@0.2.0-beta.177 (MIT)
29
29
  https://github.com/dogsbay/dogsbay.git
30
30
 
31
31
  Licensed under MIT; the package ships no licence file.
32
32
 
33
33
  ========================================================================
34
- @dogsbay/format-topicmap@0.2.0-beta.175 (MIT)
34
+ @dogsbay/format-topicmap@0.2.0-beta.177 (MIT)
35
35
  https://github.com/dogsbay/dogsbay.git
36
36
 
37
37
  Licensed under MIT; the package ships no licence file.
38
38
 
39
39
  ========================================================================
40
- @dogsbay/highlight@0.2.0-beta.175 (MIT)
40
+ @dogsbay/highlight@0.2.0-beta.177 (MIT)
41
41
  https://github.com/dogsbay/dogsbay.git
42
42
 
43
43
  Licensed under MIT; the package ships no licence file.
44
44
 
45
45
  ========================================================================
46
- @dogsbay/icons@0.2.0-beta.175 (MIT)
46
+ @dogsbay/icons@0.2.0-beta.177 (MIT)
47
47
  https://github.com/dogsbay/dogsbay.git
48
48
 
49
49
  Licensed under MIT; the package ships no licence file.
50
50
 
51
51
  ========================================================================
52
- @dogsbay/minja@0.2.0-beta.175 (MIT)
52
+ @dogsbay/minja@0.2.0-beta.177 (MIT)
53
53
 
54
54
  MIT License
55
55
 
@@ -74,49 +74,49 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
74
  SOFTWARE.
75
75
 
76
76
  ========================================================================
77
- @dogsbay/primitives@0.2.0-beta.175 (MIT)
77
+ @dogsbay/primitives@0.2.0-beta.177 (MIT)
78
78
  https://github.com/dogsbay/dogsbay.git
79
79
 
80
80
  Licensed under MIT; the package ships no licence file.
81
81
 
82
82
  ========================================================================
83
- @dogsbay/render-html@0.2.0-beta.175 (MIT)
83
+ @dogsbay/render-html@0.2.0-beta.177 (MIT)
84
84
  https://github.com/dogsbay/dogsbay.git
85
85
 
86
86
  Licensed under MIT; the package ships no licence file.
87
87
 
88
88
  ========================================================================
89
- @dogsbay/search@0.2.0-beta.175 (MIT)
89
+ @dogsbay/search@0.2.0-beta.177 (MIT)
90
90
  https://github.com/dogsbay/dogsbay.git
91
91
 
92
92
  Licensed under MIT; the package ships no licence file.
93
93
 
94
94
  ========================================================================
95
- @dogsbay/serialize-core@0.2.0-beta.175 (MIT)
95
+ @dogsbay/serialize-core@0.2.0-beta.177 (MIT)
96
96
  https://github.com/dogsbay/dogsbay.git
97
97
 
98
98
  Licensed under MIT; the package ships no licence file.
99
99
 
100
100
  ========================================================================
101
- @dogsbay/site-check@0.2.0-beta.175 (MIT)
101
+ @dogsbay/site-check@0.2.0-beta.177 (MIT)
102
102
  https://github.com/dogsbay/dogsbay.git
103
103
 
104
104
  Licensed under MIT; the package ships no licence file.
105
105
 
106
106
  ========================================================================
107
- @dogsbay/site-files@0.2.0-beta.175 (MIT)
107
+ @dogsbay/site-files@0.2.0-beta.177 (MIT)
108
108
  https://github.com/dogsbay/dogsbay.git
109
109
 
110
110
  Licensed under MIT; the package ships no licence file.
111
111
 
112
112
  ========================================================================
113
- @dogsbay/types@0.2.0-beta.175 (MIT)
113
+ @dogsbay/types@0.2.0-beta.177 (MIT)
114
114
  https://github.com/dogsbay/dogsbay.git
115
115
 
116
116
  Licensed under MIT; the package ships no licence file.
117
117
 
118
118
  ========================================================================
119
- @dogsbay/ui@0.2.0-beta.175 (MIT)
119
+ @dogsbay/ui@0.2.0-beta.177 (MIT)
120
120
  https://github.com/dogsbay/dogsbay.git
121
121
 
122
122
  Licensed under MIT; the package ships no licence file.
@@ -18,8 +18,9 @@ import {
18
18
  removeStaleUnitFiles,
19
19
  selectUnits,
20
20
  unitFilesOf
21
- } from "./chunk-5DQVEOPN.mjs";
22
- import "./chunk-F6VRYHSY.mjs";
21
+ } from "./chunk-7KLVHGAF.mjs";
22
+ import "./chunk-KFYMG4VB.mjs";
23
+ import "./chunk-5APY2GH6.mjs";
23
24
  import {
24
25
  FAILING_CODES,
25
26
  UsageError,
@@ -11,7 +11,7 @@ import {
11
11
  releaseCollector,
12
12
  reportExitCode,
13
13
  toReport
14
- } from "./chunk-XATDIWM5.mjs";
14
+ } from "./chunk-SAXT3272.mjs";
15
15
  import {
16
16
  cliMemorySettings,
17
17
  diagramRenderers,
@@ -26,8 +26,9 @@ import {
26
26
  parseConfig,
27
27
  readBuildFiles,
28
28
  siteBase
29
- } from "./chunk-5DQVEOPN.mjs";
30
- import "./chunk-F6VRYHSY.mjs";
29
+ } from "./chunk-7KLVHGAF.mjs";
30
+ import "./chunk-KFYMG4VB.mjs";
31
+ import "./chunk-5APY2GH6.mjs";
31
32
  import {
32
33
  FAILING_CODES,
33
34
  UsageError,
@@ -513,11 +513,7 @@ function parseTemplate(template, base) {
513
513
  if (setMatch) {
514
514
  try {
515
515
  const expr = parseExpression(setMatch[2]);
516
- ast.push({
517
- type: "set",
518
- name: setMatch[1],
519
- value: expr
520
- });
516
+ add({ type: "set", name: setMatch[1], value: expr }, tagStart2, tagEnd);
521
517
  } catch (error) {
522
518
  errors.push(createError(`Invalid set expression: ${error.message}`));
523
519
  }
@@ -1324,6 +1320,39 @@ function sameSpan(a, b) {
1324
1320
  return false;
1325
1321
  }
1326
1322
 
1323
+ // node_modules/@dogsbay/minja/dist/variable-marks.js
1324
+ var VAR_OPEN = "\uE020";
1325
+ var VAR_VALUE = "\uE021";
1326
+ var VAR_CLOSE = "\uE022";
1327
+ function placeVariables(marked, variables) {
1328
+ let out = "";
1329
+ let at = 0;
1330
+ for (let open = marked.indexOf(VAR_OPEN); open !== -1; open = marked.indexOf(VAR_OPEN, open + 1)) {
1331
+ let j = open + 1;
1332
+ while (j < marked.length && marked.charCodeAt(j) >= 48 && marked.charCodeAt(j) <= 57)
1333
+ j++;
1334
+ if (j === open + 1 || marked[j] !== VAR_VALUE)
1335
+ continue;
1336
+ const v = variables[Number(marked.slice(open + 1, j))];
1337
+ if (!v || v.from !== void 0 || v.value.includes("\n"))
1338
+ continue;
1339
+ const start = j + 1;
1340
+ const end = start + v.value.length;
1341
+ if (marked.slice(start, end) !== v.value || marked[end] !== VAR_CLOSE)
1342
+ continue;
1343
+ out += marked.slice(at, open);
1344
+ v.from = out.length;
1345
+ out += v.value;
1346
+ v.to = out.length;
1347
+ at = end + 1;
1348
+ open = end;
1349
+ }
1350
+ return out + marked.slice(at);
1351
+ }
1352
+ function unbracket(text) {
1353
+ return text.indexOf(VAR_OPEN) === -1 ? text : text.replace(/\uE020\d*\uE021|\uE022/g, "");
1354
+ }
1355
+
1327
1356
  // node_modules/@dogsbay/minja/dist/renderer.js
1328
1357
  function transformHeadings(text, offset, initialFence = null, fenceOut) {
1329
1358
  if (offset === 0) {
@@ -1391,10 +1420,26 @@ async function render(template, options = {}) {
1391
1420
  }
1392
1421
  async function renderWithSourceMap(template, options = {}) {
1393
1422
  const trace = [];
1394
- const output = await renderTop(template, options, trace);
1395
- return { output, map: piecesMap(trace) };
1396
- }
1397
- async function renderTop(template, options, trace) {
1423
+ if (!options.markVariables) {
1424
+ const output2 = await renderTop(template, options, trace);
1425
+ return { output: output2, map: piecesMap(trace) };
1426
+ }
1427
+ const marks = { variables: [], definitions: /* @__PURE__ */ new Map(), brackets: !BRACKET_CHARS.test(template), spoiled: false };
1428
+ const marked = await renderTop(template, options, trace, marks);
1429
+ if (!marks.brackets)
1430
+ return { output: marked, map: piecesMap(trace), variables: marks.variables };
1431
+ const placed = marks.variables.filter((v) => !v.value.includes("\n")).length;
1432
+ const count = (c) => marked.split(c).length - 1;
1433
+ let output = placeVariables(marked, marks.variables);
1434
+ if (marks.spoiled || count(VAR_OPEN) !== placed || count(VAR_VALUE) !== placed || count(VAR_CLOSE) !== placed || marks.variables.some((v) => v.from === void 0 && !v.value.includes("\n"))) {
1435
+ output = await renderTop(template, { ...options, onWarning: void 0 });
1436
+ for (const v of marks.variables)
1437
+ delete v.from, delete v.to;
1438
+ }
1439
+ return { output, map: piecesMap(trace), variables: marks.variables };
1440
+ }
1441
+ var BRACKET_CHARS = /[\uE020-\uE022]/;
1442
+ async function renderTop(template, options, trace, marks) {
1398
1443
  const { loader = new FetchLoader(), context: initialContext = {}, basePath = "", maxIncludeDepth = 10, timeout = 5e3, hyphenToUnderscore = false, undefinedBehavior = "empty", undefinedConditions = "preserve", parseCache = sharedParseCache, maxOutput = DEFAULT_MAX_OUTPUT, onWarning } = options;
1399
1444
  if (!(timeout >= 0))
1400
1445
  throw new RangeError(`timeout must be a number of milliseconds, not ${timeout}`);
@@ -1431,7 +1476,8 @@ async function renderTop(template, options, trace) {
1431
1476
  expanding: [],
1432
1477
  onWarning,
1433
1478
  where: {},
1434
- trace
1479
+ trace,
1480
+ marks
1435
1481
  });
1436
1482
  try {
1437
1483
  return await Promise.race([renderPromise, timeoutPromise]);
@@ -1441,6 +1487,20 @@ async function renderTop(template, options, trace) {
1441
1487
  clearTimeout(timer);
1442
1488
  }
1443
1489
  }
1490
+ function markValue(options, name, value) {
1491
+ const marks = options.marks;
1492
+ if (!marks || !value)
1493
+ return value;
1494
+ if (BRACKET_CHARS.test(value))
1495
+ marks.spoiled = true;
1496
+ if (value.includes("\n") || !marks.brackets) {
1497
+ marks.variables.push({ name, value, definition: marks.definitions.get(name.split(".")[0]) ?? { via: "context" } });
1498
+ return value;
1499
+ }
1500
+ const definition = marks.definitions.get(name.split(".")[0]) ?? { via: "context" };
1501
+ const index = marks.variables.push({ name, value, definition }) - 1;
1502
+ return `${VAR_OPEN}${index}${VAR_VALUE}${value}${VAR_CLOSE}`;
1503
+ }
1444
1504
  function spanOf(node, lines) {
1445
1505
  const start = nodeStart.get(node) ?? 0;
1446
1506
  const end = nodeEnd.get(node) ?? start + 1;
@@ -1523,7 +1583,7 @@ async function renderNodes(nodes, options) {
1523
1583
  for (const node of nodes) {
1524
1584
  let rendered = await renderNode(node, options);
1525
1585
  if (node.type === "include" && rendered && parts.length > 0) {
1526
- const indent = lineIndent(parts[parts.length - 1]);
1586
+ const indent = lineIndent(options.marks?.brackets ? unbracket(parts[parts.length - 1]) : parts[parts.length - 1]);
1527
1587
  if (indent) {
1528
1588
  let lines = 0;
1529
1589
  for (let i = rendered.indexOf("\n"); i !== -1; i = rendered.indexOf("\n", i + 1)) {
@@ -1590,17 +1650,28 @@ async function renderNode(node, options) {
1590
1650
  ...options,
1591
1651
  expanding: [...options.expanding, node.name],
1592
1652
  where: { ...options.where, variable: node.name },
1593
- trace: void 0
1653
+ trace: void 0,
1654
+ marks: void 0
1594
1655
  });
1595
- traceExpr(options, node, expanded);
1596
- return expanded;
1656
+ const out2 = markValue(options, node.name, expanded);
1657
+ traceExpr(options, node, out2);
1658
+ return out2;
1597
1659
  }
1598
- traceExpr(options, node, str);
1599
- return spend(str, budget);
1660
+ spend(str, budget);
1661
+ const out = markValue(options, node.name, str);
1662
+ traceExpr(options, node, out);
1663
+ return out;
1600
1664
  }
1601
1665
  case "set": {
1602
1666
  const value = evaluateExpression(node.value, context);
1603
1667
  context.set(node.name, value);
1668
+ if (options.marks) {
1669
+ options.marks.definitions.set(node.name.split(".")[0], {
1670
+ via: "set",
1671
+ ...options.file !== void 0 ? { file: options.file } : {},
1672
+ line: spanOf(node, options.lines).from
1673
+ });
1674
+ }
1604
1675
  return "";
1605
1676
  }
1606
1677
  case "comment":
@@ -1641,6 +1712,8 @@ async function renderNode(node, options) {
1641
1712
  case "include": {
1642
1713
  try {
1643
1714
  const includedContent = await loader.load(node.path, basePath);
1715
+ if (options.marks && BRACKET_CHARS.test(includedContent))
1716
+ options.marks.spoiled = true;
1644
1717
  checkDeadline(budget);
1645
1718
  let newBasePath = basePath;
1646
1719
  if (node.path.includes("://")) {
@@ -1665,7 +1738,8 @@ async function renderNode(node, options) {
1665
1738
  includeDepth: includeDepth + 1,
1666
1739
  basePath: newBasePath,
1667
1740
  where: { include: node.path, includes: [...options.where.includes ?? [], node.path] },
1668
- trace: pieces
1741
+ trace: pieces,
1742
+ file: options.trace ? includeFile(node.path, basePath) : void 0
1669
1743
  });
1670
1744
  if (options.trace && pieces) {
1671
1745
  options.trace.push({ kind: "include", pieces, file: includeFile(node.path, basePath), ...spanOf(node, options.lines) });