@forumulate/cli 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.
- package/README.md +8 -0
- package/dist/api/operations.json +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +16 -0
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/groups-site.d.ts.map +1 -1
- package/dist/commands/groups-site.js +15 -8
- package/dist/commands/groups-site.js.map +1 -1
- package/dist/dev/command.d.ts +41 -0
- package/dist/dev/command.d.ts.map +1 -0
- package/dist/dev/command.js +158 -0
- package/dist/dev/command.js.map +1 -0
- package/dist/help.d.ts +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +17 -0
- package/dist/help.js.map +1 -1
- package/dist/publish/api.d.ts +30 -12
- package/dist/publish/api.d.ts.map +1 -1
- package/dist/publish/api.js +62 -10
- package/dist/publish/api.js.map +1 -1
- package/dist/publish/client.d.ts +19 -0
- package/dist/publish/client.d.ts.map +1 -0
- package/dist/publish/client.js +3 -0
- package/dist/publish/client.js.map +1 -0
- package/dist/publish/command.d.ts +31 -2
- package/dist/publish/command.d.ts.map +1 -1
- package/dist/publish/command.js +62 -15
- package/dist/publish/command.js.map +1 -1
- package/dist/publish/context.d.ts +4 -1
- package/dist/publish/context.d.ts.map +1 -1
- package/dist/publish/context.js.map +1 -1
- package/dist/publish/diff.d.ts +21 -0
- package/dist/publish/diff.d.ts.map +1 -0
- package/dist/publish/diff.js +96 -0
- package/dist/publish/diff.js.map +1 -0
- package/dist/publish/docs-apply.d.ts +8 -1
- package/dist/publish/docs-apply.d.ts.map +1 -1
- package/dist/publish/docs-apply.js +37 -10
- package/dist/publish/docs-apply.js.map +1 -1
- package/dist/publish/docs-plan.d.ts +16 -3
- package/dist/publish/docs-plan.d.ts.map +1 -1
- package/dist/publish/docs-plan.js +57 -6
- package/dist/publish/docs-plan.js.map +1 -1
- package/dist/publish/frontmatter.d.ts +1 -1
- package/dist/publish/frontmatter.d.ts.map +1 -1
- package/dist/publish/frontmatter.js +1 -0
- package/dist/publish/frontmatter.js.map +1 -1
- package/dist/publish/index.d.ts +12 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js +17 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/publish/manifest.d.ts.map +1 -1
- package/dist/publish/manifest.js +23 -3
- package/dist/publish/manifest.js.map +1 -1
- package/dist/publish/names.d.ts +28 -0
- package/dist/publish/names.d.ts.map +1 -0
- package/dist/publish/names.js +80 -0
- package/dist/publish/names.js.map +1 -0
- package/dist/publish/posts.d.ts.map +1 -1
- package/dist/publish/posts.js +46 -13
- package/dist/publish/posts.js.map +1 -1
- package/dist/publish/reserved.d.ts +49 -0
- package/dist/publish/reserved.d.ts.map +1 -0
- package/dist/publish/reserved.js +118 -0
- package/dist/publish/reserved.js.map +1 -0
- package/dist/publish/rewrite.d.ts +12 -0
- package/dist/publish/rewrite.d.ts.map +1 -1
- package/dist/publish/rewrite.js +22 -0
- package/dist/publish/rewrite.js.map +1 -1
- package/dist/publish/scan-docs.d.ts +10 -0
- package/dist/publish/scan-docs.d.ts.map +1 -0
- package/dist/publish/scan-docs.js +160 -0
- package/dist/publish/scan-docs.js.map +1 -0
- package/dist/publish/scan.d.ts +21 -17
- package/dist/publish/scan.d.ts.map +1 -1
- package/dist/publish/scan.js +99 -232
- package/dist/publish/scan.js.map +1 -1
- package/dist/publish/slots.d.ts +39 -0
- package/dist/publish/slots.d.ts.map +1 -0
- package/dist/publish/slots.js +64 -0
- package/dist/publish/slots.js.map +1 -0
- package/dist/publish/tags.d.ts +9 -0
- package/dist/publish/tags.d.ts.map +1 -0
- package/dist/publish/tags.js +194 -0
- package/dist/publish/tags.js.map +1 -0
- package/dist/publish/types.d.ts +62 -0
- package/dist/publish/types.d.ts.map +1 -1
- package/dist/publish/types.js +0 -10
- package/dist/publish/types.js.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +79 -32
- package/dist/run.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/publish/rewrite.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CA0BR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAcnF;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E"}
|
|
1
|
+
{"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/publish/rewrite.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CA0BR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAcnF;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACrC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzB,QAAQ,EAAE,MAAM,GACf,OAAO,CAOT"}
|
package/dist/publish/rewrite.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.rewriteLinks = rewriteLinks;
|
|
4
4
|
exports.rewriteAssets = rewriteAssets;
|
|
5
5
|
exports.rewriteValue = rewriteValue;
|
|
6
|
+
exports.mediaChanged = mediaChanged;
|
|
6
7
|
const node_path_1 = require("node:path");
|
|
7
8
|
/**
|
|
8
9
|
* What changes between the file on disk and the text the API is sent.
|
|
@@ -79,4 +80,25 @@ function rewriteValue(value, urlByRef) {
|
|
|
79
80
|
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, rewriteValue(v, urlByRef)]));
|
|
80
81
|
return value;
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Does the live text still point at every picture the file's body uses?
|
|
85
|
+
*
|
|
86
|
+
* The word comparison (`compare.ts`) ignores link and image targets on
|
|
87
|
+
* purpose — the importer rewrites them, so they are never the same string
|
|
88
|
+
* twice. That left one change invisible: an image replaced by a new one under
|
|
89
|
+
* the same name uploads under a new content hash, and the post kept pointing
|
|
90
|
+
* at the old picture because its words had not changed. So the targets are
|
|
91
|
+
* checked here instead, by the URL each reference resolves to: one that is
|
|
92
|
+
* not uploaded yet, or not in the live text, means the body must be sent.
|
|
93
|
+
*/
|
|
94
|
+
function mediaChanged(body, refs, urls, liveText) {
|
|
95
|
+
for (const ref of refs?.keys() ?? []) {
|
|
96
|
+
if (!body.includes(ref))
|
|
97
|
+
continue; // a front-matter value: compared as a field
|
|
98
|
+
const url = urls.get(ref);
|
|
99
|
+
if (!url || !liveText.includes(url))
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
82
104
|
//# sourceMappingURL=rewrite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../src/publish/rewrite.ts"],"names":[],"mappings":";;AA2BA,oCA8BC;AAMD,sCAcC;AAGD,oCAQC;
|
|
1
|
+
{"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../src/publish/rewrite.ts"],"names":[],"mappings":";;AA2BA,oCA8BC;AAMD,sCAcC;AAGD,oCAQC;AAaD,oCAYC;AAjHD,yCAAkC;AAElC;;;;;;;;;GASG;AAEH,gEAAgE;AAChE,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,SAAgB,YAAY,CAC1B,MAAc,EACd,IAAY,EACZ,UAA+B;IAE/B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,MAAM,GAAG,CAAC,GAAW,EAAiB,EAAE;QAC5C,MAAM,CAAC,GAAG,yEAAyE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9F,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACpB,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,iBAAK,CAAC,SAAS,CAAC,iBAAK,CAAC,IAAI,CAAC,iBAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI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4CAA4C;QAC/E,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DocsWalk, Reader, ScanResult, SpaceSpec } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The docs half of reading a folder: one top-level folder per collection,
|
|
4
|
+
* files at the root in the root collection, nested folders as parent pages
|
|
5
|
+
* (the folder's `index.md` — or `README.md`, unless the space says
|
|
6
|
+
* `readme: skip` — is the parent; a folder without one gets a title-only stub
|
|
7
|
+
* so its children still have somewhere to hang).
|
|
8
|
+
*/
|
|
9
|
+
export declare function scanDocs(absDir: string, spec: SpaceSpec, out: ScanResult, read: Reader, w: DocsWalk): void;
|
|
10
|
+
//# sourceMappingURL=scan-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-docs.d.ts","sourceRoot":"","sources":["../../src/publish/scan-docs.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,QAAQ,GACV,IAAI,CA8BN"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanDocs = scanDocs;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const yaml_1 = require("yaml");
|
|
7
|
+
const frontmatter_1 = require("./frontmatter");
|
|
8
|
+
const names_1 = require("./names");
|
|
9
|
+
const slots_1 = require("./slots");
|
|
10
|
+
/**
|
|
11
|
+
* The docs half of reading a folder: one top-level folder per collection,
|
|
12
|
+
* files at the root in the root collection, nested folders as parent pages
|
|
13
|
+
* (the folder's `index.md` — or `README.md`, unless the space says
|
|
14
|
+
* `readme: skip` — is the parent; a folder without one gets a title-only stub
|
|
15
|
+
* so its children still have somewhere to hang).
|
|
16
|
+
*/
|
|
17
|
+
function scanDocs(absDir, spec, out, read, w) {
|
|
18
|
+
const rootName = spec.rootCollection ?? '';
|
|
19
|
+
const rootFiles = [];
|
|
20
|
+
const folders = [];
|
|
21
|
+
for (const e of (0, node_fs_1.readdirSync)(absDir).sort()) {
|
|
22
|
+
if (w.skip(absDir, e))
|
|
23
|
+
continue;
|
|
24
|
+
const abs = (0, node_path_1.join)(absDir, e);
|
|
25
|
+
if ((0, node_fs_1.statSync)(abs).isDirectory()) {
|
|
26
|
+
if (w.hasMarkdown(abs))
|
|
27
|
+
folders.push(e);
|
|
28
|
+
}
|
|
29
|
+
else if (names_1.MD.test(e))
|
|
30
|
+
rootFiles.push(e);
|
|
31
|
+
}
|
|
32
|
+
if (rootFiles.length) {
|
|
33
|
+
out.collections.push(collectionOf(absDir, '', rootName ? (0, names_1.slugify)(rootName) : '', rootName, [-1, ''], {}, out, read, w, rootFiles));
|
|
34
|
+
}
|
|
35
|
+
for (const name of folders) {
|
|
36
|
+
const abs = (0, node_path_1.join)(absDir, name);
|
|
37
|
+
const declared = { ...folderMeta(abs), ...(spec.collections?.[name] ?? {}) };
|
|
38
|
+
const [n, key] = (0, names_1.prefixOrder)(name);
|
|
39
|
+
const order = [typeof declared.order === 'number' ? declared.order : n, key];
|
|
40
|
+
const slug = typeof declared.slug === 'string'
|
|
41
|
+
? (0, names_1.slugify)(declared.slug)
|
|
42
|
+
: (0, names_1.slugify)(name.replace(names_1.NUMERIC, ''));
|
|
43
|
+
const title = typeof declared.name === 'string' ? declared.name : (0, names_1.titleize)(name);
|
|
44
|
+
const nav = (declared.nav ?? undefined);
|
|
45
|
+
out.collections.push(collectionOf(abs, name, slug, title, order, nav, out, read, w));
|
|
46
|
+
}
|
|
47
|
+
out.collections.sort((a, b) => a.order[0] - b.order[0] || a.order[1].localeCompare(b.order[1]));
|
|
48
|
+
}
|
|
49
|
+
/** `_collection.yml` / `.yaml` / `.json` beside a collection's files. */
|
|
50
|
+
function folderMeta(dir) {
|
|
51
|
+
for (const n of ['_collection.yml', '_collection.yaml', '_collection.json']) {
|
|
52
|
+
const p = (0, node_path_1.join)(dir, n);
|
|
53
|
+
if ((0, node_fs_1.existsSync)(p))
|
|
54
|
+
return ((0, yaml_1.parse)((0, node_fs_1.readFileSync)(p, 'utf8')) ?? {});
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
function collectionOf(abs, dir, slug, name, order, nav, out, read, w, onlyFiles) {
|
|
59
|
+
const col = { dir, slug, name, order, nav, pages: [] };
|
|
60
|
+
/**
|
|
61
|
+
* Walk one folder. `own` is the page that stands for this folder (its files
|
|
62
|
+
* nest under it; null at the collection's top) and `above` is the page that
|
|
63
|
+
* one nests under — which is where the folder's own index file hangs.
|
|
64
|
+
*/
|
|
65
|
+
const walk = (folder, rel, own, above) => {
|
|
66
|
+
const entries = (onlyFiles ?? (0, node_fs_1.readdirSync)(folder).sort()).filter((e) => !w.skip(folder, e));
|
|
67
|
+
const files = entries.filter((e) => names_1.MD.test(e) && !(0, node_fs_1.statSync)((0, node_path_1.join)(folder, e)).isDirectory());
|
|
68
|
+
const dirs = onlyFiles
|
|
69
|
+
? []
|
|
70
|
+
: entries.filter((e) => (0, node_fs_1.statSync)((0, node_path_1.join)(folder, e)).isDirectory() && w.hasMarkdown((0, node_path_1.join)(folder, e)));
|
|
71
|
+
const index = rel ? files.find(w.isIndex) : undefined;
|
|
72
|
+
for (const f of files) {
|
|
73
|
+
const parentSlug = f === index ? above : own;
|
|
74
|
+
const where = { importName: rel ? `${rel}/${f}` : f, rel, isFolderIndex: f === index };
|
|
75
|
+
const page = pageOf((0, node_path_1.join)(folder, f), where, parentSlug, slug, out, read, w);
|
|
76
|
+
if (page)
|
|
77
|
+
col.pages.push(page);
|
|
78
|
+
}
|
|
79
|
+
for (const d of dirs) {
|
|
80
|
+
const sub = (0, node_path_1.join)(folder, d);
|
|
81
|
+
const subRel = rel ? `${rel}/${d}` : d;
|
|
82
|
+
const subFiles = (0, node_fs_1.readdirSync)(sub).filter((e) => !w.skip(sub, e) && names_1.MD.test(e));
|
|
83
|
+
const subIndex = subFiles.find(w.isIndex);
|
|
84
|
+
let folderSlug;
|
|
85
|
+
if (subIndex) {
|
|
86
|
+
// The index decides the folder page's address; read it once for that.
|
|
87
|
+
const { data } = (0, frontmatter_1.splitFront)((0, node_fs_1.readFileSync)((0, node_path_1.join)(sub, subIndex), 'utf8'));
|
|
88
|
+
folderSlug =
|
|
89
|
+
typeof data.slug === 'string' && data.slug.trim()
|
|
90
|
+
? (0, names_1.slugify)(data.slug)
|
|
91
|
+
: (0, names_1.slugify)(d.replace(names_1.NUMERIC, ''));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
folderSlug = (0, names_1.slugify)(d.replace(names_1.NUMERIC, ''));
|
|
95
|
+
const title = (0, names_1.titleize)(d);
|
|
96
|
+
col.pages.push({
|
|
97
|
+
file: `${(0, node_path_1.relative)(out.absDir, sub).split(node_path_1.sep).join('/')}/ (no index.md)`,
|
|
98
|
+
importName: `${subRel}/index.md`,
|
|
99
|
+
slug: folderSlug,
|
|
100
|
+
parentSlug: own,
|
|
101
|
+
order: (0, names_1.prefixOrder)(d),
|
|
102
|
+
title,
|
|
103
|
+
source: `---\ntitle: ${JSON.stringify(title)}\nslug: ${folderSlug}\n---\n`,
|
|
104
|
+
body: '',
|
|
105
|
+
meta: {},
|
|
106
|
+
unknown: [],
|
|
107
|
+
sections: {},
|
|
108
|
+
stub: true,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
walk(sub, subRel, folderSlug, own);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
walk(abs, '', null, null);
|
|
115
|
+
return col;
|
|
116
|
+
}
|
|
117
|
+
function pageOf(abs, where, parentSlug, collectionSlug, out, read, w) {
|
|
118
|
+
const { importName, rel, isFolderIndex } = where;
|
|
119
|
+
const f = read(abs);
|
|
120
|
+
const name = (0, node_path_1.basename)(abs);
|
|
121
|
+
const stem = name.replace(names_1.MD, '');
|
|
122
|
+
const declaredSlug = typeof f.data.slug === 'string' && f.data.slug.trim() ? (0, names_1.slugify)(f.data.slug) : '';
|
|
123
|
+
const folder = node_path_1.posix.basename(rel);
|
|
124
|
+
const atCollectionTop = w.isIndex(name) && !rel;
|
|
125
|
+
const slug = declaredSlug ||
|
|
126
|
+
(isFolderIndex
|
|
127
|
+
? (0, names_1.slugify)(folder.replace(names_1.NUMERIC, ''))
|
|
128
|
+
: atCollectionTop
|
|
129
|
+
? collectionSlug || (0, names_1.slugify)((0, names_1.titleOf)(f.data, f.body, 'overview'))
|
|
130
|
+
: (0, names_1.slugify)(stem.replace(names_1.NUMERIC, '')));
|
|
131
|
+
if ((0, frontmatter_1.isDraft)(f.data)) {
|
|
132
|
+
// Remembered by slug: a draft is never written, and never pruned either.
|
|
133
|
+
out.drafts.add(slug);
|
|
134
|
+
out.warnings.push(`${f.rel}: draft — left out (and kept if it is live)`);
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
// Slots first: `short-answer:` on an FAQ question is a slot, not an unknown key.
|
|
138
|
+
const slotted = (0, slots_1.pageSlots)(f.data, f.body, w.slots);
|
|
139
|
+
const { meta, unknown } = (0, frontmatter_1.pageMeta)(slotted.rest, w.fieldKeys);
|
|
140
|
+
const n = (0, frontmatter_1.declaredOrder)(f.data);
|
|
141
|
+
const [prefixN, key] = (0, names_1.prefixOrder)(isFolderIndex ? folder : stem);
|
|
142
|
+
// A folder's index is ordered among the folder's siblings, by the folder's
|
|
143
|
+
// prefix; a collection's own index leads it unless it says otherwise.
|
|
144
|
+
const order = [n ?? (atCollectionTop ? -1 : prefixN), key];
|
|
145
|
+
out.slugByFile.set(f.rel, slug);
|
|
146
|
+
return {
|
|
147
|
+
file: f.rel,
|
|
148
|
+
importName,
|
|
149
|
+
slug,
|
|
150
|
+
parentSlug,
|
|
151
|
+
order,
|
|
152
|
+
title: (0, names_1.titleOf)(f.data, f.body, slug),
|
|
153
|
+
source: f.text,
|
|
154
|
+
body: f.body,
|
|
155
|
+
meta,
|
|
156
|
+
unknown: [...unknown, ...slotted.notes],
|
|
157
|
+
sections: slotted.sections,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=scan-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-docs.js","sourceRoot":"","sources":["../../src/publish/scan-docs.ts"],"names":[],"mappings":";;AAeA,4BAoCC;AAnDD,qCAA0E;AAC1E,yCAAiE;AACjE,+BAA0C;AAC1C,+CAA6E;AAC7E,mCAA+E;AAC/E,mCAAoC;AAGpC;;;;;;GAMG;AACH,SAAgB,QAAQ,CACtB,MAAc,EACd,IAAe,EACf,GAAe,EACf,IAAY,EACZ,CAAW;IAEX,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;IAC3C,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,IAAA,qBAAW,EAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3C,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAAE,SAAS;QAChC,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5B,IAAI,IAAA,kBAAQ,EAAC,GAAG,CAAC,CAAC,WAAW,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Z,IAAI;QACJ,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;QACvC,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC"}
|
package/dist/publish/scan.d.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare function slugify(input: string, fallback?: string, max?: number): string;
|
|
1
|
+
import { MANIFEST_NAMES } from './reserved';
|
|
2
|
+
import type { Slot } from './slots';
|
|
3
|
+
import type { ScanResult, SpaceSpec } from './types';
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* A folder on disk, read into what it would publish.
|
|
6
|
+
*
|
|
7
|
+
* Docs are walked in `scan-docs.ts` (collections, nesting, folder pages).
|
|
8
|
+
* Everything else — blog, changelog, any type whose pieces are posts — is a
|
|
9
|
+
* flat set of posts, folders or not. Both go through the same skip rules
|
|
10
|
+
* (`reserved.ts`) and the same reader, which records the local files each
|
|
11
|
+
* document points at for upload.
|
|
10
12
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
13
|
+
export { slugify, tagKey, titleize } from './names';
|
|
14
|
+
export type { ScanResult } from './types';
|
|
15
|
+
export type { ScanShape };
|
|
16
|
+
export { MANIFEST_NAMES };
|
|
17
|
+
/** What the space's type declares, as far as reading a folder needs it. */
|
|
18
|
+
interface ScanShape {
|
|
19
|
+
/** Declared parameters (`audience`, `topic`, …): front matter keys that go to `fields`. */
|
|
20
|
+
fieldKeys: string[];
|
|
21
|
+
/** Declared slots of a page-backed type, for front matter that fills them. */
|
|
22
|
+
slots?: Slot[];
|
|
19
23
|
}
|
|
20
24
|
/** Read one space folder. `kind` decides whether its files are pages or posts. */
|
|
21
|
-
export declare function scanSpace(root: string, spec: SpaceSpec, kind: 'docs' | 'posts',
|
|
25
|
+
export declare function scanSpace(root: string, spec: SpaceSpec, kind: 'docs' | 'posts', shape: ScanShape | string[]): ScanResult;
|
|
22
26
|
/** Every relative path → posix, for comparing with `importName`s. */
|
|
23
27
|
export declare const toPosix: (p: string) => string;
|
|
24
28
|
export declare const extOf: (p: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/publish/scan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/publish/scan.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,cAAc,EAAkB,MAAM,YAAY,CAAC;AAErF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAU,UAAU,EAAE,SAAS,EAAW,MAAM,SAAS,CAAC;AAEtE;;;;;;;;GAQG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;AAkG1B,2EAA2E;AAC3E,UAAU,SAAS;IACjB,2FAA2F;IAC3F,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,GAAG,OAAO,EACtB,KAAK,EAAE,SAAS,GAAG,MAAM,EAAE,GAC1B,UAAU,CAiDZ;AAgDD,qEAAqE;AACrE,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,WAA2B,CAAC;AAC7D,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,WAA6B,CAAC"}
|