@jpmorganchase/mosaic-plugins 0.1.0-beta.4 → 0.1.0-beta.40
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/$AliasPlugin.d.ts +10 -0
- package/dist/$AliasPlugin.js +43 -63
- package/dist/$AliasPlugin.js.map +1 -1
- package/dist/$CodeModPlugin.d.ts +7 -0
- package/dist/$CodeModPlugin.js +19 -37
- package/dist/$CodeModPlugin.js.map +1 -1
- package/dist/$RefPlugin.d.ts +31 -0
- package/dist/$RefPlugin.js +108 -128
- package/dist/$RefPlugin.js.map +1 -1
- package/dist/$TagPlugin.d.ts +28 -0
- package/dist/$TagPlugin.js +49 -74
- package/dist/$TagPlugin.js.map +1 -1
- package/dist/BreadcrumbsPlugin.d.ts +18 -0
- package/dist/BreadcrumbsPlugin.js +23 -33
- package/dist/BreadcrumbsPlugin.js.map +1 -1
- package/dist/BrokenLinksPlugin.d.ts +10 -0
- package/dist/BrokenLinksPlugin.js +80 -0
- package/dist/BrokenLinksPlugin.js.map +1 -0
- package/dist/FragmentPlugin.d.ts +7 -0
- package/dist/FragmentPlugin.js +86 -0
- package/dist/FragmentPlugin.js.map +1 -0
- package/dist/LazyPagePlugin.d.ts +14 -0
- package/dist/LazyPagePlugin.js +55 -87
- package/dist/LazyPagePlugin.js.map +1 -1
- package/dist/LocalFolderSavePlugin.d.ts +6 -0
- package/dist/LocalFolderSavePlugin.js +21 -0
- package/dist/LocalFolderSavePlugin.js.map +1 -0
- package/dist/PagesWithoutFileExtPlugin.d.ts +9 -0
- package/dist/PagesWithoutFileExtPlugin.js +18 -36
- package/dist/PagesWithoutFileExtPlugin.js.map +1 -1
- package/dist/PropsTablePlugin.d.ts +6 -0
- package/dist/PropsTablePlugin.js +80 -0
- package/dist/PropsTablePlugin.js.map +1 -0
- package/dist/PublicAssetsPlugin.d.ts +18 -0
- package/dist/PublicAssetsPlugin.js +28 -0
- package/dist/PublicAssetsPlugin.js.map +1 -0
- package/dist/ReadingTimePlugin.d.ts +10 -0
- package/dist/ReadingTimePlugin.js +23 -0
- package/dist/ReadingTimePlugin.js.map +1 -0
- package/dist/SearchIndexPlugin.d.ts +56 -0
- package/dist/SearchIndexPlugin.js +154 -0
- package/dist/SearchIndexPlugin.js.map +1 -0
- package/dist/SharedConfigPlugin.d.ts +13 -0
- package/dist/SharedConfigPlugin.js +25 -41
- package/dist/SharedConfigPlugin.js.map +1 -1
- package/dist/SidebarPlugin.d.ts +38 -0
- package/dist/SidebarPlugin.js +191 -95
- package/dist/SidebarPlugin.js.map +1 -1
- package/dist/SiteMapPlugin.d.ts +9 -0
- package/dist/SiteMapPlugin.js +20 -36
- package/dist/SiteMapPlugin.js.map +1 -1
- package/dist/TableOfContentsPlugin.d.ts +20 -0
- package/dist/TableOfContentsPlugin.js +43 -0
- package/dist/TableOfContentsPlugin.js.map +1 -0
- package/dist/utils/normaliseRefs.d.ts +1 -0
- package/dist/utils/normaliseRefs.js +52 -69
- package/dist/utils/normaliseRefs.js.map +1 -1
- package/package.json +41 -15
- package/CHANGELOG.md +0 -42
- package/dist/NextPrevPagePlugin.js +0 -59
- package/dist/NextPrevPagePlugin.js.map +0 -1
- package/dist/ReadingTimePlugin.mjs +0 -119
- package/dist/ReadingTimePlugin.mjs.map +0 -1
- package/dist/TableOfContentsPlugin.mjs +0 -140
- package/dist/TableOfContentsPlugin.mjs.map +0 -1
package/dist/$TagPlugin.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { escapeRegExp, reduce } from 'lodash-es';
|
|
3
|
+
function createPageTest(ignorePages, pageExtensions) {
|
|
4
|
+
const extTest = new RegExp(`${pageExtensions.map(escapeRegExp).join('|')}$`);
|
|
5
|
+
const ignoreTest = new RegExp(`${ignorePages.map(escapeRegExp).join('|')}$`);
|
|
6
|
+
return file => !ignoreTest.test(file) && extTest.test(file) && !path.basename(file).startsWith('.');
|
|
7
|
+
}
|
|
8
|
+
const findKeys = (obj, targetProp, pathParts = []) => reduce(obj, (found, value, key) => {
|
|
9
|
+
if (key === targetProp) {
|
|
10
|
+
return found.concat({ $$path: pathParts.concat(String(key)), $$value: value });
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === 'object') {
|
|
13
|
+
const foundParents = findKeys(value, targetProp, pathParts.concat(String(key)));
|
|
14
|
+
return found.concat(...foundParents);
|
|
15
|
+
}
|
|
16
|
+
return found;
|
|
17
|
+
}, []);
|
|
18
18
|
/**
|
|
19
19
|
* Plugin that scrapes `$tag` from page metadata and also applies all aliases stored in `config.data.tags`.
|
|
20
20
|
* Tags ultimately resolve down into refs, but are different from normal refs, in that they are applied to the
|
|
@@ -25,66 +25,41 @@ const escapeRegExp_1 = __importDefault(require("lodash/escapeRegExp"));
|
|
|
25
25
|
const $TagPlugin = {
|
|
26
26
|
// Check if the updated source has any /.tag aliases that we care about - if it does, we should re-run `afterUpdate` to
|
|
27
27
|
// make sure we pull in the latest pages
|
|
28
|
-
shouldClearCache(updatedSourceFilesystem, { config }) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Does the updated source have tags we are interested in?
|
|
36
|
-
return (yield updatedSourceFilesystem.promises.readdir('/.tags')).some(tag => config.data.subscribedTags.includes(tag));
|
|
37
|
-
});
|
|
28
|
+
async shouldClearCache(updatedSourceFilesystem, { config }) {
|
|
29
|
+
if (!config.data?.subscribedTags ||
|
|
30
|
+
!(await updatedSourceFilesystem.promises.exists('/.tags'))) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Does the updated source have tags we are interested in?
|
|
34
|
+
return (await updatedSourceFilesystem.promises.readdir('/.tags')).some(tag => config.data.subscribedTags.includes(tag));
|
|
38
35
|
},
|
|
39
36
|
// Every source with tags will create symlinks with the tagged pages, inside /.tags
|
|
40
|
-
$afterSource(pages, { config, ignorePages, pageExtensions }) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
config.setData({ subscribedTags: Array.from(tags) });
|
|
64
|
-
}
|
|
37
|
+
async $afterSource(pages, { config, ignorePages, pageExtensions }) {
|
|
38
|
+
const isNonHiddenPage = createPageTest(ignorePages, pageExtensions);
|
|
39
|
+
for (const page of pages) {
|
|
40
|
+
if (!isNonHiddenPage(page.fullPath)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const meta = page;
|
|
44
|
+
// Symlink every `tag` item to '/.tags' folder
|
|
45
|
+
if (meta.tags?.length) {
|
|
46
|
+
config.setTags(page.fullPath, meta.tags);
|
|
47
|
+
delete meta.tags;
|
|
48
|
+
}
|
|
49
|
+
// Find any references to $tag
|
|
50
|
+
const foundTags = findKeys(page, '$tag');
|
|
51
|
+
if (foundTags.length) {
|
|
52
|
+
const tags = new Set();
|
|
53
|
+
foundTags.forEach(ref => {
|
|
54
|
+
const [tag, fragment = ''] = ref.$$value.split('#');
|
|
55
|
+
tags.add(tag);
|
|
56
|
+
config.setGlobalRef(page.fullPath, ref.$$path, `${path.join('/.tags', tag, '**')}#${fragment}`);
|
|
57
|
+
});
|
|
58
|
+
config.setData({ subscribedTags: Array.from(tags) });
|
|
65
59
|
}
|
|
66
|
-
return pages;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.default = $TagPlugin;
|
|
71
|
-
const findKeys = (obj, targetProp, pathParts = []) => {
|
|
72
|
-
return (0, reduce_1.default)(obj, (found, value, key) => {
|
|
73
|
-
if (key === targetProp) {
|
|
74
|
-
return found.concat({ $$path: pathParts.concat(String(key)), $$value: value });
|
|
75
|
-
}
|
|
76
|
-
if (typeof value === 'object') {
|
|
77
|
-
const foundParents = findKeys(value, targetProp, pathParts.concat(String(key)));
|
|
78
|
-
return found.concat(...foundParents);
|
|
79
60
|
}
|
|
80
|
-
return
|
|
81
|
-
}
|
|
61
|
+
return pages;
|
|
62
|
+
}
|
|
82
63
|
};
|
|
83
|
-
|
|
84
|
-
const extTest = new RegExp(`${pageExtensions.map(escapeRegExp_1.default).join('|')}$`);
|
|
85
|
-
const ignoreTest = new RegExp(`${ignorePages.map(escapeRegExp_1.default).join('|')}$`);
|
|
86
|
-
return file => {
|
|
87
|
-
return !ignoreTest.test(file) && extTest.test(file) && !path_1.default.basename(file).startsWith('.');
|
|
88
|
-
};
|
|
89
|
-
}
|
|
64
|
+
export default $TagPlugin;
|
|
90
65
|
//# sourceMappingURL=$TagPlugin.js.map
|
package/dist/$TagPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$TagPlugin.js","sourceRoot":"","sources":["../src/$TagPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"$TagPlugin.js","sourceRoot":"","sources":["../src/$TagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGjD,SAAS,cAAc,CAAC,WAAW,EAAE,cAAc;IACjD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,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CACjB,IAAI,CAAC,QAAQ,EACb,GAAG,CAAC,MAAM,EACV,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAChD,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACtD;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Page, Plugin as PluginType } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
export declare type Breadcrumb = {
|
|
3
|
+
label: string;
|
|
4
|
+
path: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export interface BreadcrumbsPluginPage extends Page {
|
|
8
|
+
breadcrumbs?: Array<Breadcrumb>;
|
|
9
|
+
layout?: string;
|
|
10
|
+
}
|
|
11
|
+
interface BreadcrumbsPluginOptions {
|
|
12
|
+
indexPageName: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Calculates breadcrumbs for pages then embeds a `breadcrumbs` property to the metadata
|
|
16
|
+
*/
|
|
17
|
+
declare const BreadcrumbsPlugin: PluginType<BreadcrumbsPluginPage, BreadcrumbsPluginOptions>;
|
|
18
|
+
export default BreadcrumbsPlugin;
|
|
@@ -1,48 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const path_1 = __importDefault(require("path"));
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { breadcrumbsLayoutSchema } from '@jpmorganchase/mosaic-schemas';
|
|
16
3
|
/**
|
|
17
4
|
* Calculates breadcrumbs for pages then embeds a `breadcrumbs` property to the metadata
|
|
18
5
|
*/
|
|
19
6
|
const BreadcrumbsPlugin = {
|
|
20
|
-
$afterSource(pages,
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
async $afterSource(pages, _, options) {
|
|
8
|
+
for (const page of pages) {
|
|
9
|
+
if (breadcrumbsLayoutSchema.safeParse(page?.layout).success) {
|
|
23
10
|
const breadcrumbs = [];
|
|
24
11
|
let currentPage = page;
|
|
25
|
-
let parentDir =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
let parentDir = path.posix.normalize(path.posix.dirname(currentPage.fullPath));
|
|
13
|
+
const maxBreadcrumbCount = page.fullPath.split('/').length;
|
|
14
|
+
while (currentPage !== undefined && breadcrumbs.length < maxBreadcrumbCount) {
|
|
15
|
+
breadcrumbs.unshift({
|
|
16
|
+
label: currentPage.title,
|
|
17
|
+
path: currentPage.route,
|
|
18
|
+
id: currentPage.fullPath
|
|
19
|
+
});
|
|
20
|
+
currentPage = pages.find(
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
22
|
+
item => item.fullPath === path.posix.join(parentDir, options.indexPageName));
|
|
35
23
|
if (currentPage) {
|
|
36
|
-
parentDir =
|
|
24
|
+
parentDir = path.posix.dirname(path.posix.join(String(currentPage.fullPath), '..'));
|
|
37
25
|
}
|
|
38
26
|
}
|
|
39
27
|
if (!page.breadcrumbs) {
|
|
40
|
-
|
|
28
|
+
// filter out any duplicate breadcrumbs
|
|
29
|
+
const map = new Map(breadcrumbs.map(crumb => [crumb.id, crumb]));
|
|
30
|
+
page.breadcrumbs = [...map.values()];
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
}
|
|
34
|
+
return pages;
|
|
45
35
|
}
|
|
46
36
|
};
|
|
47
|
-
|
|
37
|
+
export default BreadcrumbsPlugin;
|
|
48
38
|
//# sourceMappingURL=BreadcrumbsPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsPlugin.js","sourceRoot":"","sources":["../src/BreadcrumbsPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BreadcrumbsPlugin.js","sourceRoot":"","sources":["../src/BreadcrumbsPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAaxE;;GAEG;AACH,MAAM,iBAAiB,GAAgE;IACrF,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO;QAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,uBAAuB,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE;gBAC3D,MAAM,WAAW,GAAsB,EAAE,CAAC;gBAC1C,IAAI,WAAW,GAAG,IAAI,CAAC;gBACvB,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC/E,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;gBAE3D,OAAO,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,kBAAkB,EAAE;oBAC3E,WAAW,CAAC,OAAO,CAAC;wBAClB,KAAK,EAAE,WAAW,CAAC,KAAK;wBACxB,IAAI,EAAE,WAAW,CAAC,KAAK;wBACvB,EAAE,EAAE,WAAW,CAAC,QAAQ;qBACzB,CAAC,CAAC;oBAEH,WAAW,GAAG,KAAK,CAAC,IAAI;oBACtB,2DAA2D;oBAC3D,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,CAC5E,CAAC;oBACF,IAAI,WAAW,EAAE;wBACf,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;qBACrF;iBACF;gBAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;oBACrB,uCAAuC;oBACvC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;oBACjE,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;iBACtC;aACF;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Page, Plugin as PluginType } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
interface BrokenLinksPluginPage extends Page {
|
|
3
|
+
}
|
|
4
|
+
interface BrokenLinksPluginOptions {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
skipUrlPatterns?: Array<string | RegExp>;
|
|
7
|
+
proxyEndpoint?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const BrokenLinksPlugin: PluginType<BrokenLinksPluginPage, BrokenLinksPluginOptions>;
|
|
10
|
+
export default BrokenLinksPlugin;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { remark } from 'remark';
|
|
3
|
+
import remarkMdx from 'remark-mdx';
|
|
4
|
+
import checkLinks from 'check-links';
|
|
5
|
+
import { visit } from 'unist-util-visit';
|
|
6
|
+
import proxyAgentPkg from 'https-proxy-agent';
|
|
7
|
+
const { HttpsProxyAgent } = proxyAgentPkg;
|
|
8
|
+
async function checkPageLinks(ast, options, fullPath, headings) {
|
|
9
|
+
const urlToNodes = {};
|
|
10
|
+
const aggregate = node => {
|
|
11
|
+
const { url: urlFromNode } = node;
|
|
12
|
+
if (!urlFromNode)
|
|
13
|
+
return;
|
|
14
|
+
const isExternalUrl = /^(https?:\/\/)/.test(urlFromNode);
|
|
15
|
+
const url = isExternalUrl
|
|
16
|
+
? // full urls including internal and external
|
|
17
|
+
new URL(urlFromNode)
|
|
18
|
+
: // handles relative links
|
|
19
|
+
new URL(`${path.posix.resolve(path.posix.dirname(fullPath), urlFromNode)}`, options.baseUrl);
|
|
20
|
+
if (!isExternalUrl && url.hash !== '') {
|
|
21
|
+
const isValidHeadingLink = headings.findIndex(heading => heading.replace(/\W+/g, '-').toLowerCase() === url.hash.substring(1).toLowerCase()) !== -1;
|
|
22
|
+
if (isValidHeadingLink) {
|
|
23
|
+
// link points to a heading on the page
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (options.skipUrlPatterns &&
|
|
28
|
+
options.skipUrlPatterns.some(skipPattern => new RegExp(skipPattern).test(url.toString()))) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!urlToNodes[url.toString()]) {
|
|
32
|
+
urlToNodes[url.toString()] = [];
|
|
33
|
+
}
|
|
34
|
+
urlToNodes[url.toString()].push(node);
|
|
35
|
+
};
|
|
36
|
+
visit(ast, ['link', 'image', 'definition'], aggregate);
|
|
37
|
+
const links = Object.keys(urlToNodes);
|
|
38
|
+
const checkLinksOptions = options.proxyEndpoint
|
|
39
|
+
? {
|
|
40
|
+
agent: {
|
|
41
|
+
https: new HttpsProxyAgent(options.proxyEndpoint)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
: {};
|
|
45
|
+
const results = await checkLinks(links, checkLinksOptions);
|
|
46
|
+
links.forEach(link => {
|
|
47
|
+
const result = results[link];
|
|
48
|
+
if (result.status !== 'dead' && result.status !== 'invalid') {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const nodes = urlToNodes[link];
|
|
52
|
+
if (!nodes)
|
|
53
|
+
return;
|
|
54
|
+
console.group(`[Mosaic] Broken links found in ${fullPath}`);
|
|
55
|
+
for (const node of nodes) {
|
|
56
|
+
console.log(`Link to ${link} is dead`, node);
|
|
57
|
+
}
|
|
58
|
+
console.groupEnd();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function findPageHeadings(ast) {
|
|
62
|
+
const headings = [];
|
|
63
|
+
visit(ast, ['heading'], node => {
|
|
64
|
+
headings.push(node.children[0]?.value);
|
|
65
|
+
});
|
|
66
|
+
return headings;
|
|
67
|
+
}
|
|
68
|
+
const processor = remark().use(remarkMdx);
|
|
69
|
+
const BrokenLinksPlugin = {
|
|
70
|
+
async $afterSource(pages, _, options) {
|
|
71
|
+
pages.forEach(async (page) => {
|
|
72
|
+
const ast = await processor.parse(page.content);
|
|
73
|
+
const headings = await findPageHeadings(ast);
|
|
74
|
+
await checkPageLinks(ast, options, page.fullPath, headings);
|
|
75
|
+
});
|
|
76
|
+
return pages;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export default BrokenLinksPlugin;
|
|
80
|
+
//# sourceMappingURL=BrokenLinksPlugin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|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { escapeRegExp } from 'lodash-es';
|
|
3
|
+
import { remark } from 'remark';
|
|
4
|
+
import remarkMdx from 'remark-mdx';
|
|
5
|
+
import remarkDirective from 'remark-directive';
|
|
6
|
+
import { visitParents } from 'unist-util-visit-parents';
|
|
7
|
+
const createPageTest = (ignorePages, pageExtensions) => {
|
|
8
|
+
const extTest = new RegExp(`${pageExtensions.map(ext => escapeRegExp(ext)).join('|')}$`);
|
|
9
|
+
const ignoreTest = new RegExp(`${ignorePages.map(ignore => escapeRegExp(ignore)).join('|')}$`);
|
|
10
|
+
return file => !ignoreTest.test(file) && extTest.test(file) && !path.basename(file).startsWith('.');
|
|
11
|
+
};
|
|
12
|
+
function getFullPath(fullPath, relativePath) {
|
|
13
|
+
const pathSegments = fullPath.split('/');
|
|
14
|
+
const relativeSegments = relativePath.split('/');
|
|
15
|
+
pathSegments.pop();
|
|
16
|
+
for (const segment of relativeSegments) {
|
|
17
|
+
if (segment === '..') {
|
|
18
|
+
pathSegments.pop();
|
|
19
|
+
}
|
|
20
|
+
else if (segment !== '.') {
|
|
21
|
+
pathSegments.push(segment);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return pathSegments.join('/');
|
|
25
|
+
}
|
|
26
|
+
async function processTree(tree, serialiser, mutableFilesystem, fullPath, isNonHiddenPage) {
|
|
27
|
+
const nodesToProcess = [];
|
|
28
|
+
visitParents(tree, (node, ancestors) => {
|
|
29
|
+
if (node.type === 'code') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const match = node.name === 'fragment' && node.attributes.src;
|
|
33
|
+
if (match) {
|
|
34
|
+
const parent = ancestors[ancestors.length - 1];
|
|
35
|
+
const index = parent.children.indexOf(node);
|
|
36
|
+
nodesToProcess.push({ node, parent, index });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
for (const { node, parent, index } of nodesToProcess) {
|
|
40
|
+
const fragmentFullPath = getFullPath(fullPath, node.attributes.src);
|
|
41
|
+
if (!isNonHiddenPage(fragmentFullPath)) {
|
|
42
|
+
console.warn(`Invalid file reference: '${node.attributes.src}'. Skipping.`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const fragmentPage = await serialiser.deserialise(fragmentFullPath, await mutableFilesystem.promises.readFile(fragmentFullPath));
|
|
46
|
+
// Create a new node with the content from fragmentPage.content
|
|
47
|
+
const newNode = {
|
|
48
|
+
type: 'html',
|
|
49
|
+
value: fragmentPage.content
|
|
50
|
+
};
|
|
51
|
+
// Replace the original node with the newNode in the tree
|
|
52
|
+
parent.children.splice(index, 1, newNode);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return tree;
|
|
56
|
+
}
|
|
57
|
+
const FragmentPlugin = {
|
|
58
|
+
async $beforeSend(mutableFilesystem, { serialiser, ignorePages, pageExtensions }) {
|
|
59
|
+
const pages = await Promise.all((await mutableFilesystem.promises.glob('**', {
|
|
60
|
+
onlyFiles: true,
|
|
61
|
+
ignore: ignorePages.map(ignore => `**/${ignore}`),
|
|
62
|
+
cwd: '/'
|
|
63
|
+
})).map(async (pagePath) => {
|
|
64
|
+
const deserialisedPage = await serialiser.deserialise(pagePath, await mutableFilesystem.promises.readFile(pagePath));
|
|
65
|
+
return deserialisedPage;
|
|
66
|
+
}));
|
|
67
|
+
const isNonHiddenPage = createPageTest(ignorePages, pageExtensions);
|
|
68
|
+
for (const page of pages) {
|
|
69
|
+
const { fullPath } = page;
|
|
70
|
+
if (!isNonHiddenPage(fullPath)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const tree = remark().use(remarkMdx).use(remarkDirective).parse(page.content);
|
|
74
|
+
const processedTree = await processTree(tree, serialiser, mutableFilesystem, fullPath, isNonHiddenPage);
|
|
75
|
+
page.content = remark()
|
|
76
|
+
.data('settings', { fences: true })
|
|
77
|
+
.use(remarkMdx)
|
|
78
|
+
.use(remarkDirective)
|
|
79
|
+
.stringify(processedTree);
|
|
80
|
+
const updatedFileData = await serialiser.serialise(fullPath, page);
|
|
81
|
+
await mutableFilesystem.promises.writeFile(fullPath, updatedFileData);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export default FragmentPlugin;
|
|
86
|
+
//# sourceMappingURL=FragmentPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FragmentPlugin.js","sourceRoot":"","sources":["../src/FragmentPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOxD,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,EAAE;IACrD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzF,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/F,OAAO,IAAI,CAAC,EAAE,CACZ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACzF,CAAC,CAAC;AA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AAgB,CAAC;QAC1B,CAAC,CAAC,CACH,CAAC;QAEF,MAAM,eAAe,GAAG,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAEpE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE;gBAC9B,SAAS;aACV;YAED,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9E,MAAM,aAAa,GAAG,MAAM,WAAW,CACrC,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,eAAe,CAChB,CAAC;YAEF,IAAI,CAAC,OAAO,GAAG,MAAM,EAAE;iBACpB,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;iBAClC,GAAG,CAAC,SAAS,CAAC;iBACd,GAAG,CAAC,eAAe,CAAC;iBACpB,SAAS,CAAC,aAAa,CAAC,CAAC;YAE5B,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACnE,MAAM,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;SACvE;IACH,CAAC;CACF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Page, Plugin as PluginType } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
interface LazyPagePluginPage extends Page {
|
|
3
|
+
aliases: {
|
|
4
|
+
[key: string]: Set<string>;
|
|
5
|
+
};
|
|
6
|
+
hddPaths: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface LazyPagePluginOptions {
|
|
11
|
+
cacheDir?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const LazyPagePlugin: PluginType<LazyPagePluginPage, LazyPagePluginOptions>;
|
|
14
|
+
export default LazyPagePlugin;
|