@jpmorganchase/mosaic-plugins 0.1.0-beta.8 → 0.1.0-beta.80
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 +49 -228
- package/dist/$AliasPlugin.js.map +1 -1
- package/dist/$CodeModPlugin.d.ts +7 -0
- package/dist/$CodeModPlugin.js +18 -118
- package/dist/$CodeModPlugin.js.map +1 -1
- package/dist/$RefPlugin.d.ts +31 -0
- package/dist/$RefPlugin.js +123 -451
- package/dist/$RefPlugin.js.map +1 -1
- package/dist/$TagPlugin.d.ts +28 -0
- package/dist/$TagPlugin.js +51 -234
- package/dist/$TagPlugin.js.map +1 -1
- package/dist/BreadcrumbsPlugin.d.ts +19 -0
- package/dist/BreadcrumbsPlugin.js +87 -112
- 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 +3 -0
- package/dist/FragmentPlugin.js +61 -0
- package/dist/FragmentPlugin.js.map +1 -0
- package/dist/LazyPagePlugin.d.ts +14 -0
- package/dist/LazyPagePlugin.js +50 -254
- package/dist/LazyPagePlugin.js.map +1 -1
- package/dist/PagesWithoutFileExtPlugin.d.ts +9 -0
- package/dist/PagesWithoutFileExtPlugin.js +20 -118
- package/dist/PagesWithoutFileExtPlugin.js.map +1 -1
- package/dist/PropsTablePlugin.d.ts +6 -0
- package/dist/PropsTablePlugin.js +88 -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 +39 -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 +14 -0
- package/dist/SharedConfigPlugin.js +129 -168
- package/dist/SharedConfigPlugin.js.map +1 -1
- package/dist/SidebarPlugin.d.ts +45 -0
- package/dist/SidebarPlugin.js +285 -324
- package/dist/SidebarPlugin.js.map +1 -1
- package/dist/SiteMapPlugin.d.ts +9 -0
- package/dist/SiteMapPlugin.js +23 -91
- package/dist/SiteMapPlugin.js.map +1 -1
- package/dist/TableOfContentsPlugin.d.ts +20 -0
- package/dist/TableOfContentsPlugin.js +44 -0
- package/dist/TableOfContentsPlugin.js.map +1 -0
- package/dist/utils/PluginError.d.ts +7 -0
- package/dist/utils/PluginError.js +13 -0
- package/dist/utils/PluginError.js.map +1 -0
- package/dist/utils/createPageTest.d.ts +1 -0
- package/dist/utils/createPageTest.js +8 -0
- package/dist/utils/createPageTest.js.map +1 -0
- package/dist/utils/mergePageContent.d.ts +16 -0
- package/dist/utils/mergePageContent.js +23 -0
- package/dist/utils/mergePageContent.js.map +1 -0
- package/dist/utils/normaliseRefs.d.ts +1 -0
- package/dist/utils/normaliseRefs.js +56 -275
- package/dist/utils/normaliseRefs.js.map +1 -1
- package/dist/utils/sortSidebarData.d.ts +29 -0
- package/dist/utils/sortSidebarData.js +47 -0
- package/dist/utils/sortSidebarData.js.map +1 -0
- package/package.json +41 -19
- package/CHANGELOG.md +0 -93
- package/dist/LocalFolderSavePlugin.js +0 -165
- package/dist/LocalFolderSavePlugin.js.map +0 -1
- package/dist/NextPrevPagePlugin.js +0 -173
- package/dist/NextPrevPagePlugin.js.map +0 -1
- package/dist/ReadingTimePlugin.mjs +0 -119
- package/dist/ReadingTimePlugin.mjs.map +0 -1
- package/dist/SearchIndexPlugin.mjs +0 -268
- package/dist/SearchIndexPlugin.mjs.map +0 -1
- package/dist/TableOfContentsPlugin.mjs +0 -131
- package/dist/TableOfContentsPlugin.mjs.map +0 -1
- package/dist/__tests__/BreadcrumbsPlugin.test.js +0 -160
- package/dist/__tests__/BreadcrumbsPlugin.test.js.map +0 -1
package/dist/$RefPlugin.js
CHANGED
|
@@ -1,473 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function _asyncToGenerator(fn) {
|
|
24
|
-
return function() {
|
|
25
|
-
var self = this, args = arguments;
|
|
26
|
-
return new Promise(function(resolve, reject) {
|
|
27
|
-
var gen = fn.apply(self, args);
|
|
28
|
-
function _next(value) {
|
|
29
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
-
}
|
|
31
|
-
function _throw(err) {
|
|
32
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
33
|
-
}
|
|
34
|
-
_next(undefined);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function _defineProperty(obj, key, value) {
|
|
39
|
-
if (key in obj) {
|
|
40
|
-
Object.defineProperty(obj, key, {
|
|
41
|
-
value: value,
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
obj[key] = value;
|
|
48
|
-
}
|
|
49
|
-
return obj;
|
|
50
|
-
}
|
|
51
|
-
function _iterableToArray(iter) {
|
|
52
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
|
-
}
|
|
54
|
-
function _nonIterableSpread() {
|
|
55
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
56
|
-
}
|
|
57
|
-
function _objectSpread(target) {
|
|
58
|
-
for(var i = 1; i < arguments.length; i++){
|
|
59
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
60
|
-
var ownKeys = Object.keys(source);
|
|
61
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
62
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
63
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
ownKeys.forEach(function(key) {
|
|
67
|
-
_defineProperty(target, key, source[key]);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return target;
|
|
71
|
-
}
|
|
72
|
-
function _toConsumableArray(arr) {
|
|
73
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
74
|
-
}
|
|
75
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
76
|
-
if (!o) return;
|
|
77
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
78
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
79
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
80
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
81
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import { reduce, omit } from 'lodash-es';
|
|
3
|
+
import { $RefParser } from '@apidevtools/json-schema-ref-parser';
|
|
4
|
+
import deepmerge from 'deepmerge';
|
|
5
|
+
import normaliseRefs from './utils/normaliseRefs.js';
|
|
6
|
+
import PluginError from './utils/PluginError.js';
|
|
7
|
+
import { mergePageContent } from './utils/mergePageContent.js';
|
|
8
|
+
import { createPageTest } from './utils/createPageTest.js';
|
|
9
|
+
const isWindows = /^win/.test(os.platform());
|
|
10
|
+
const windowsDrivePattern = /^([a-z]):/i;
|
|
11
|
+
/**
|
|
12
|
+
* The JSON Schema Ref parser turns refs into URLs.
|
|
13
|
+
* When running on Windows it adds in the drive letter to the beginning of the resolved ref filepath
|
|
14
|
+
*
|
|
15
|
+
* WE DON"T WANT THIS
|
|
16
|
+
*
|
|
17
|
+
* Regardless of platform, Mosaic uses an in-memory fs so we don't need drive letters.
|
|
18
|
+
* We need the path as it is in the mosaic fs.
|
|
19
|
+
*/
|
|
20
|
+
function normaliseWindowsPath(url) {
|
|
21
|
+
const drivePart = windowsDrivePattern.exec(url)?.[0];
|
|
22
|
+
return drivePart ? url.slice(drivePart.length) : url;
|
|
82
23
|
}
|
|
83
|
-
import regeneratorRuntime from "regenerator-runtime";
|
|
84
|
-
import path from "path";
|
|
85
|
-
import reduce from "lodash/reduce";
|
|
86
|
-
import omit from "lodash/omit";
|
|
87
|
-
import merge from "lodash/merge";
|
|
88
|
-
import escapeRegExp from "lodash/escapeRegExp";
|
|
89
|
-
import $RefParser from "@apidevtools/json-schema-ref-parser";
|
|
90
|
-
import normaliseRefs from "./utils/normaliseRefs";
|
|
91
24
|
function createRefResolver(normalisedRefs, serialiser, mutableFilesystem) {
|
|
92
25
|
return {
|
|
93
26
|
file: {
|
|
94
27
|
canRead: true,
|
|
95
28
|
order: 1,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
_ctx.t1 = serialiser;
|
|
109
|
-
_ctx.t2 = file.url;
|
|
110
|
-
_ctx.next = 7;
|
|
111
|
-
return mutableFilesystem.promises.readFile(file.url);
|
|
112
|
-
case 7:
|
|
113
|
-
_ctx.t3 = _ctx.sent;
|
|
114
|
-
_ctx.next = 10;
|
|
115
|
-
return _ctx.t1.deserialise.call(_ctx.t1, _ctx.t2, _ctx.t3);
|
|
116
|
-
case 10:
|
|
117
|
-
_ctx.t0 = _ctx.sent;
|
|
118
|
-
case 11:
|
|
119
|
-
refedPage = _ctx.t0;
|
|
120
|
-
return _ctx.abrupt("return", callback(null, omit(refedPage, "content")));
|
|
121
|
-
case 15:
|
|
122
|
-
_ctx.prev = 15;
|
|
123
|
-
_ctx.t4 = _ctx["catch"](0);
|
|
124
|
-
return _ctx.abrupt("return", callback(_ctx.t4, null));
|
|
125
|
-
case 18:
|
|
126
|
-
case "end":
|
|
127
|
-
return _ctx.stop();
|
|
128
|
-
}
|
|
129
|
-
}, _callee, null, [
|
|
130
|
-
[
|
|
131
|
-
0,
|
|
132
|
-
15
|
|
133
|
-
]
|
|
134
|
-
]);
|
|
135
|
-
}))();
|
|
29
|
+
async read(file, callback) {
|
|
30
|
+
try {
|
|
31
|
+
const filePath = isWindows ? normaliseWindowsPath(file.url) : file.url;
|
|
32
|
+
const refedPage = normalisedRefs[filePath] ||
|
|
33
|
+
(await serialiser.deserialise(filePath, await mutableFilesystem.promises.readFile(filePath)));
|
|
34
|
+
return callback(null, omit(refedPage, 'content'));
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
return callback(e, null);
|
|
38
|
+
}
|
|
136
39
|
}
|
|
137
40
|
}
|
|
138
41
|
};
|
|
139
42
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
if (typeof value === "object") {
|
|
152
|
-
var foundParents = findKeys(value, targetProp, pathParts.concat(String(key)));
|
|
153
|
-
return found.concat(foundParents);
|
|
154
|
-
}
|
|
155
|
-
return found;
|
|
156
|
-
}, []);
|
|
157
|
-
};
|
|
158
|
-
function createPageTest(ignorePages, pageExtensions) {
|
|
159
|
-
var extTest = new RegExp("".concat(pageExtensions.map(escapeRegExp).join("|"), "$"));
|
|
160
|
-
var ignoreTest = new RegExp("".concat(ignorePages.map(escapeRegExp).join("|"), "$"));
|
|
161
|
-
return function(file) {
|
|
162
|
-
return !ignoreTest.test(file) && extTest.test(file) && !path.basename(file).startsWith(".");
|
|
163
|
-
};
|
|
164
|
-
}
|
|
43
|
+
const findKeys = (obj, targetProp, pathParts = []) => reduce(obj, (found, value, key) => {
|
|
44
|
+
if (key === targetProp) {
|
|
45
|
+
return found.concat([[pathParts.concat(String(key)), value]]);
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === 'object') {
|
|
48
|
+
const foundParents = findKeys(value, targetProp, pathParts.concat(String(key)));
|
|
49
|
+
return found.concat(foundParents);
|
|
50
|
+
}
|
|
51
|
+
return found;
|
|
52
|
+
}, []);
|
|
165
53
|
/**
|
|
166
54
|
* Plugin that scrapes `$ref` properties from page metadata and also applies all refs stored in `config.data.refs`.
|
|
167
55
|
* Other plugins can use `setRef` to apply new refs, as long as they call it before this plugin has reaches `$beforeSend`
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
normalisedRef = (0, _ctx.t0)(_ctx.t1, _ctx.t2);
|
|
195
|
-
resolve = createRefResolver(_defineProperty({}, pagePath, normalisedRef), serialiser, globalFilesystem);
|
|
196
|
-
refParser = new $RefParser();
|
|
197
|
-
_ctx.prev = 11;
|
|
198
|
-
_ctx.next = 14;
|
|
199
|
-
return refParser.dereference(String(pagePath), normalisedRef, {
|
|
200
|
-
resolve: resolve,
|
|
201
|
-
dereference: {
|
|
202
|
-
circular: false
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
case 14:
|
|
206
|
-
resolved = _ctx.sent;
|
|
207
|
-
_ctx.next = 17;
|
|
208
|
-
return serialiser.serialise(pagePath, merge(normalisedRef, resolved));
|
|
209
|
-
case 17:
|
|
210
|
-
serialisedPage = _ctx.sent;
|
|
211
|
-
return _ctx.abrupt("return", serialisedPage);
|
|
212
|
-
case 21:
|
|
213
|
-
_ctx.prev = 21;
|
|
214
|
-
_ctx.t3 = _ctx["catch"](11);
|
|
215
|
-
console.warn("Error resolving ref(s) for page '".concat(pagePath, "'. ").concat(_ctx.t3.message.replace(/\.$/, ""), " in '").concat(_ctx.t3.source, "'"));
|
|
216
|
-
throw _ctx.t3;
|
|
217
|
-
case 25:
|
|
218
|
-
return _ctx.abrupt("return", fileData);
|
|
219
|
-
case 26:
|
|
220
|
-
case "end":
|
|
221
|
-
return _ctx.stop();
|
|
222
|
-
}
|
|
223
|
-
}, _callee, null, [
|
|
224
|
-
[
|
|
225
|
-
11,
|
|
226
|
-
21
|
|
227
|
-
]
|
|
228
|
-
]);
|
|
229
|
-
}));
|
|
230
|
-
return function(pagePath, fileData) {
|
|
231
|
-
return _ref.apply(this, arguments);
|
|
232
|
-
};
|
|
233
|
-
}());
|
|
234
|
-
case 1:
|
|
235
|
-
case "end":
|
|
236
|
-
return _ctx.stop();
|
|
56
|
+
*/
|
|
57
|
+
const $RefPlugin = {
|
|
58
|
+
async afterUpdate(mutableFilesystem, { ignorePages, globalFilesystem, serialiser, pageExtensions, globalConfig }) {
|
|
59
|
+
mutableFilesystem.__internal_do_not_use_addReadFileHook(async (pagePath, fileData) => {
|
|
60
|
+
if (globalConfig.data.globalRefs[pagePath]) {
|
|
61
|
+
const expandedRefs = await normaliseRefs(String(pagePath), globalConfig.data.globalRefs[pagePath], globalFilesystem, pageExtensions, ignorePages);
|
|
62
|
+
const page = await serialiser.deserialise(pagePath, fileData);
|
|
63
|
+
const normalisedRef = mergePageContent(page, expandedRefs);
|
|
64
|
+
const resolve = createRefResolver({
|
|
65
|
+
[pagePath]: normalisedRef
|
|
66
|
+
}, serialiser, globalFilesystem);
|
|
67
|
+
const refParser = new $RefParser();
|
|
68
|
+
try {
|
|
69
|
+
const resolved = await refParser.dereference(String(pagePath), normalisedRef, {
|
|
70
|
+
resolve,
|
|
71
|
+
dereference: { circular: false }
|
|
72
|
+
});
|
|
73
|
+
const serialisedPage = await serialiser.serialise(pagePath, {
|
|
74
|
+
...normalisedRef,
|
|
75
|
+
...resolved
|
|
76
|
+
});
|
|
77
|
+
return serialisedPage;
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.warn(`Error resolving ref(s) for page '${pagePath}'. ${e.message.replace(/\.$/, '')} in '${e.source}'`);
|
|
81
|
+
throw new PluginError(e.message, page.fullPath);
|
|
237
82
|
}
|
|
238
|
-
}
|
|
239
|
-
|
|
83
|
+
}
|
|
84
|
+
return fileData;
|
|
85
|
+
});
|
|
240
86
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
_ctx.next = 53;
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
_ctx.t0 = regeneratorRuntime.keys(config.data.refs);
|
|
258
|
-
case 4:
|
|
259
|
-
if ((_ctx.t1 = _ctx.t0()).done) {
|
|
260
|
-
_ctx.next = 22;
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
fullPath = _ctx.t1.value;
|
|
264
|
-
_ctx.t2 = serialiser;
|
|
265
|
-
_ctx.t3 = fullPath;
|
|
266
|
-
_ctx.next = 10;
|
|
267
|
-
return mutableFilesystem.promises.readFile(fullPath);
|
|
268
|
-
case 10:
|
|
269
|
-
_ctx.t4 = _ctx.sent;
|
|
270
|
-
_ctx.next = 13;
|
|
271
|
-
return _ctx.t2.deserialise.call(_ctx.t2, _ctx.t3, _ctx.t4);
|
|
272
|
-
case 13:
|
|
273
|
-
page = _ctx.sent;
|
|
274
|
-
_ctx.t5 = merge;
|
|
275
|
-
_ctx.t6 = page;
|
|
276
|
-
_ctx.next = 18;
|
|
277
|
-
return normaliseRefs(String(fullPath), config.data.refs[fullPath], mutableFilesystem, pageExtensions, ignorePages);
|
|
278
|
-
case 18:
|
|
279
|
-
_ctx.t7 = _ctx.sent;
|
|
280
|
-
normalisedRefs[fullPath] = (0, _ctx.t5)(_ctx.t6, _ctx.t7);
|
|
281
|
-
_ctx.next = 4;
|
|
282
|
-
break;
|
|
283
|
-
case 22:
|
|
284
|
-
resolve = createRefResolver(normalisedRefs, serialiser, mutableFilesystem);
|
|
285
|
-
refParser = new $RefParser();
|
|
286
|
-
_ctx.t8 = regeneratorRuntime.keys(normalisedRefs);
|
|
287
|
-
case 25:
|
|
288
|
-
if ((_ctx.t9 = _ctx.t8()).done) {
|
|
289
|
-
_ctx.next = 41;
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
fullPath1 = _ctx.t9.value;
|
|
293
|
-
page1 = normalisedRefs[fullPath1];
|
|
294
|
-
_ctx.prev = 28;
|
|
295
|
-
_ctx.next = 31;
|
|
296
|
-
return refParser.dereference(String(fullPath1), page1, {
|
|
297
|
-
resolve: resolve,
|
|
298
|
-
dereference: {
|
|
299
|
-
circular: false
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
case 31:
|
|
303
|
-
resolved = _ctx.sent;
|
|
304
|
-
normalisedRefs[fullPath1] = _objectSpread({}, page1, resolved);
|
|
305
|
-
_ctx.next = 39;
|
|
306
|
-
break;
|
|
307
|
-
case 35:
|
|
308
|
-
_ctx.prev = 35;
|
|
309
|
-
_ctx.t10 = _ctx["catch"](28);
|
|
310
|
-
console.warn("Error resolving ref(s) for page '".concat(fullPath1, "'. ").concat(_ctx.t10.message.replace(/\.$/, ""), " in '").concat(_ctx.t10.source, "'"));
|
|
311
|
-
throw _ctx.t10;
|
|
312
|
-
case 39:
|
|
313
|
-
_ctx.next = 25;
|
|
314
|
-
break;
|
|
315
|
-
case 41:
|
|
316
|
-
_ctx.t11 = regeneratorRuntime.keys(normalisedRefs);
|
|
317
|
-
case 42:
|
|
318
|
-
if ((_ctx.t12 = _ctx.t11()).done) {
|
|
319
|
-
_ctx.next = 53;
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
fullPath2 = _ctx.t12.value;
|
|
323
|
-
_ctx.t13 = mutableFilesystem.promises;
|
|
324
|
-
_ctx.t14 = fullPath2;
|
|
325
|
-
_ctx.next = 48;
|
|
326
|
-
return serialiser.serialise(fullPath2, normalisedRefs[fullPath2]);
|
|
327
|
-
case 48:
|
|
328
|
-
_ctx.t15 = _ctx.sent;
|
|
329
|
-
_ctx.next = 51;
|
|
330
|
-
return _ctx.t13.writeFile.call(_ctx.t13, _ctx.t14, _ctx.t15);
|
|
331
|
-
case 51:
|
|
332
|
-
_ctx.next = 42;
|
|
333
|
-
break;
|
|
334
|
-
case 53:
|
|
335
|
-
case "end":
|
|
336
|
-
return _ctx.stop();
|
|
87
|
+
async $beforeSend(mutableFilesystem, { config, serialiser, pageExtensions, ignorePages }) {
|
|
88
|
+
// Prevent any more refs being set after this lifecycle has been called - as they won't take effect
|
|
89
|
+
config.setRef = () => {
|
|
90
|
+
throw new Error('Cannot set refs after `RefPlugin` has reached `$beforeSend` lifecycle phase.');
|
|
91
|
+
};
|
|
92
|
+
const normalisedRefs = {};
|
|
93
|
+
if (config.data.refs) {
|
|
94
|
+
// First pass of refs, normalises any $ref entries to expand wildcards
|
|
95
|
+
for (const fullPath in config.data.refs) {
|
|
96
|
+
const page = await serialiser.deserialise(fullPath, await mutableFilesystem.promises.readFile(fullPath));
|
|
97
|
+
try {
|
|
98
|
+
const expandedRefs = await normaliseRefs(String(fullPath), config.data.refs[fullPath], mutableFilesystem, pageExtensions, ignorePages);
|
|
99
|
+
normalisedRefs[fullPath] = deepmerge(page, expandedRefs);
|
|
337
100
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
101
|
+
catch (e) {
|
|
102
|
+
throw new PluginError(e.message, page.fullPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const resolve = createRefResolver(normalisedRefs, serialiser, mutableFilesystem);
|
|
106
|
+
const refParser = new $RefParser();
|
|
107
|
+
// Second pass of refs, resolves the refs
|
|
108
|
+
for (const fullPath in normalisedRefs) {
|
|
109
|
+
const page = normalisedRefs[fullPath];
|
|
110
|
+
try {
|
|
111
|
+
const resolved = await refParser.dereference(String(fullPath), page, {
|
|
112
|
+
resolve,
|
|
113
|
+
dereference: { circular: false }
|
|
114
|
+
});
|
|
115
|
+
normalisedRefs[fullPath] = { ...page, ...resolved };
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
console.warn(`Error resolving ref(s) for page '${fullPath}'. ${e.message.replace(/\.$/, '')} in '${e.source}'`);
|
|
119
|
+
throw new PluginError(e.message, page.fullPath);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Third pass, write out the files
|
|
123
|
+
for (const fullPath in normalisedRefs) {
|
|
124
|
+
await mutableFilesystem.promises.writeFile(fullPath, await serialiser.serialise(fullPath, normalisedRefs[fullPath]));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
345
127
|
},
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
_iterator = pages[Symbol.iterator]();
|
|
357
|
-
case 4:
|
|
358
|
-
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
|
|
359
|
-
_ctx.next = 30;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
page = _step.value;
|
|
363
|
-
if (isNonHiddenPage(page.fullPath)) {
|
|
364
|
-
_ctx.next = 8;
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
return _ctx.abrupt("continue", 27);
|
|
368
|
-
case 8:
|
|
369
|
-
refs = findKeys(page, "$ref");
|
|
370
|
-
if (!refs.length) {
|
|
371
|
-
_ctx.next = 27;
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
375
|
-
_ctx.prev = 11;
|
|
376
|
-
for(_iterator1 = refs[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
377
|
-
ref = _step1.value;
|
|
378
|
-
;
|
|
379
|
-
(_config = config).setRef.apply(_config, [
|
|
380
|
-
page.fullPath
|
|
381
|
-
].concat(_toConsumableArray(ref)));
|
|
382
|
-
}
|
|
383
|
-
_ctx.next = 19;
|
|
384
|
-
break;
|
|
385
|
-
case 15:
|
|
386
|
-
_ctx.prev = 15;
|
|
387
|
-
_ctx.t0 = _ctx["catch"](11);
|
|
388
|
-
_didIteratorError1 = true;
|
|
389
|
-
_iteratorError1 = _ctx.t0;
|
|
390
|
-
case 19:
|
|
391
|
-
_ctx.prev = 19;
|
|
392
|
-
_ctx.prev = 20;
|
|
393
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
394
|
-
_iterator1.return();
|
|
395
|
-
}
|
|
396
|
-
case 22:
|
|
397
|
-
_ctx.prev = 22;
|
|
398
|
-
if (!_didIteratorError1) {
|
|
399
|
-
_ctx.next = 25;
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
throw _iteratorError1;
|
|
403
|
-
case 25:
|
|
404
|
-
return _ctx.finish(22);
|
|
405
|
-
case 26:
|
|
406
|
-
return _ctx.finish(19);
|
|
407
|
-
case 27:
|
|
408
|
-
_iteratorNormalCompletion = true;
|
|
409
|
-
_ctx.next = 4;
|
|
410
|
-
break;
|
|
411
|
-
case 30:
|
|
412
|
-
_ctx.next = 36;
|
|
413
|
-
break;
|
|
414
|
-
case 32:
|
|
415
|
-
_ctx.prev = 32;
|
|
416
|
-
_ctx.t1 = _ctx["catch"](2);
|
|
417
|
-
_didIteratorError = true;
|
|
418
|
-
_iteratorError = _ctx.t1;
|
|
419
|
-
case 36:
|
|
420
|
-
_ctx.prev = 36;
|
|
421
|
-
_ctx.prev = 37;
|
|
422
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
423
|
-
_iterator.return();
|
|
424
|
-
}
|
|
425
|
-
case 39:
|
|
426
|
-
_ctx.prev = 39;
|
|
427
|
-
if (!_didIteratorError) {
|
|
428
|
-
_ctx.next = 42;
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
throw _iteratorError;
|
|
432
|
-
case 42:
|
|
433
|
-
return _ctx.finish(39);
|
|
434
|
-
case 43:
|
|
435
|
-
return _ctx.finish(36);
|
|
436
|
-
case 44:
|
|
437
|
-
return _ctx.abrupt("return", pages);
|
|
438
|
-
case 45:
|
|
439
|
-
case "end":
|
|
440
|
-
return _ctx.stop();
|
|
128
|
+
async $afterSource(pages, { config, ignorePages, pageExtensions }) {
|
|
129
|
+
const isNonHiddenPage = createPageTest(ignorePages, pageExtensions);
|
|
130
|
+
for (const page of pages) {
|
|
131
|
+
if (!isNonHiddenPage(page.fullPath)) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const refs = findKeys(page, '$ref');
|
|
135
|
+
if (refs.length) {
|
|
136
|
+
for (const ref of refs) {
|
|
137
|
+
config.setRef(page.fullPath, ...ref);
|
|
441
138
|
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
32,
|
|
446
|
-
36,
|
|
447
|
-
44
|
|
448
|
-
],
|
|
449
|
-
[
|
|
450
|
-
11,
|
|
451
|
-
15,
|
|
452
|
-
19,
|
|
453
|
-
27
|
|
454
|
-
],
|
|
455
|
-
[
|
|
456
|
-
20,
|
|
457
|
-
,
|
|
458
|
-
22,
|
|
459
|
-
26
|
|
460
|
-
],
|
|
461
|
-
[
|
|
462
|
-
37,
|
|
463
|
-
,
|
|
464
|
-
39,
|
|
465
|
-
43
|
|
466
|
-
]
|
|
467
|
-
]);
|
|
468
|
-
}))();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return pages;
|
|
469
142
|
}
|
|
470
143
|
};
|
|
471
144
|
export default $RefPlugin;
|
|
472
|
-
|
|
473
145
|
//# sourceMappingURL=$RefPlugin.js.map
|
package/dist/$RefPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/$RefPlugin.ts"],"sourcesContent":["import path from 'path';\nimport reduce from 'lodash/reduce';\nimport omit from 'lodash/omit';\nimport merge from 'lodash/merge';\nimport escapeRegExp from 'lodash/escapeRegExp';\nimport $RefParser from '@apidevtools/json-schema-ref-parser';\nimport type { Plugin as PluginType } from '@jpmorganchase/mosaic-types';\n\nimport normaliseRefs from './utils/normaliseRefs';\n\nfunction createRefResolver(normalisedRefs, serialiser, mutableFilesystem) {\n return {\n file: {\n canRead: true,\n order: 1,\n async read(file, callback) {\n try {\n const refedPage =\n normalisedRefs[file.url] ||\n (await serialiser.deserialise(\n file.url,\n await mutableFilesystem.promises.readFile(file.url)\n ));\n return callback(null, omit(refedPage, 'content'));\n } catch (e) {\n return callback(e, null);\n }\n }\n }\n };\n}\n\nconst findKeys = (obj, targetProp, pathParts: string[] = []): [string[], string][] =>\n reduce<string, [string[], string][]>(\n obj,\n (found, value, key) => {\n if (key === targetProp) {\n return found.concat([[pathParts.concat(String(key)), value]]);\n }\n if (typeof value === 'object') {\n const foundParents = findKeys(value, targetProp, pathParts.concat(String(key)));\n return found.concat(foundParents);\n }\n return found;\n },\n []\n );\n\nfunction createPageTest(ignorePages, pageExtensions) {\n const extTest = new RegExp(`${pageExtensions.map(escapeRegExp).join('|')}$`);\n const ignoreTest = new RegExp(`${ignorePages.map(escapeRegExp).join('|')}$`);\n return file =>\n !ignoreTest.test(file) && extTest.test(file) && !path.basename(file).startsWith('.');\n}\n\ninterface RefsPluginConfigData {\n refs: { [key: string]: { $$path: string[]; $$value: string }[] };\n globalRefs: { [key: string]: { $$path: string[]; $$value: string }[] };\n subscribedTags: string[];\n}\n\ninterface RefsPluginPage {\n fullPath: string;\n refs: { [key: string]: { $$path: string[]; $$value: string }[] };\n}\n\n/**\n * Plugin that scrapes `$ref` properties from page metadata and also applies all refs stored in `config.data.refs`.\n * Other plugins can use `setRef` to apply new refs, as long as they call it before this plugin has reaches `$beforeSend`\n */\nconst $RefPlugin: PluginType<RefsPluginPage, unknown, RefsPluginConfigData> = {\n async afterUpdate(\n mutableFilesystem,\n { ignorePages, globalFilesystem, serialiser, pageExtensions, globalConfig }\n ) {\n mutableFilesystem.__internal_do_not_use_addReadFileHook(async (pagePath: string, fileData) => {\n if (globalConfig.data.globalRefs[pagePath]) {\n const normalisedRef = merge(\n await serialiser.deserialise(pagePath, fileData),\n await normaliseRefs(\n String(pagePath),\n globalConfig.data.globalRefs[pagePath],\n globalFilesystem,\n pageExtensions,\n ignorePages\n )\n );\n const resolve = createRefResolver(\n {\n [pagePath]: normalisedRef\n },\n serialiser,\n globalFilesystem\n );\n const refParser = new $RefParser();\n\n try {\n const resolved = await refParser.dereference(String(pagePath), normalisedRef, {\n resolve,\n dereference: { circular: false }\n });\n const serialisedPage = await serialiser.serialise(\n pagePath,\n merge(normalisedRef, resolved)\n );\n return serialisedPage;\n } catch (e) {\n console.warn(\n `Error resolving ref(s) for page '${pagePath}'. ${e.message.replace(/\\.$/, '')} in '${\n e.source\n }'`\n );\n throw e;\n }\n }\n\n return fileData;\n });\n },\n async $beforeSend(mutableFilesystem, { config, serialiser, pageExtensions, ignorePages }) {\n // Prevent any more refs being set after this lifecycle has been called - as they won't take effect\n config.setRef = () => {\n throw new Error(\n 'Cannot set refs after `RefPlugin` has reached `$beforeSend` lifecycle phase.'\n );\n };\n const normalisedRefs = {};\n\n if (config.data.refs) {\n // First pass of refs, normalises any $ref entries to expand wildcards\n for (const fullPath in config.data.refs) {\n const page = await serialiser.deserialise(\n fullPath,\n await mutableFilesystem.promises.readFile(fullPath)\n );\n normalisedRefs[fullPath] = merge(\n page,\n await normaliseRefs(\n String(fullPath),\n config.data.refs[fullPath],\n mutableFilesystem,\n pageExtensions,\n ignorePages\n )\n );\n }\n\n const resolve = createRefResolver(normalisedRefs, serialiser, mutableFilesystem);\n const refParser = new $RefParser();\n\n // Second pass of refs, resolves the refs\n for (const fullPath in normalisedRefs) {\n const page = normalisedRefs[fullPath];\n try {\n const resolved = await refParser.dereference(String(fullPath), page, {\n resolve,\n dereference: { circular: false }\n });\n normalisedRefs[fullPath] = { ...page, ...resolved };\n } catch (e) {\n console.warn(\n `Error resolving ref(s) for page '${fullPath}'. ${e.message.replace(/\\.$/, '')} in '${\n e.source\n }'`\n );\n throw e;\n }\n }\n // Third pass, write out the files\n for (const fullPath in normalisedRefs) {\n await mutableFilesystem.promises.writeFile(\n fullPath,\n await serialiser.serialise(fullPath, normalisedRefs[fullPath])\n );\n }\n }\n },\n async $afterSource(pages, { config, ignorePages, pageExtensions }) {\n const isNonHiddenPage = createPageTest(ignorePages, pageExtensions);\n\n for (const page of pages) {\n if (!isNonHiddenPage(page.fullPath)) {\n continue;\n }\n const refs = findKeys(page, '$ref');\n\n if (refs.length) {\n for (const ref of refs) {\n config.setRef(page.fullPath, ...ref);\n }\n }\n }\n return pages;\n }\n};\n\nexport default $RefPlugin;\n"],"names":["path","reduce","omit","merge","escapeRegExp","$RefParser","normaliseRefs","createRefResolver","normalisedRefs","serialiser","mutableFilesystem","file","canRead","order","read","callback","refedPage","url","promises","readFile","deserialise","findKeys","obj","targetProp","pathParts","found","value","key","concat","String","foundParents","createPageTest","ignorePages","pageExtensions","extTest","RegExp","map","join","ignoreTest","test","basename","startsWith","$RefPlugin","afterUpdate","globalFilesystem","globalConfig","__internal_do_not_use_addReadFileHook","pagePath","fileData","normalisedRef","resolve","refParser","resolved","serialisedPage","data","globalRefs","dereference","circular","serialise","console","warn","e","message","replace","source","$beforeSend","config","fullPath","page","setRef","Error","refs","writeFile","$afterSource","pages","isNonHiddenPage","ref","length"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,IAAI,MAAM,MAAM,CAAC;AACxB,OAAOC,MAAM,MAAM,eAAe,CAAC;AACnC,OAAOC,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAOC,KAAK,MAAM,cAAc,CAAC;AACjC,OAAOC,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAOC,UAAU,MAAM,qCAAqC,CAAC;AAG7D,OAAOC,aAAa,MAAM,uBAAuB,CAAC;AAElD,SAASC,iBAAiB,CAACC,cAAc,EAAEC,UAAU,EAAEC,iBAAiB,EAAE;IACxE,OAAO;QACLC,IAAI,EAAE;YACJC,OAAO,EAAE,IAAI;YACbC,KAAK,EAAE,CAAC;YACFC,IAAI,EAAV,SAAMA,IAAI,CAACH,IAAI,EAAEI,QAAQ;uBAAE,wDAAA,mBAAA;wBAEjBC,SAAS;;;;;0CACbR,cAAc,CAACG,IAAI,CAACM,GAAG,CAAC;;;;;0CACjBR,UAAU;0CACfE,IAAI,CAACM,GAAG;;uCACFP,iBAAiB,CAACQ,QAAQ,CAACC,QAAQ,CAACR,IAAI,CAACM,GAAG,CAAC;;;;uCAF9CR,QAAWW,WAAW,gCAG5B;;;;gCALGJ,SAAS,UAKX,CAAA;6DACGD,QAAQ,CAAC,IAAI,EAAEb,IAAI,CAACc,SAAS,EAAE,SAAS,CAAC,CAAC;;;;6DAE1CD,QAAQ,UAAI,IAAI,CAAC;;;;;;;;;;;iBAE3B,EAAA;aAAA;SACF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