@jpmorganchase/mosaic-plugins 0.1.0-beta.7 → 0.1.0-beta.8
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/CHANGELOG.md +16 -2
- package/dist/$AliasPlugin.js +227 -60
- package/dist/$AliasPlugin.js.map +1 -1
- package/dist/$CodeModPlugin.js +118 -34
- package/dist/$CodeModPlugin.js.map +1 -1
- package/dist/$RefPlugin.js +450 -121
- package/dist/$RefPlugin.js.map +1 -1
- package/dist/$TagPlugin.js +234 -71
- package/dist/$TagPlugin.js.map +1 -1
- package/dist/BreadcrumbsPlugin.js +114 -45
- package/dist/BreadcrumbsPlugin.js.map +1 -1
- package/dist/LazyPagePlugin.js +252 -81
- package/dist/LazyPagePlugin.js.map +1 -1
- package/dist/LocalFolderSavePlugin.js +160 -43
- package/dist/LocalFolderSavePlugin.js.map +1 -1
- package/dist/NextPrevPagePlugin.js +153 -43
- package/dist/NextPrevPagePlugin.js.map +1 -1
- package/dist/PagesWithoutFileExtPlugin.js +117 -34
- package/dist/PagesWithoutFileExtPlugin.js.map +1 -1
- package/dist/SharedConfigPlugin.js +170 -39
- package/dist/SharedConfigPlugin.js.map +1 -1
- package/dist/SidebarPlugin.js +312 -84
- package/dist/SidebarPlugin.js.map +1 -1
- package/dist/SiteMapPlugin.js +90 -36
- package/dist/SiteMapPlugin.js.map +1 -1
- package/dist/__tests__/BreadcrumbsPlugin.test.js +160 -0
- package/dist/__tests__/BreadcrumbsPlugin.test.js.map +1 -0
- package/dist/utils/normaliseRefs.js +276 -74
- package/dist/utils/normaliseRefs.js.map +1 -1
- package/package.json +5 -5
package/dist/$RefPlugin.js
CHANGED
|
@@ -1,144 +1,473 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithoutHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
|
+
}
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
|
+
try {
|
|
11
|
+
var info = gen[key](arg);
|
|
12
|
+
var value = info.value;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
reject(error);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (info.done) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
} else {
|
|
20
|
+
Promise.resolve(value).then(_next, _throw);
|
|
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);
|
|
82
|
+
}
|
|
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";
|
|
22
91
|
function createRefResolver(normalisedRefs, serialiser, mutableFilesystem) {
|
|
23
92
|
return {
|
|
24
93
|
file: {
|
|
25
94
|
canRead: true,
|
|
26
95
|
order: 1,
|
|
27
|
-
read(file, callback) {
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
96
|
+
read: function read(file, callback) {
|
|
97
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
98
|
+
var refedPage;
|
|
99
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
100
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
101
|
+
case 0:
|
|
102
|
+
_ctx.prev = 0;
|
|
103
|
+
_ctx.t0 = normalisedRefs[file.url];
|
|
104
|
+
if (_ctx.t0) {
|
|
105
|
+
_ctx.next = 11;
|
|
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
|
+
}))();
|
|
38
136
|
}
|
|
39
137
|
}
|
|
40
138
|
};
|
|
41
139
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
140
|
+
var findKeys = function(obj, targetProp) {
|
|
141
|
+
var pathParts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
142
|
+
return reduce(obj, function(found, value, key) {
|
|
143
|
+
if (key === targetProp) {
|
|
144
|
+
return found.concat([
|
|
145
|
+
[
|
|
146
|
+
pathParts.concat(String(key)),
|
|
147
|
+
value
|
|
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
|
+
};
|
|
52
158
|
function createPageTest(ignorePages, pageExtensions) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
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
|
+
};
|
|
56
164
|
}
|
|
57
165
|
/**
|
|
58
166
|
* Plugin that scrapes `$ref` properties from page metadata and also applies all refs stored in `config.data.refs`.
|
|
59
167
|
* Other plugins can use `setRef` to apply new refs, as long as they call it before this plugin has reaches `$beforeSend`
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
168
|
+
*/ var $RefPlugin = {
|
|
169
|
+
afterUpdate: function afterUpdate(mutableFilesystem, param) {
|
|
170
|
+
var ignorePages = param.ignorePages, globalFilesystem = param.globalFilesystem, serialiser = param.serialiser, pageExtensions = param.pageExtensions, globalConfig = param.globalConfig;
|
|
171
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
172
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
173
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
174
|
+
case 0:
|
|
175
|
+
mutableFilesystem.__internal_do_not_use_addReadFileHook(function() {
|
|
176
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee(pagePath, fileData) {
|
|
177
|
+
var normalisedRef, resolve, refParser, resolved, serialisedPage;
|
|
178
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
179
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
180
|
+
case 0:
|
|
181
|
+
if (!globalConfig.data.globalRefs[pagePath]) {
|
|
182
|
+
_ctx.next = 25;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
_ctx.t0 = merge;
|
|
186
|
+
_ctx.next = 4;
|
|
187
|
+
return serialiser.deserialise(pagePath, fileData);
|
|
188
|
+
case 4:
|
|
189
|
+
_ctx.t1 = _ctx.sent;
|
|
190
|
+
_ctx.next = 7;
|
|
191
|
+
return normaliseRefs(String(pagePath), globalConfig.data.globalRefs[pagePath], globalFilesystem, pageExtensions, ignorePages);
|
|
192
|
+
case 7:
|
|
193
|
+
_ctx.t2 = _ctx.sent;
|
|
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();
|
|
83
237
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
238
|
+
}, _callee);
|
|
239
|
+
}))();
|
|
87
240
|
},
|
|
88
|
-
$beforeSend(mutableFilesystem,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
241
|
+
$beforeSend: function $beforeSend(mutableFilesystem, param) {
|
|
242
|
+
var config = param.config, serialiser = param.serialiser, pageExtensions = param.pageExtensions, ignorePages = param.ignorePages;
|
|
243
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
244
|
+
var normalisedRefs, fullPath, page, resolve, refParser, fullPath1, page1, resolved, fullPath2;
|
|
245
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
246
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
247
|
+
case 0:
|
|
248
|
+
// Prevent any more refs being set after this lifecycle has been called - as they won't take effect
|
|
249
|
+
config.setRef = function() {
|
|
250
|
+
throw new Error("Cannot set refs after `RefPlugin` has reached `$beforeSend` lifecycle phase.");
|
|
251
|
+
};
|
|
252
|
+
normalisedRefs = {};
|
|
253
|
+
if (!config.data.refs) {
|
|
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
|
+
}
|
|
110
301
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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();
|
|
121
337
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
338
|
+
}, _callee, null, [
|
|
339
|
+
[
|
|
340
|
+
28,
|
|
341
|
+
35
|
|
342
|
+
]
|
|
343
|
+
]);
|
|
344
|
+
}))();
|
|
124
345
|
},
|
|
125
|
-
$afterSource(pages,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
346
|
+
$afterSource: function $afterSource(pages, param) {
|
|
347
|
+
var config = param.config, ignorePages = param.ignorePages, pageExtensions = param.pageExtensions;
|
|
348
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
349
|
+
var isNonHiddenPage, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, page, refs, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, ref, _config;
|
|
350
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
351
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
352
|
+
case 0:
|
|
353
|
+
isNonHiddenPage = createPageTest(ignorePages, pageExtensions);
|
|
354
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
355
|
+
_ctx.prev = 2;
|
|
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();
|
|
137
441
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
442
|
+
}, _callee, null, [
|
|
443
|
+
[
|
|
444
|
+
2,
|
|
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
|
+
}))();
|
|
141
469
|
}
|
|
142
470
|
};
|
|
143
|
-
|
|
471
|
+
export default $RefPlugin;
|
|
472
|
+
|
|
144
473
|
//# sourceMappingURL=$RefPlugin.js.map
|
package/dist/$RefPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$RefPlugin.js","sourceRoot":"","sources":["../src/$RefP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AAU,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAC/D,CAAC;iBACH;aACF;QACH,CAAC;KAAA;IACK,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE;;YAC/D,MAAM,eAAe,GAAG,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAEpE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;oBACnC,SAAS;iBACV;gBACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAEpC,IAAI,IAAI,CAAC,MAAM,EAAE;oBACf,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;wBACtB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC;qBACtC;iBACF;aACF;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;CACF,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
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,CAAC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