@dogsbay/format-dogsbay-md 0.2.0-beta.9 → 0.2.0-beta.91
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/dist/attributes.d.ts +16 -1
- package/dist/attributes.d.ts.map +1 -1
- package/dist/attributes.js +14 -2
- package/dist/attributes.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +106 -7
- package/dist/cli.js.map +1 -1
- package/dist/directives.js +23 -1
- package/dist/directives.js.map +1 -1
- package/dist/escape.d.ts +29 -0
- package/dist/escape.d.ts.map +1 -1
- package/dist/escape.js +66 -1
- package/dist/escape.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inline.d.ts +17 -0
- package/dist/inline.d.ts.map +1 -1
- package/dist/inline.js +123 -6
- package/dist/inline.js.map +1 -1
- package/dist/nav-file.d.ts +24 -3
- package/dist/nav-file.d.ts.map +1 -1
- package/dist/nav-file.js +31 -11
- package/dist/nav-file.js.map +1 -1
- package/dist/nav.d.ts +7 -0
- package/dist/nav.d.ts.map +1 -1
- package/dist/nav.js +14 -2
- package/dist/nav.js.map +1 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +379 -6
- package/dist/parse.js.map +1 -1
- package/dist/plugin-containers.d.ts +1 -1
- package/dist/plugin-containers.d.ts.map +1 -1
- package/dist/plugin-containers.js +13 -0
- package/dist/plugin-containers.js.map +1 -1
- package/dist/renderers/diagrams.d.ts +25 -0
- package/dist/renderers/diagrams.d.ts.map +1 -0
- package/dist/renderers/diagrams.js +71 -0
- package/dist/renderers/diagrams.js.map +1 -0
- package/dist/renderers/mermaid.d.ts +24 -0
- package/dist/renderers/mermaid.d.ts.map +1 -0
- package/dist/renderers/mermaid.js +135 -0
- package/dist/renderers/mermaid.js.map +1 -0
- package/dist/serialize.js +85 -7
- package/dist/serialize.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -2
package/dist/attributes.d.ts
CHANGED
|
@@ -8,12 +8,27 @@
|
|
|
8
8
|
export interface RenderedAttrs {
|
|
9
9
|
id?: string;
|
|
10
10
|
classes?: string[];
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Props captured from `TreeNode.props`. Primitive values (string,
|
|
13
|
+
* number, boolean) round-trip through inline `{key="value"}` form.
|
|
14
|
+
* Arrays / plain objects are preserved here too — `renderAttrs`
|
|
15
|
+
* skips them (inline form can't represent them) but the
|
|
16
|
+
* directive renderer's `shouldUseYaml` branch picks them up and
|
|
17
|
+
* routes the directive to YAML body form, where complex values
|
|
18
|
+
* survive intact.
|
|
19
|
+
*/
|
|
20
|
+
props?: Record<string, unknown>;
|
|
12
21
|
}
|
|
13
22
|
/**
|
|
14
23
|
* Render an attribute block.
|
|
15
24
|
* Returns `{ #id .a .b key="value" }` or "" if no attrs.
|
|
16
25
|
* Leading space included so callers can append directly to content.
|
|
26
|
+
*
|
|
27
|
+
* Inline form can only carry primitive values. Arrays / objects in
|
|
28
|
+
* `props` are silently skipped here — the caller is expected to have
|
|
29
|
+
* already routed those to YAML body form (see `shouldUseYaml` in
|
|
30
|
+
* directives.ts). If a non-primitive does reach this point, dropping
|
|
31
|
+
* it is the safest fallback (there's no inline syntax for it).
|
|
17
32
|
*/
|
|
18
33
|
export declare function renderAttrs(attrs: RenderedAttrs): string;
|
|
19
34
|
/**
|
package/dist/attributes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CA6BxD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC1C,WAAW,GAAE,MAAM,EAAO,GACzB,aAAa,CAiCf"}
|
package/dist/attributes.js
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
* Render an attribute block.
|
|
10
10
|
* Returns `{ #id .a .b key="value" }` or "" if no attrs.
|
|
11
11
|
* Leading space included so callers can append directly to content.
|
|
12
|
+
*
|
|
13
|
+
* Inline form can only carry primitive values. Arrays / objects in
|
|
14
|
+
* `props` are silently skipped here — the caller is expected to have
|
|
15
|
+
* already routed those to YAML body form (see `shouldUseYaml` in
|
|
16
|
+
* directives.ts). If a non-primitive does reach this point, dropping
|
|
17
|
+
* it is the safest fallback (there's no inline syntax for it).
|
|
12
18
|
*/
|
|
13
19
|
export function renderAttrs(attrs) {
|
|
14
20
|
const parts = [];
|
|
@@ -29,6 +35,10 @@ export function renderAttrs(attrs) {
|
|
|
29
35
|
parts.push(key);
|
|
30
36
|
continue;
|
|
31
37
|
}
|
|
38
|
+
// Skip arrays / plain objects — inline form can't represent
|
|
39
|
+
// them. They survive via the YAML body branch upstream.
|
|
40
|
+
if (typeof value === "object")
|
|
41
|
+
continue;
|
|
32
42
|
parts.push(`${key}=${escapeAttrValue(String(value))}`);
|
|
33
43
|
}
|
|
34
44
|
}
|
|
@@ -71,8 +81,10 @@ export function splitProps(props, excludeKeys = []) {
|
|
|
71
81
|
}
|
|
72
82
|
if (value === null || value === undefined)
|
|
73
83
|
continue;
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
// Pass arrays / objects through. Inline-form rendering will skip
|
|
85
|
+
// them (`renderAttrs`); YAML-body rendering preserves them
|
|
86
|
+
// (`attrsToYaml`). The `shouldUseYaml` heuristic in directives.ts
|
|
87
|
+
// detects their presence and routes the directive accordingly.
|
|
76
88
|
cleanProps[key] = value;
|
|
77
89
|
}
|
|
78
90
|
if (Object.keys(cleanProps).length > 0) {
|
package/dist/attributes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,KAAoB;IAC9C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,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,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAE/B,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9C,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC;YAClB,SAAS;QACX,CAAC;QAED,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,WAAW,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC1E,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACpD,SAAS;QACX,CAAC;QAED,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QACpD,iEAAiE;QACjE,2DAA2D;QAC3D,kEAAkE;QAClE,+DAA+D;QAC/D,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAgC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAgC,MAAM,gBAAgB,CAAC;AAoOjF,eAAO,MAAM,MAAM,EAAE,YAiBpB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* Reads a directory of .md files, parses each via dogsbayMdToTree, builds nav
|
|
5
5
|
* from directory structure + frontmatter, returns ExportPage[] + NavItem[].
|
|
6
6
|
*/
|
|
7
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
8
|
-
import { join, relative, basename } from "node:path";
|
|
7
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join, relative, basename, dirname } from "node:path";
|
|
9
9
|
import { parseMeta } from "@dogsbay/types";
|
|
10
10
|
import { dogsbayMdToTree } from "./parse.js";
|
|
11
|
+
import { treeToDogsbayMd } from "./serialize.js";
|
|
11
12
|
import { buildNavFromDirectory } from "./nav.js";
|
|
13
|
+
import { renderDiagrams } from "./renderers/diagrams.js";
|
|
12
14
|
/**
|
|
13
15
|
* Detect whether a directory contains a Dogsbay MD source tree.
|
|
14
16
|
*
|
|
@@ -32,13 +34,28 @@ function detectDogsbayMdSource(path) {
|
|
|
32
34
|
}
|
|
33
35
|
function walkMdFiles(dir, root, out = []) {
|
|
34
36
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
37
|
+
// `_`-prefixed files/dirs are include targets (fragments), not routable
|
|
38
|
+
// pages — the standard Jekyll/Docusaurus convention. The build-time Minja
|
|
39
|
+
// preprocessor `{% include %}`s them into pages; they get no route of their
|
|
40
|
+
// own. (e.g. structural Docusaurus import writes `_includes/**` fragments.)
|
|
41
|
+
if (entry.name.startsWith("_"))
|
|
42
|
+
continue;
|
|
35
43
|
const full = join(dir, entry.name);
|
|
36
44
|
if (entry.isDirectory()) {
|
|
37
45
|
walkMdFiles(full, root, out);
|
|
38
46
|
}
|
|
39
47
|
else if (entry.name.endsWith(".md")) {
|
|
40
48
|
const rel = relative(root, full).replace(/\\/g, "/");
|
|
41
|
-
|
|
49
|
+
let slug = rel.replace(/\.md$/, "");
|
|
50
|
+
// A `<dir>/index.md` page is the directory's landing page: its slug
|
|
51
|
+
// is the directory, not `<dir>/index`. This MUST match how the nav
|
|
52
|
+
// layer normalizes the same file (nav-file.ts `fileToHref` strips
|
|
53
|
+
// `/index`), or `routablesFrom: nav`'s `filterPagesToNav` drops the
|
|
54
|
+
// page and the section landing 404s. The bare root `index.md` keeps
|
|
55
|
+
// slug `index` — format-astro's root-home + `.md`-mirror special-case
|
|
56
|
+
// keys off `slug === "index"`. See plans/dir-index-slug-nav-drop.md.
|
|
57
|
+
if (slug.endsWith("/index"))
|
|
58
|
+
slug = slug.slice(0, -"/index".length);
|
|
42
59
|
out.push({ filePath: full, slug });
|
|
43
60
|
}
|
|
44
61
|
}
|
|
@@ -61,22 +78,51 @@ async function importDogsbayMd(source, opts) {
|
|
|
61
78
|
const taxonomyNames = Array.isArray(opts.taxonomyNames)
|
|
62
79
|
? opts.taxonomyNames
|
|
63
80
|
: undefined;
|
|
81
|
+
// Pre-parse pass — opt-out via `diagrams: false`. When enabled
|
|
82
|
+
// (default), `code` fences with `lang: mermaid` get transformed
|
|
83
|
+
// to `diagram` nodes with pre-rendered SVG. Fail-open: if mmdc
|
|
84
|
+
// (mermaid-cli) isn't installed the code block is left as-is and
|
|
85
|
+
// a one-line warning is printed. See plans/mermaid-dogsbay-md.md.
|
|
86
|
+
const diagramsOn = opts.diagrams !== false;
|
|
64
87
|
for (const { filePath, slug } of files) {
|
|
65
88
|
const content = readFileSync(filePath, "utf-8");
|
|
66
89
|
const { tree, frontmatter } = dogsbayMdToTree(content);
|
|
90
|
+
if (diagramsOn) {
|
|
91
|
+
await renderDiagrams(tree);
|
|
92
|
+
}
|
|
67
93
|
const title = String(frontmatter.title
|
|
68
94
|
?? prettifyName(basename(slug)));
|
|
69
|
-
// Extract heading metadata for TOC
|
|
95
|
+
// Extract heading metadata for TOC AND backfill `node.props.slug`
|
|
96
|
+
// so format-astro's headingToAstro emits a matching `id` on the
|
|
97
|
+
// rendered `<h2>` / `<h3>`. Without this, the TOC's
|
|
98
|
+
// `<a href="#quick-start">` had nothing to scroll to — the
|
|
99
|
+
// heading was emitted without an id because the tree didn't
|
|
100
|
+
// carry the slug. Mirrors format-mkdocs/src/loader.ts:312.
|
|
101
|
+
//
|
|
102
|
+
// Duplicate slugs get `-1`, `-2` suffixes so two `## Foo`
|
|
103
|
+
// headings on the same page produce distinct anchors. Same
|
|
104
|
+
// collision-handling shape as MkDocs.
|
|
70
105
|
const headings = [];
|
|
106
|
+
const seen = new Map();
|
|
71
107
|
for (const node of tree) {
|
|
72
108
|
if (node.type === "heading" && node.inline) {
|
|
73
109
|
const text = node.inline
|
|
74
110
|
.map((n) => (n.type === "text" ? n.text : ""))
|
|
75
111
|
.join("")
|
|
76
112
|
.trim();
|
|
113
|
+
let slug = node.props?.slug;
|
|
114
|
+
if (!slug) {
|
|
115
|
+
const baseSlug = slugify(text);
|
|
116
|
+
const count = seen.get(baseSlug) ?? 0;
|
|
117
|
+
slug = count === 0 ? baseSlug : `${baseSlug}-${count}`;
|
|
118
|
+
seen.set(baseSlug, count + 1);
|
|
119
|
+
if (!node.props)
|
|
120
|
+
node.props = { level: 1 };
|
|
121
|
+
node.props.slug = slug;
|
|
122
|
+
}
|
|
77
123
|
headings.push({
|
|
78
124
|
depth: node.props?.level ?? 1,
|
|
79
|
-
slug
|
|
125
|
+
slug,
|
|
80
126
|
text,
|
|
81
127
|
});
|
|
82
128
|
}
|
|
@@ -95,7 +141,18 @@ async function importDogsbayMd(source, opts) {
|
|
|
95
141
|
}
|
|
96
142
|
const navFilePath = opts.nav || undefined;
|
|
97
143
|
const hrefPrefix = typeof opts.hrefPrefix === "string" ? opts.hrefPrefix : undefined;
|
|
98
|
-
|
|
144
|
+
// `--strict` at the CLI layer maps to "fail" here. `loadNavFile`
|
|
145
|
+
// already throws on the first miss in fail mode; the build
|
|
146
|
+
// surfaces the throw as a fatal error and exits non-zero.
|
|
147
|
+
// See plans/site-build-strict.md.
|
|
148
|
+
const missingNavTargets = opts.missingNavTargets === "fail"
|
|
149
|
+
? "fail"
|
|
150
|
+
: undefined;
|
|
151
|
+
const nav = buildNavFromDirectory(source, {
|
|
152
|
+
navFilePath,
|
|
153
|
+
hrefPrefix,
|
|
154
|
+
missingFile: missingNavTargets,
|
|
155
|
+
});
|
|
99
156
|
return { pages, nav };
|
|
100
157
|
}
|
|
101
158
|
function prettifyName(slug) {
|
|
@@ -111,10 +168,49 @@ function slugify(text) {
|
|
|
111
168
|
.trim()
|
|
112
169
|
.replace(/\s+/g, "-");
|
|
113
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Export ExportPage[] + nav to a directory of Dogsbay-MD files.
|
|
173
|
+
*
|
|
174
|
+
* Each page's tree is serialized via `treeToDogsbayMd` (which preserves any
|
|
175
|
+
* Minja directives via `escapePreservingMinja`) and written to `<output>/<slug>.md`.
|
|
176
|
+
*
|
|
177
|
+
* Fragment pages (`page.fragment`) are include targets, not routable pages:
|
|
178
|
+
* written with NO frontmatter, NO title, and excluded from nav — their identity
|
|
179
|
+
* is the include path. Mirrors migrate-asciidoc's fragment convention so the
|
|
180
|
+
* build-time Minja preprocessor can `{% include %}` them.
|
|
181
|
+
*/
|
|
182
|
+
async function exportDogsbayMd(pages, nav, output, opts) {
|
|
183
|
+
mkdirSync(output, { recursive: true });
|
|
184
|
+
// Copy mounted asset dirs (e.g. Docusaurus `static/`) into `content/_assets/`,
|
|
185
|
+
// the Dogsbay standard (docs/images.md). Preserves internal structure
|
|
186
|
+
// (static/img/x → <output>/_assets/img/x) so the parser's rewritten
|
|
187
|
+
// `/_assets/img/x` refs resolve, and a later `site build`'s asset pass copies
|
|
188
|
+
// `content/_assets/**` through to `/_assets/**`.
|
|
189
|
+
if (Array.isArray(opts.assetMounts)) {
|
|
190
|
+
const assetsRoot = join(output, "_assets");
|
|
191
|
+
for (const mount of opts.assetMounts) {
|
|
192
|
+
if (existsSync(mount.dir))
|
|
193
|
+
cpSync(mount.dir, assetsRoot, { recursive: true });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
for (const page of pages) {
|
|
197
|
+
const slug = page.slug || "index";
|
|
198
|
+
const outPath = join(output, `${slug}.md`);
|
|
199
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
200
|
+
const frontmatter = page.fragment || !page.title
|
|
201
|
+
? undefined
|
|
202
|
+
: { title: page.title, ...(page.redirect ? { redirect: page.redirect } : {}) };
|
|
203
|
+
const md = treeToDogsbayMd(page.tree, frontmatter ? { frontmatter } : undefined);
|
|
204
|
+
writeFileSync(outPath, md.endsWith("\n") ? md : md + "\n", "utf-8");
|
|
205
|
+
}
|
|
206
|
+
// Nav as nav.json at the content root (the dogsbay-md importer + runtime
|
|
207
|
+
// loader both prefer nav.json). Fragments never appear here.
|
|
208
|
+
writeFileSync(join(output, "nav.json"), JSON.stringify(nav, null, 2) + "\n", "utf-8");
|
|
209
|
+
}
|
|
114
210
|
export const plugin = {
|
|
115
211
|
name: "dogsbay-md",
|
|
116
212
|
canImport: true,
|
|
117
|
-
canExport:
|
|
213
|
+
canExport: true,
|
|
118
214
|
detectSource: detectDogsbayMdSource,
|
|
119
215
|
importOptions: [
|
|
120
216
|
{
|
|
@@ -125,5 +221,8 @@ export const plugin = {
|
|
|
125
221
|
async import(source, opts) {
|
|
126
222
|
return importDogsbayMd(source, opts);
|
|
127
223
|
},
|
|
224
|
+
async export(pages, nav, output, opts) {
|
|
225
|
+
return exportDogsbayMd(pages, nav, output, opts);
|
|
226
|
+
},
|
|
128
227
|
};
|
|
129
228
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[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OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,yEAAyE;IACzE,6DAA6D;IAC7D,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,IAAI,EAAE,YAAY;IAClB,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,qBAAqB;IACnC,aAAa,EAAE;QACb;YACE,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,2IAA2I;SACzJ;KACF;IACD,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,IAA6B;QACxD,OAAO,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI;QACnC,OAAO,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;CACF,CAAC"}
|
package/dist/directives.js
CHANGED
|
@@ -38,6 +38,17 @@ export function renderBlockDirective(input, ctx) {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Decide if a set of attributes warrants YAML body form.
|
|
41
|
+
*
|
|
42
|
+
* Forced when:
|
|
43
|
+
* - prop count exceeds the threshold (default 3),
|
|
44
|
+
* - any string value contains a newline (inline form normalises
|
|
45
|
+
* newlines to spaces, which loses author intent),
|
|
46
|
+
* - any value is a boolean (the inline shorthand `{flag}` parses
|
|
47
|
+
* as the empty string, not `true`, so booleans don't round-
|
|
48
|
+
* trip — caught during Phase 4 autodoc-directive tests), OR
|
|
49
|
+
* - any value is an array / object / nested structure (inline
|
|
50
|
+
* form has no syntax for those — without YAML they get
|
|
51
|
+
* dropped by `renderAttrs`).
|
|
41
52
|
*/
|
|
42
53
|
function shouldUseYaml(attrs, ctx) {
|
|
43
54
|
const propCount = (attrs.id ? 1 : 0) +
|
|
@@ -45,11 +56,22 @@ function shouldUseYaml(attrs, ctx) {
|
|
|
45
56
|
Object.keys(attrs.props ?? {}).length;
|
|
46
57
|
if (propCount > ctx.yamlThreshold)
|
|
47
58
|
return true;
|
|
48
|
-
// Multi-line or complex string values force YAML
|
|
49
59
|
if (attrs.props) {
|
|
50
60
|
for (const value of Object.values(attrs.props)) {
|
|
61
|
+
// Multi-line strings would lose their structure in inline form.
|
|
51
62
|
if (typeof value === "string" && value.includes("\n"))
|
|
52
63
|
return true;
|
|
64
|
+
// Booleans don't round-trip through the inline-attrs form —
|
|
65
|
+
// `{flag}` parses as "" (empty string). YAML preserves the
|
|
66
|
+
// type. Same logic applies to numbers in principle, but
|
|
67
|
+
// numbers do survive inline (parsed back as strings; consumers
|
|
68
|
+
// tolerate that). Booleans break consumers that check `=== true`.
|
|
69
|
+
if (typeof value === "boolean")
|
|
70
|
+
return true;
|
|
71
|
+
// Arrays / nested objects can't be expressed in inline form at
|
|
72
|
+
// all; only YAML body preserves them.
|
|
73
|
+
if (value !== null && typeof value === "object")
|
|
74
|
+
return true;
|
|
53
75
|
}
|
|
54
76
|
}
|
|
55
77
|
return false;
|
package/dist/directives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAsB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAkB,MAAM,WAAW,CAAC;AAgBvD;;;GA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K,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAoB;IACvC,MAAM,MAAM,GAA8B,EAAE,CAAC;IAC7C,IAAI,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACnC,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACvD,IAAI,KAAK,KAAK,SAAS;gBAAE,SAAS;YAClC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAkB,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/escape.d.ts
CHANGED
|
@@ -4,10 +4,39 @@
|
|
|
4
4
|
* Two rules drive everything here:
|
|
5
5
|
* 1. Content must round-trip through a markdown-it parser cleanly.
|
|
6
6
|
* 2. When ambiguous, prefer escaping — a reader never sees broken syntax.
|
|
7
|
+
*
|
|
8
|
+
* Dogsbay-MD is a SUPERSET of CommonMark: it includes Minja directives
|
|
9
|
+
* (`{{ var }}`, `{% if %}`, `{% include %}`, `{# comment #}`). Those
|
|
10
|
+
* directives have their own syntax and must NOT be escape-mangled —
|
|
11
|
+
* a path like `./_attributes/foo.md` inside `{% include "..." %}`
|
|
12
|
+
* has to survive as-is so the build-time preprocessor can resolve it.
|
|
13
|
+
* `escapePreservingMinja` is the seam: it splits text on directive
|
|
14
|
+
* boundaries, escapes only the prose segments, and leaves directives
|
|
15
|
+
* verbatim. Every text-escape entry point in this package is built
|
|
16
|
+
* on top of it.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Apply a per-segment escape function to text, treating Minja
|
|
20
|
+
* directives as opaque atoms that pass through verbatim.
|
|
21
|
+
*
|
|
22
|
+
* The shape:
|
|
23
|
+
* "Hello {{ name }} — see {% include \"path.md\" %} for details."
|
|
24
|
+
* ↓ split on directives
|
|
25
|
+
* ["Hello ", "{{ name }}", " — see ", "{% include \"path.md\" %}", " for details."]
|
|
26
|
+
* ↓ escape only non-directive segments
|
|
27
|
+
* [esc("Hello "), "{{ name }}", esc(" — see "), "{% include \"path.md\" %}", esc(" for details.")]
|
|
28
|
+
* ↓ join
|
|
29
|
+
* "Hello {{ name }} — see {% include \"path.md\" %} for details."
|
|
30
|
+
*
|
|
31
|
+
* Text with no directives short-circuits to a single escape call,
|
|
32
|
+
* so the fast path is unchanged for the common case.
|
|
7
33
|
*/
|
|
34
|
+
export declare function escapePreservingMinja(text: string, escape: (segment: string) => string): string;
|
|
8
35
|
/**
|
|
9
36
|
* Escape markdown-active characters in text content.
|
|
10
37
|
* Only escapes what would change parsing; leaves everything else alone.
|
|
38
|
+
* Minja directives (`{{ … }}`, `{% … %}`, `{# … #}`) pass through
|
|
39
|
+
* verbatim — see escapePreservingMinja.
|
|
11
40
|
*/
|
|
12
41
|
export declare function escapeText(text: string): string;
|
|
13
42
|
/**
|
package/dist/escape.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../src/escape.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../src/escape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAClC,MAAM,CAkBR;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAQD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,GAAG,GAAG,GAAS,GAC7B,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnE"}
|
package/dist/escape.js
CHANGED
|
@@ -4,13 +4,78 @@
|
|
|
4
4
|
* Two rules drive everything here:
|
|
5
5
|
* 1. Content must round-trip through a markdown-it parser cleanly.
|
|
6
6
|
* 2. When ambiguous, prefer escaping — a reader never sees broken syntax.
|
|
7
|
+
*
|
|
8
|
+
* Dogsbay-MD is a SUPERSET of CommonMark: it includes Minja directives
|
|
9
|
+
* (`{{ var }}`, `{% if %}`, `{% include %}`, `{# comment #}`). Those
|
|
10
|
+
* directives have their own syntax and must NOT be escape-mangled —
|
|
11
|
+
* a path like `./_attributes/foo.md` inside `{% include "..." %}`
|
|
12
|
+
* has to survive as-is so the build-time preprocessor can resolve it.
|
|
13
|
+
* `escapePreservingMinja` is the seam: it splits text on directive
|
|
14
|
+
* boundaries, escapes only the prose segments, and leaves directives
|
|
15
|
+
* verbatim. Every text-escape entry point in this package is built
|
|
16
|
+
* on top of it.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Matches a complete Minja directive:
|
|
20
|
+
* - `{{ … }}` variable / filter pipeline
|
|
21
|
+
* - `{% … %}` block (if / endif / for / set / include / raw / …)
|
|
22
|
+
* - `{# … #}` comment
|
|
23
|
+
*
|
|
24
|
+
* Lazy match (`*?`) terminates at the FIRST closing delimiter, which
|
|
25
|
+
* matches Minja's grammar — directives can't legitimately nest by
|
|
26
|
+
* the same delimiter. `[\s\S]` so multi-line directives are handled
|
|
27
|
+
* (e.g. `{% if x %}\n…\n{% endif %}` is two separate matches; the
|
|
28
|
+
* inner content isn't a single directive).
|
|
29
|
+
*/
|
|
30
|
+
const MINJA_DIRECTIVE_RE = /\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}|\{#[\s\S]*?#\}/g;
|
|
31
|
+
/**
|
|
32
|
+
* Apply a per-segment escape function to text, treating Minja
|
|
33
|
+
* directives as opaque atoms that pass through verbatim.
|
|
34
|
+
*
|
|
35
|
+
* The shape:
|
|
36
|
+
* "Hello {{ name }} — see {% include \"path.md\" %} for details."
|
|
37
|
+
* ↓ split on directives
|
|
38
|
+
* ["Hello ", "{{ name }}", " — see ", "{% include \"path.md\" %}", " for details."]
|
|
39
|
+
* ↓ escape only non-directive segments
|
|
40
|
+
* [esc("Hello "), "{{ name }}", esc(" — see "), "{% include \"path.md\" %}", esc(" for details.")]
|
|
41
|
+
* ↓ join
|
|
42
|
+
* "Hello {{ name }} — see {% include \"path.md\" %} for details."
|
|
43
|
+
*
|
|
44
|
+
* Text with no directives short-circuits to a single escape call,
|
|
45
|
+
* so the fast path is unchanged for the common case.
|
|
7
46
|
*/
|
|
47
|
+
export function escapePreservingMinja(text, escape) {
|
|
48
|
+
// Fast path: no directive opener anywhere → straight escape.
|
|
49
|
+
if (!text.includes("{{") && !text.includes("{%") && !text.includes("{#")) {
|
|
50
|
+
return escape(text);
|
|
51
|
+
}
|
|
52
|
+
const parts = [];
|
|
53
|
+
let lastEnd = 0;
|
|
54
|
+
// matchAll iterates left-to-right with global flag; safe to reset
|
|
55
|
+
// via fresh exec context per call (regex is stateless when used
|
|
56
|
+
// this way).
|
|
57
|
+
for (const match of text.matchAll(MINJA_DIRECTIVE_RE)) {
|
|
58
|
+
const start = match.index ?? 0;
|
|
59
|
+
if (start > lastEnd)
|
|
60
|
+
parts.push(escape(text.slice(lastEnd, start)));
|
|
61
|
+
parts.push(match[0]);
|
|
62
|
+
lastEnd = start + match[0].length;
|
|
63
|
+
}
|
|
64
|
+
if (lastEnd < text.length)
|
|
65
|
+
parts.push(escape(text.slice(lastEnd)));
|
|
66
|
+
return parts.join("");
|
|
67
|
+
}
|
|
8
68
|
/**
|
|
9
69
|
* Escape markdown-active characters in text content.
|
|
10
70
|
* Only escapes what would change parsing; leaves everything else alone.
|
|
71
|
+
* Minja directives (`{{ … }}`, `{% … %}`, `{# … #}`) pass through
|
|
72
|
+
* verbatim — see escapePreservingMinja.
|
|
11
73
|
*/
|
|
12
74
|
export function escapeText(text) {
|
|
13
|
-
return text
|
|
75
|
+
return escapePreservingMinja(text, escapeTextSegment);
|
|
76
|
+
}
|
|
77
|
+
function escapeTextSegment(segment) {
|
|
78
|
+
return segment
|
|
14
79
|
.replace(/\\/g, "\\\\")
|
|
15
80
|
.replace(/([*_`~[\]()<>#|{}])/g, "\\$1");
|
|
16
81
|
}
|
package/dist/escape.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../src/escape.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../src/escape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,kBAAkB,GACtB,iDAAiD,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,MAAmC;IAEnC,6DAA6D;IAC7D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,I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;AACH,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,MAAc;IACpD,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,OAAO;SACX,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACpD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAe;IACzD,OAAO,OAAO;SACX,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,8 @@ export type { ParseResult, ParseOptions } from "./parse.js";
|
|
|
6
6
|
export { buildNavFromDirectory } from "./nav.js";
|
|
7
7
|
export type { BuildNavOptions } from "./nav.js";
|
|
8
8
|
export { loadNavFile } from "./nav-file.js";
|
|
9
|
-
export type { NavFile, NavFileItem, LoadNavFileOptions } from "./nav-file.js";
|
|
9
|
+
export type { NavFile, NavFileItem, LoadNavFileOptions, MissingNavTarget, } from "./nav-file.js";
|
|
10
|
+
export { renderDiagrams } from "./renderers/diagrams.js";
|
|
11
|
+
export type { RenderDiagramsOptions } from "./renderers/diagrams.js";
|
|
12
|
+
export { renderMermaidSvg, setMmdcOverride, findMmdc } from "./renderers/mermaid.js";
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAA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7,4 +7,6 @@ export { inlineToDogsbayMd } from "./inline.js";
|
|
|
7
7
|
export { dogsbayMdToTree, parseInline } from "./parse.js";
|
|
8
8
|
export { buildNavFromDirectory } from "./nav.js";
|
|
9
9
|
export { loadNavFile } from "./nav-file.js";
|
|
10
|
+
export { renderDiagrams } from "./renderers/diagrams.js";
|
|
11
|
+
export { renderMermaidSvg, setMmdcOverride, findMmdc } from "./renderers/mermaid.js";
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kDAAkD;AAClD,mCAAmC;AAEnC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kDAAkD;AAClD,mCAAmC;AAEnC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/inline.d.ts
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
import type { InlineNode } from "@dogsbay/types";
|
|
5
5
|
/**
|
|
6
6
|
* Serialize a flat array of inline nodes to markdown.
|
|
7
|
+
*
|
|
8
|
+
* Stack-based emit: maintains a stack of currently-open formatting
|
|
9
|
+
* marks and, between successive text nodes, opens/closes only the
|
|
10
|
+
* delta between current-stack and desired-formats. This produces:
|
|
11
|
+
*
|
|
12
|
+
* - `*foo bar*` (not `*foo** **bar*`) for sibling italic text runs,
|
|
13
|
+
* fixing the multi-line-emphasis case where the parser splits
|
|
14
|
+
* `*a\nb*` into three italic text nodes.
|
|
15
|
+
* - `*foo \`code\` bar*` (not `*foo*\`code\`*bar*`) for italic
|
|
16
|
+
* text bracketing inline code — non-text nodes don't disturb the
|
|
17
|
+
* open-format stack, so the wrapper stays open across them.
|
|
18
|
+
* - `**This is *not* news.**` (not `**This is *****not***** news.**`)
|
|
19
|
+
* for bold-around-italic — only italic opens/closes between the
|
|
20
|
+
* three text spans; the outer bold stays open the whole time.
|
|
21
|
+
*
|
|
22
|
+
* Round-trip stable on every case validated against the parser's
|
|
23
|
+
* output (see roundtrip.test.ts).
|
|
7
24
|
*/
|
|
8
25
|
export declare function inlineToDogsbayMd(nodes: InlineNode[] | undefined): string;
|
|
9
26
|
//# sourceMappingURL=inline.d.ts.map
|
package/dist/inline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../src/inline.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../src/inline.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAe,UAAU,EAAY,MAAM,gBAAgB,CAAC;AAiBxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,GAAG,MAAM,CA2CzE"}
|