superbee 0.1.6 → 0.2.1-pre.1
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 +13 -5
- package/SKILL.md +6 -0
- package/dist/publication-bridge.mjs +556 -1200
- package/dist/publication.mjs +1154 -1790
- package/dist/superbee.mjs +5613 -4543
- package/package.json +5 -3
|
@@ -32,278 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
34
|
|
|
35
|
-
// ../../node_modules/kind-of/index.js
|
|
36
|
-
var require_kind_of = __commonJS({
|
|
37
|
-
"../../node_modules/kind-of/index.js"(exports2, module2) {
|
|
38
|
-
var toString = Object.prototype.toString;
|
|
39
|
-
module2.exports = function kindOf2(val) {
|
|
40
|
-
if (val === void 0) return "undefined";
|
|
41
|
-
if (val === null) return "null";
|
|
42
|
-
var type = typeof val;
|
|
43
|
-
if (type === "boolean") return "boolean";
|
|
44
|
-
if (type === "string") return "string";
|
|
45
|
-
if (type === "number") return "number";
|
|
46
|
-
if (type === "symbol") return "symbol";
|
|
47
|
-
if (type === "function") {
|
|
48
|
-
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
|
49
|
-
}
|
|
50
|
-
if (isArray(val)) return "array";
|
|
51
|
-
if (isBuffer(val)) return "buffer";
|
|
52
|
-
if (isArguments(val)) return "arguments";
|
|
53
|
-
if (isDate(val)) return "date";
|
|
54
|
-
if (isError(val)) return "error";
|
|
55
|
-
if (isRegexp(val)) return "regexp";
|
|
56
|
-
switch (ctorName(val)) {
|
|
57
|
-
case "Symbol":
|
|
58
|
-
return "symbol";
|
|
59
|
-
case "Promise":
|
|
60
|
-
return "promise";
|
|
61
|
-
// Set, Map, WeakSet, WeakMap
|
|
62
|
-
case "WeakMap":
|
|
63
|
-
return "weakmap";
|
|
64
|
-
case "WeakSet":
|
|
65
|
-
return "weakset";
|
|
66
|
-
case "Map":
|
|
67
|
-
return "map";
|
|
68
|
-
case "Set":
|
|
69
|
-
return "set";
|
|
70
|
-
// 8-bit typed arrays
|
|
71
|
-
case "Int8Array":
|
|
72
|
-
return "int8array";
|
|
73
|
-
case "Uint8Array":
|
|
74
|
-
return "uint8array";
|
|
75
|
-
case "Uint8ClampedArray":
|
|
76
|
-
return "uint8clampedarray";
|
|
77
|
-
// 16-bit typed arrays
|
|
78
|
-
case "Int16Array":
|
|
79
|
-
return "int16array";
|
|
80
|
-
case "Uint16Array":
|
|
81
|
-
return "uint16array";
|
|
82
|
-
// 32-bit typed arrays
|
|
83
|
-
case "Int32Array":
|
|
84
|
-
return "int32array";
|
|
85
|
-
case "Uint32Array":
|
|
86
|
-
return "uint32array";
|
|
87
|
-
case "Float32Array":
|
|
88
|
-
return "float32array";
|
|
89
|
-
case "Float64Array":
|
|
90
|
-
return "float64array";
|
|
91
|
-
}
|
|
92
|
-
if (isGeneratorObj(val)) {
|
|
93
|
-
return "generator";
|
|
94
|
-
}
|
|
95
|
-
type = toString.call(val);
|
|
96
|
-
switch (type) {
|
|
97
|
-
case "[object Object]":
|
|
98
|
-
return "object";
|
|
99
|
-
// iterators
|
|
100
|
-
case "[object Map Iterator]":
|
|
101
|
-
return "mapiterator";
|
|
102
|
-
case "[object Set Iterator]":
|
|
103
|
-
return "setiterator";
|
|
104
|
-
case "[object String Iterator]":
|
|
105
|
-
return "stringiterator";
|
|
106
|
-
case "[object Array Iterator]":
|
|
107
|
-
return "arrayiterator";
|
|
108
|
-
}
|
|
109
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
110
|
-
};
|
|
111
|
-
function ctorName(val) {
|
|
112
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
113
|
-
}
|
|
114
|
-
function isArray(val) {
|
|
115
|
-
if (Array.isArray) return Array.isArray(val);
|
|
116
|
-
return val instanceof Array;
|
|
117
|
-
}
|
|
118
|
-
function isError(val) {
|
|
119
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
120
|
-
}
|
|
121
|
-
function isDate(val) {
|
|
122
|
-
if (val instanceof Date) return true;
|
|
123
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
124
|
-
}
|
|
125
|
-
function isRegexp(val) {
|
|
126
|
-
if (val instanceof RegExp) return true;
|
|
127
|
-
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
|
|
128
|
-
}
|
|
129
|
-
function isGeneratorFn(name, val) {
|
|
130
|
-
return ctorName(name) === "GeneratorFunction";
|
|
131
|
-
}
|
|
132
|
-
function isGeneratorObj(val) {
|
|
133
|
-
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
|
|
134
|
-
}
|
|
135
|
-
function isArguments(val) {
|
|
136
|
-
try {
|
|
137
|
-
if (typeof val.length === "number" && typeof val.callee === "function") {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
} catch (err) {
|
|
141
|
-
if (err.message.indexOf("callee") !== -1) {
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
function isBuffer(val) {
|
|
148
|
-
if (val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
149
|
-
return val.constructor.isBuffer(val);
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// ../../node_modules/is-extendable/index.js
|
|
157
|
-
var require_is_extendable = __commonJS({
|
|
158
|
-
"../../node_modules/is-extendable/index.js"(exports2, module2) {
|
|
159
|
-
"use strict";
|
|
160
|
-
module2.exports = function isExtendable(val) {
|
|
161
|
-
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// ../../node_modules/extend-shallow/index.js
|
|
167
|
-
var require_extend_shallow = __commonJS({
|
|
168
|
-
"../../node_modules/extend-shallow/index.js"(exports2, module2) {
|
|
169
|
-
"use strict";
|
|
170
|
-
var isObject2 = require_is_extendable();
|
|
171
|
-
module2.exports = function extend(o) {
|
|
172
|
-
if (!isObject2(o)) {
|
|
173
|
-
o = {};
|
|
174
|
-
}
|
|
175
|
-
var len = arguments.length;
|
|
176
|
-
for (var i = 1; i < len; i++) {
|
|
177
|
-
var obj = arguments[i];
|
|
178
|
-
if (isObject2(obj)) {
|
|
179
|
-
assign(o, obj);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return o;
|
|
183
|
-
};
|
|
184
|
-
function assign(a, b) {
|
|
185
|
-
for (var key in b) {
|
|
186
|
-
if (hasOwn2(b, key)) {
|
|
187
|
-
a[key] = b[key];
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
function hasOwn2(obj, key) {
|
|
192
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// ../../node_modules/section-matter/index.js
|
|
198
|
-
var require_section_matter = __commonJS({
|
|
199
|
-
"../../node_modules/section-matter/index.js"(exports2, module2) {
|
|
200
|
-
"use strict";
|
|
201
|
-
var typeOf = require_kind_of();
|
|
202
|
-
var extend = require_extend_shallow();
|
|
203
|
-
module2.exports = function(input, options2) {
|
|
204
|
-
if (typeof options2 === "function") {
|
|
205
|
-
options2 = { parse: options2 };
|
|
206
|
-
}
|
|
207
|
-
var file = toObject(input);
|
|
208
|
-
var defaults = { section_delimiter: "---", parse: identity };
|
|
209
|
-
var opts = extend({}, defaults, options2);
|
|
210
|
-
var delim = opts.section_delimiter;
|
|
211
|
-
var lines = file.content.split(/\r?\n/);
|
|
212
|
-
var sections = null;
|
|
213
|
-
var section = createSection();
|
|
214
|
-
var content = [];
|
|
215
|
-
var stack = [];
|
|
216
|
-
function initSections(val) {
|
|
217
|
-
file.content = val;
|
|
218
|
-
sections = [];
|
|
219
|
-
content = [];
|
|
220
|
-
}
|
|
221
|
-
function closeSection(val) {
|
|
222
|
-
if (stack.length) {
|
|
223
|
-
section.key = getKey(stack[0], delim);
|
|
224
|
-
section.content = val;
|
|
225
|
-
opts.parse(section, sections);
|
|
226
|
-
sections.push(section);
|
|
227
|
-
section = createSection();
|
|
228
|
-
content = [];
|
|
229
|
-
stack = [];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
for (var i = 0; i < lines.length; i++) {
|
|
233
|
-
var line = lines[i];
|
|
234
|
-
var len = stack.length;
|
|
235
|
-
var ln = line.trim();
|
|
236
|
-
if (isDelimiter(ln, delim)) {
|
|
237
|
-
if (ln.length === 3 && i !== 0) {
|
|
238
|
-
if (len === 0 || len === 2) {
|
|
239
|
-
content.push(line);
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
stack.push(ln);
|
|
243
|
-
section.data = content.join("\n");
|
|
244
|
-
content = [];
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
if (sections === null) {
|
|
248
|
-
initSections(content.join("\n"));
|
|
249
|
-
}
|
|
250
|
-
if (len === 2) {
|
|
251
|
-
closeSection(content.join("\n"));
|
|
252
|
-
}
|
|
253
|
-
stack.push(ln);
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
content.push(line);
|
|
257
|
-
}
|
|
258
|
-
if (sections === null) {
|
|
259
|
-
initSections(content.join("\n"));
|
|
260
|
-
} else {
|
|
261
|
-
closeSection(content.join("\n"));
|
|
262
|
-
}
|
|
263
|
-
file.sections = sections;
|
|
264
|
-
return file;
|
|
265
|
-
};
|
|
266
|
-
function isDelimiter(line, delim) {
|
|
267
|
-
if (line.slice(0, delim.length) !== delim) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
function toObject(input) {
|
|
276
|
-
if (typeOf(input) !== "object") {
|
|
277
|
-
input = { content: input };
|
|
278
|
-
}
|
|
279
|
-
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
|
280
|
-
throw new TypeError("expected a buffer or string");
|
|
281
|
-
}
|
|
282
|
-
input.content = input.content.toString();
|
|
283
|
-
input.sections = [];
|
|
284
|
-
return input;
|
|
285
|
-
}
|
|
286
|
-
function getKey(val, delim) {
|
|
287
|
-
return val ? val.slice(delim.length).trim() : "";
|
|
288
|
-
}
|
|
289
|
-
function createSection() {
|
|
290
|
-
return { key: "", data: "", content: "" };
|
|
291
|
-
}
|
|
292
|
-
function identity(val) {
|
|
293
|
-
return val;
|
|
294
|
-
}
|
|
295
|
-
function isBuffer(val) {
|
|
296
|
-
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
297
|
-
return val.constructor.isBuffer(val);
|
|
298
|
-
}
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
35
|
// ../../node_modules/js-yaml/lib/js-yaml/common.js
|
|
305
36
|
var require_common = __commonJS({
|
|
306
|
-
"../../node_modules/js-yaml/lib/js-yaml/common.js"(
|
|
37
|
+
"../../node_modules/js-yaml/lib/js-yaml/common.js"(exports, module) {
|
|
307
38
|
"use strict";
|
|
308
39
|
function isNothing(subject) {
|
|
309
40
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -337,18 +68,18 @@ var require_common = __commonJS({
|
|
|
337
68
|
function isNegativeZero(number) {
|
|
338
69
|
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
339
70
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
71
|
+
module.exports.isNothing = isNothing;
|
|
72
|
+
module.exports.isObject = isObject2;
|
|
73
|
+
module.exports.toArray = toArray;
|
|
74
|
+
module.exports.repeat = repeat;
|
|
75
|
+
module.exports.isNegativeZero = isNegativeZero;
|
|
76
|
+
module.exports.extend = extend;
|
|
346
77
|
}
|
|
347
78
|
});
|
|
348
79
|
|
|
349
80
|
// ../../node_modules/js-yaml/lib/js-yaml/exception.js
|
|
350
81
|
var require_exception = __commonJS({
|
|
351
|
-
"../../node_modules/js-yaml/lib/js-yaml/exception.js"(
|
|
82
|
+
"../../node_modules/js-yaml/lib/js-yaml/exception.js"(exports, module) {
|
|
352
83
|
"use strict";
|
|
353
84
|
function YAMLException(reason, mark) {
|
|
354
85
|
Error.call(this);
|
|
@@ -372,13 +103,13 @@ var require_exception = __commonJS({
|
|
|
372
103
|
}
|
|
373
104
|
return result;
|
|
374
105
|
};
|
|
375
|
-
|
|
106
|
+
module.exports = YAMLException;
|
|
376
107
|
}
|
|
377
108
|
});
|
|
378
109
|
|
|
379
110
|
// ../../node_modules/js-yaml/lib/js-yaml/mark.js
|
|
380
111
|
var require_mark = __commonJS({
|
|
381
|
-
"../../node_modules/js-yaml/lib/js-yaml/mark.js"(
|
|
112
|
+
"../../node_modules/js-yaml/lib/js-yaml/mark.js"(exports, module) {
|
|
382
113
|
"use strict";
|
|
383
114
|
var common = require_common();
|
|
384
115
|
function Mark(name, buffer, position, line, column) {
|
|
@@ -430,13 +161,13 @@ var require_mark = __commonJS({
|
|
|
430
161
|
}
|
|
431
162
|
return where;
|
|
432
163
|
};
|
|
433
|
-
|
|
164
|
+
module.exports = Mark;
|
|
434
165
|
}
|
|
435
166
|
});
|
|
436
167
|
|
|
437
168
|
// ../../node_modules/js-yaml/lib/js-yaml/type.js
|
|
438
169
|
var require_type = __commonJS({
|
|
439
|
-
"../../node_modules/js-yaml/lib/js-yaml/type.js"(
|
|
170
|
+
"../../node_modules/js-yaml/lib/js-yaml/type.js"(exports, module) {
|
|
440
171
|
"use strict";
|
|
441
172
|
var YAMLException = require_exception();
|
|
442
173
|
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
@@ -465,37 +196,37 @@ var require_type = __commonJS({
|
|
|
465
196
|
}
|
|
466
197
|
return result;
|
|
467
198
|
}
|
|
468
|
-
function Type(tag,
|
|
469
|
-
|
|
470
|
-
Object.keys(
|
|
199
|
+
function Type(tag, options) {
|
|
200
|
+
options = options || {};
|
|
201
|
+
Object.keys(options).forEach(function(name) {
|
|
471
202
|
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
472
203
|
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
473
204
|
}
|
|
474
205
|
});
|
|
475
206
|
this.tag = tag;
|
|
476
|
-
this.kind =
|
|
477
|
-
this.resolve =
|
|
207
|
+
this.kind = options["kind"] || null;
|
|
208
|
+
this.resolve = options["resolve"] || function() {
|
|
478
209
|
return true;
|
|
479
210
|
};
|
|
480
|
-
this.construct =
|
|
211
|
+
this.construct = options["construct"] || function(data) {
|
|
481
212
|
return data;
|
|
482
213
|
};
|
|
483
|
-
this.instanceOf =
|
|
484
|
-
this.predicate =
|
|
485
|
-
this.represent =
|
|
486
|
-
this.defaultStyle =
|
|
487
|
-
this.styleAliases = compileStyleAliases(
|
|
214
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
215
|
+
this.predicate = options["predicate"] || null;
|
|
216
|
+
this.represent = options["represent"] || null;
|
|
217
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
218
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
488
219
|
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
489
220
|
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
490
221
|
}
|
|
491
222
|
}
|
|
492
|
-
|
|
223
|
+
module.exports = Type;
|
|
493
224
|
}
|
|
494
225
|
});
|
|
495
226
|
|
|
496
227
|
// ../../node_modules/js-yaml/lib/js-yaml/schema.js
|
|
497
228
|
var require_schema = __commonJS({
|
|
498
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema.js"(
|
|
229
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema.js"(exports, module) {
|
|
499
230
|
"use strict";
|
|
500
231
|
var common = require_common();
|
|
501
232
|
var YAMLException = require_exception();
|
|
@@ -577,16 +308,16 @@ var require_schema = __commonJS({
|
|
|
577
308
|
explicit: types
|
|
578
309
|
});
|
|
579
310
|
};
|
|
580
|
-
|
|
311
|
+
module.exports = Schema;
|
|
581
312
|
}
|
|
582
313
|
});
|
|
583
314
|
|
|
584
315
|
// ../../node_modules/js-yaml/lib/js-yaml/type/str.js
|
|
585
316
|
var require_str = __commonJS({
|
|
586
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/str.js"(
|
|
317
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/str.js"(exports, module) {
|
|
587
318
|
"use strict";
|
|
588
319
|
var Type = require_type();
|
|
589
|
-
|
|
320
|
+
module.exports = new Type("tag:yaml.org,2002:str", {
|
|
590
321
|
kind: "scalar",
|
|
591
322
|
construct: function(data) {
|
|
592
323
|
return data !== null ? data : "";
|
|
@@ -597,10 +328,10 @@ var require_str = __commonJS({
|
|
|
597
328
|
|
|
598
329
|
// ../../node_modules/js-yaml/lib/js-yaml/type/seq.js
|
|
599
330
|
var require_seq = __commonJS({
|
|
600
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/seq.js"(
|
|
331
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports, module) {
|
|
601
332
|
"use strict";
|
|
602
333
|
var Type = require_type();
|
|
603
|
-
|
|
334
|
+
module.exports = new Type("tag:yaml.org,2002:seq", {
|
|
604
335
|
kind: "sequence",
|
|
605
336
|
construct: function(data) {
|
|
606
337
|
return data !== null ? data : [];
|
|
@@ -611,10 +342,10 @@ var require_seq = __commonJS({
|
|
|
611
342
|
|
|
612
343
|
// ../../node_modules/js-yaml/lib/js-yaml/type/map.js
|
|
613
344
|
var require_map = __commonJS({
|
|
614
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/map.js"(
|
|
345
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/map.js"(exports, module) {
|
|
615
346
|
"use strict";
|
|
616
347
|
var Type = require_type();
|
|
617
|
-
|
|
348
|
+
module.exports = new Type("tag:yaml.org,2002:map", {
|
|
618
349
|
kind: "mapping",
|
|
619
350
|
construct: function(data) {
|
|
620
351
|
return data !== null ? data : {};
|
|
@@ -625,10 +356,10 @@ var require_map = __commonJS({
|
|
|
625
356
|
|
|
626
357
|
// ../../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
|
627
358
|
var require_failsafe = __commonJS({
|
|
628
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(
|
|
359
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports, module) {
|
|
629
360
|
"use strict";
|
|
630
361
|
var Schema = require_schema();
|
|
631
|
-
|
|
362
|
+
module.exports = new Schema({
|
|
632
363
|
explicit: [
|
|
633
364
|
require_str(),
|
|
634
365
|
require_seq(),
|
|
@@ -640,7 +371,7 @@ var require_failsafe = __commonJS({
|
|
|
640
371
|
|
|
641
372
|
// ../../node_modules/js-yaml/lib/js-yaml/type/null.js
|
|
642
373
|
var require_null = __commonJS({
|
|
643
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/null.js"(
|
|
374
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/null.js"(exports, module) {
|
|
644
375
|
"use strict";
|
|
645
376
|
var Type = require_type();
|
|
646
377
|
function resolveYamlNull(data) {
|
|
@@ -654,7 +385,7 @@ var require_null = __commonJS({
|
|
|
654
385
|
function isNull(object) {
|
|
655
386
|
return object === null;
|
|
656
387
|
}
|
|
657
|
-
|
|
388
|
+
module.exports = new Type("tag:yaml.org,2002:null", {
|
|
658
389
|
kind: "scalar",
|
|
659
390
|
resolve: resolveYamlNull,
|
|
660
391
|
construct: constructYamlNull,
|
|
@@ -680,7 +411,7 @@ var require_null = __commonJS({
|
|
|
680
411
|
|
|
681
412
|
// ../../node_modules/js-yaml/lib/js-yaml/type/bool.js
|
|
682
413
|
var require_bool = __commonJS({
|
|
683
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/bool.js"(
|
|
414
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports, module) {
|
|
684
415
|
"use strict";
|
|
685
416
|
var Type = require_type();
|
|
686
417
|
function resolveYamlBoolean(data) {
|
|
@@ -694,7 +425,7 @@ var require_bool = __commonJS({
|
|
|
694
425
|
function isBoolean(object) {
|
|
695
426
|
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
696
427
|
}
|
|
697
|
-
|
|
428
|
+
module.exports = new Type("tag:yaml.org,2002:bool", {
|
|
698
429
|
kind: "scalar",
|
|
699
430
|
resolve: resolveYamlBoolean,
|
|
700
431
|
construct: constructYamlBoolean,
|
|
@@ -717,7 +448,7 @@ var require_bool = __commonJS({
|
|
|
717
448
|
|
|
718
449
|
// ../../node_modules/js-yaml/lib/js-yaml/type/int.js
|
|
719
450
|
var require_int = __commonJS({
|
|
720
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/int.js"(
|
|
451
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/int.js"(exports, module) {
|
|
721
452
|
"use strict";
|
|
722
453
|
var common = require_common();
|
|
723
454
|
var Type = require_type();
|
|
@@ -817,7 +548,7 @@ var require_int = __commonJS({
|
|
|
817
548
|
function isInteger(object) {
|
|
818
549
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
819
550
|
}
|
|
820
|
-
|
|
551
|
+
module.exports = new Type("tag:yaml.org,2002:int", {
|
|
821
552
|
kind: "scalar",
|
|
822
553
|
resolve: resolveYamlInteger,
|
|
823
554
|
construct: constructYamlInteger,
|
|
@@ -850,7 +581,7 @@ var require_int = __commonJS({
|
|
|
850
581
|
|
|
851
582
|
// ../../node_modules/js-yaml/lib/js-yaml/type/float.js
|
|
852
583
|
var require_float = __commonJS({
|
|
853
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/float.js"(
|
|
584
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/float.js"(exports, module) {
|
|
854
585
|
"use strict";
|
|
855
586
|
var common = require_common();
|
|
856
587
|
var Type = require_type();
|
|
@@ -932,7 +663,7 @@ var require_float = __commonJS({
|
|
|
932
663
|
function isFloat(object) {
|
|
933
664
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
934
665
|
}
|
|
935
|
-
|
|
666
|
+
module.exports = new Type("tag:yaml.org,2002:float", {
|
|
936
667
|
kind: "scalar",
|
|
937
668
|
resolve: resolveYamlFloat,
|
|
938
669
|
construct: constructYamlFloat,
|
|
@@ -945,10 +676,10 @@ var require_float = __commonJS({
|
|
|
945
676
|
|
|
946
677
|
// ../../node_modules/js-yaml/lib/js-yaml/schema/json.js
|
|
947
678
|
var require_json = __commonJS({
|
|
948
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema/json.js"(
|
|
679
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports, module) {
|
|
949
680
|
"use strict";
|
|
950
681
|
var Schema = require_schema();
|
|
951
|
-
|
|
682
|
+
module.exports = new Schema({
|
|
952
683
|
include: [
|
|
953
684
|
require_failsafe()
|
|
954
685
|
],
|
|
@@ -964,10 +695,10 @@ var require_json = __commonJS({
|
|
|
964
695
|
|
|
965
696
|
// ../../node_modules/js-yaml/lib/js-yaml/schema/core.js
|
|
966
697
|
var require_core = __commonJS({
|
|
967
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema/core.js"(
|
|
698
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports, module) {
|
|
968
699
|
"use strict";
|
|
969
700
|
var Schema = require_schema();
|
|
970
|
-
|
|
701
|
+
module.exports = new Schema({
|
|
971
702
|
include: [
|
|
972
703
|
require_json()
|
|
973
704
|
]
|
|
@@ -977,7 +708,7 @@ var require_core = __commonJS({
|
|
|
977
708
|
|
|
978
709
|
// ../../node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
|
979
710
|
var require_timestamp = __commonJS({
|
|
980
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(
|
|
711
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports, module) {
|
|
981
712
|
"use strict";
|
|
982
713
|
var Type = require_type();
|
|
983
714
|
var YAML_DATE_REGEXP = new RegExp(
|
|
@@ -1026,7 +757,7 @@ var require_timestamp = __commonJS({
|
|
|
1026
757
|
function representYamlTimestamp(object) {
|
|
1027
758
|
return object.toISOString();
|
|
1028
759
|
}
|
|
1029
|
-
|
|
760
|
+
module.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
1030
761
|
kind: "scalar",
|
|
1031
762
|
resolve: resolveYamlTimestamp,
|
|
1032
763
|
construct: constructYamlTimestamp,
|
|
@@ -1038,13 +769,13 @@ var require_timestamp = __commonJS({
|
|
|
1038
769
|
|
|
1039
770
|
// ../../node_modules/js-yaml/lib/js-yaml/type/merge.js
|
|
1040
771
|
var require_merge = __commonJS({
|
|
1041
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/merge.js"(
|
|
772
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports, module) {
|
|
1042
773
|
"use strict";
|
|
1043
774
|
var Type = require_type();
|
|
1044
775
|
function resolveYamlMerge(data) {
|
|
1045
776
|
return data === "<<" || data === null;
|
|
1046
777
|
}
|
|
1047
|
-
|
|
778
|
+
module.exports = new Type("tag:yaml.org,2002:merge", {
|
|
1048
779
|
kind: "scalar",
|
|
1049
780
|
resolve: resolveYamlMerge
|
|
1050
781
|
});
|
|
@@ -1053,7 +784,7 @@ var require_merge = __commonJS({
|
|
|
1053
784
|
|
|
1054
785
|
// ../../node_modules/js-yaml/lib/js-yaml/type/binary.js
|
|
1055
786
|
var require_binary = __commonJS({
|
|
1056
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/binary.js"(
|
|
787
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports, module) {
|
|
1057
788
|
"use strict";
|
|
1058
789
|
var NodeBuffer;
|
|
1059
790
|
try {
|
|
@@ -1134,7 +865,7 @@ var require_binary = __commonJS({
|
|
|
1134
865
|
function isBinary(object) {
|
|
1135
866
|
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
1136
867
|
}
|
|
1137
|
-
|
|
868
|
+
module.exports = new Type("tag:yaml.org,2002:binary", {
|
|
1138
869
|
kind: "scalar",
|
|
1139
870
|
resolve: resolveYamlBinary,
|
|
1140
871
|
construct: constructYamlBinary,
|
|
@@ -1146,7 +877,7 @@ var require_binary = __commonJS({
|
|
|
1146
877
|
|
|
1147
878
|
// ../../node_modules/js-yaml/lib/js-yaml/type/omap.js
|
|
1148
879
|
var require_omap = __commonJS({
|
|
1149
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/omap.js"(
|
|
880
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports, module) {
|
|
1150
881
|
"use strict";
|
|
1151
882
|
var Type = require_type();
|
|
1152
883
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -1173,7 +904,7 @@ var require_omap = __commonJS({
|
|
|
1173
904
|
function constructYamlOmap(data) {
|
|
1174
905
|
return data !== null ? data : [];
|
|
1175
906
|
}
|
|
1176
|
-
|
|
907
|
+
module.exports = new Type("tag:yaml.org,2002:omap", {
|
|
1177
908
|
kind: "sequence",
|
|
1178
909
|
resolve: resolveYamlOmap,
|
|
1179
910
|
construct: constructYamlOmap
|
|
@@ -1183,7 +914,7 @@ var require_omap = __commonJS({
|
|
|
1183
914
|
|
|
1184
915
|
// ../../node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
|
1185
916
|
var require_pairs = __commonJS({
|
|
1186
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/pairs.js"(
|
|
917
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports, module) {
|
|
1187
918
|
"use strict";
|
|
1188
919
|
var Type = require_type();
|
|
1189
920
|
var _toString = Object.prototype.toString;
|
|
@@ -1211,7 +942,7 @@ var require_pairs = __commonJS({
|
|
|
1211
942
|
}
|
|
1212
943
|
return result;
|
|
1213
944
|
}
|
|
1214
|
-
|
|
945
|
+
module.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
1215
946
|
kind: "sequence",
|
|
1216
947
|
resolve: resolveYamlPairs,
|
|
1217
948
|
construct: constructYamlPairs
|
|
@@ -1221,7 +952,7 @@ var require_pairs = __commonJS({
|
|
|
1221
952
|
|
|
1222
953
|
// ../../node_modules/js-yaml/lib/js-yaml/type/set.js
|
|
1223
954
|
var require_set = __commonJS({
|
|
1224
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/set.js"(
|
|
955
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/set.js"(exports, module) {
|
|
1225
956
|
"use strict";
|
|
1226
957
|
var Type = require_type();
|
|
1227
958
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -1238,7 +969,7 @@ var require_set = __commonJS({
|
|
|
1238
969
|
function constructYamlSet(data) {
|
|
1239
970
|
return data !== null ? data : {};
|
|
1240
971
|
}
|
|
1241
|
-
|
|
972
|
+
module.exports = new Type("tag:yaml.org,2002:set", {
|
|
1242
973
|
kind: "mapping",
|
|
1243
974
|
resolve: resolveYamlSet,
|
|
1244
975
|
construct: constructYamlSet
|
|
@@ -1248,10 +979,10 @@ var require_set = __commonJS({
|
|
|
1248
979
|
|
|
1249
980
|
// ../../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
|
1250
981
|
var require_default_safe = __commonJS({
|
|
1251
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(
|
|
982
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports, module) {
|
|
1252
983
|
"use strict";
|
|
1253
984
|
var Schema = require_schema();
|
|
1254
|
-
|
|
985
|
+
module.exports = new Schema({
|
|
1255
986
|
include: [
|
|
1256
987
|
require_core()
|
|
1257
988
|
],
|
|
@@ -1271,7 +1002,7 @@ var require_default_safe = __commonJS({
|
|
|
1271
1002
|
|
|
1272
1003
|
// ../../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
|
1273
1004
|
var require_undefined = __commonJS({
|
|
1274
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(
|
|
1005
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports, module) {
|
|
1275
1006
|
"use strict";
|
|
1276
1007
|
var Type = require_type();
|
|
1277
1008
|
function resolveJavascriptUndefined() {
|
|
@@ -1286,7 +1017,7 @@ var require_undefined = __commonJS({
|
|
|
1286
1017
|
function isUndefined(object) {
|
|
1287
1018
|
return typeof object === "undefined";
|
|
1288
1019
|
}
|
|
1289
|
-
|
|
1020
|
+
module.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
|
1290
1021
|
kind: "scalar",
|
|
1291
1022
|
resolve: resolveJavascriptUndefined,
|
|
1292
1023
|
construct: constructJavascriptUndefined,
|
|
@@ -1298,7 +1029,7 @@ var require_undefined = __commonJS({
|
|
|
1298
1029
|
|
|
1299
1030
|
// ../../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
|
1300
1031
|
var require_regexp = __commonJS({
|
|
1301
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(
|
|
1032
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports, module) {
|
|
1302
1033
|
"use strict";
|
|
1303
1034
|
var Type = require_type();
|
|
1304
1035
|
function resolveJavascriptRegExp(data) {
|
|
@@ -1330,7 +1061,7 @@ var require_regexp = __commonJS({
|
|
|
1330
1061
|
function isRegExp(object) {
|
|
1331
1062
|
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
1332
1063
|
}
|
|
1333
|
-
|
|
1064
|
+
module.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
|
1334
1065
|
kind: "scalar",
|
|
1335
1066
|
resolve: resolveJavascriptRegExp,
|
|
1336
1067
|
construct: constructJavascriptRegExp,
|
|
@@ -1342,7 +1073,7 @@ var require_regexp = __commonJS({
|
|
|
1342
1073
|
|
|
1343
1074
|
// ../../node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
|
1344
1075
|
var require_function = __commonJS({
|
|
1345
|
-
"../../node_modules/js-yaml/lib/js-yaml/type/js/function.js"(
|
|
1076
|
+
"../../node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports, module) {
|
|
1346
1077
|
"use strict";
|
|
1347
1078
|
var esprima;
|
|
1348
1079
|
try {
|
|
@@ -1385,7 +1116,7 @@ var require_function = __commonJS({
|
|
|
1385
1116
|
function isFunction(object) {
|
|
1386
1117
|
return Object.prototype.toString.call(object) === "[object Function]";
|
|
1387
1118
|
}
|
|
1388
|
-
|
|
1119
|
+
module.exports = new Type("tag:yaml.org,2002:js/function", {
|
|
1389
1120
|
kind: "scalar",
|
|
1390
1121
|
resolve: resolveJavascriptFunction,
|
|
1391
1122
|
construct: constructJavascriptFunction,
|
|
@@ -1397,10 +1128,10 @@ var require_function = __commonJS({
|
|
|
1397
1128
|
|
|
1398
1129
|
// ../../node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
|
1399
1130
|
var require_default_full = __commonJS({
|
|
1400
|
-
"../../node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(
|
|
1131
|
+
"../../node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports, module) {
|
|
1401
1132
|
"use strict";
|
|
1402
1133
|
var Schema = require_schema();
|
|
1403
|
-
|
|
1134
|
+
module.exports = Schema.DEFAULT = new Schema({
|
|
1404
1135
|
include: [
|
|
1405
1136
|
require_default_safe()
|
|
1406
1137
|
],
|
|
@@ -1415,7 +1146,7 @@ var require_default_full = __commonJS({
|
|
|
1415
1146
|
|
|
1416
1147
|
// ../../node_modules/js-yaml/lib/js-yaml/loader.js
|
|
1417
1148
|
var require_loader = __commonJS({
|
|
1418
|
-
"../../node_modules/js-yaml/lib/js-yaml/loader.js"(
|
|
1149
|
+
"../../node_modules/js-yaml/lib/js-yaml/loader.js"(exports, module) {
|
|
1419
1150
|
"use strict";
|
|
1420
1151
|
var common = require_common();
|
|
1421
1152
|
var YAMLException = require_exception();
|
|
@@ -1510,15 +1241,15 @@ var require_loader = __commonJS({
|
|
|
1510
1241
|
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1511
1242
|
}
|
|
1512
1243
|
var i;
|
|
1513
|
-
function State(input,
|
|
1244
|
+
function State(input, options) {
|
|
1514
1245
|
this.input = input;
|
|
1515
|
-
this.filename =
|
|
1516
|
-
this.schema =
|
|
1517
|
-
this.onWarning =
|
|
1518
|
-
this.legacy =
|
|
1519
|
-
this.json =
|
|
1520
|
-
this.listener =
|
|
1521
|
-
this.maxTotalMergeKeys = typeof
|
|
1246
|
+
this.filename = options["filename"] || null;
|
|
1247
|
+
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
1248
|
+
this.onWarning = options["onWarning"] || null;
|
|
1249
|
+
this.legacy = options["legacy"] || false;
|
|
1250
|
+
this.json = options["json"] || false;
|
|
1251
|
+
this.listener = options["listener"] || null;
|
|
1252
|
+
this.maxTotalMergeKeys = typeof options["maxTotalMergeKeys"] === "number" ? options["maxTotalMergeKeys"] : 1e4;
|
|
1522
1253
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
1523
1254
|
this.typeMap = this.schema.compiledTypeMap;
|
|
1524
1255
|
this.length = input.length;
|
|
@@ -2479,9 +2210,9 @@ var require_loader = __commonJS({
|
|
|
2479
2210
|
return;
|
|
2480
2211
|
}
|
|
2481
2212
|
}
|
|
2482
|
-
function loadDocuments(input,
|
|
2213
|
+
function loadDocuments(input, options) {
|
|
2483
2214
|
input = String(input);
|
|
2484
|
-
|
|
2215
|
+
options = options || {};
|
|
2485
2216
|
if (input.length !== 0) {
|
|
2486
2217
|
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2487
2218
|
input += "\n";
|
|
@@ -2490,7 +2221,7 @@ var require_loader = __commonJS({
|
|
|
2490
2221
|
input = input.slice(1);
|
|
2491
2222
|
}
|
|
2492
2223
|
}
|
|
2493
|
-
var state = new State(input,
|
|
2224
|
+
var state = new State(input, options);
|
|
2494
2225
|
var nullpos = input.indexOf("\0");
|
|
2495
2226
|
if (nullpos !== -1) {
|
|
2496
2227
|
state.position = nullpos;
|
|
@@ -2506,12 +2237,12 @@ var require_loader = __commonJS({
|
|
|
2506
2237
|
}
|
|
2507
2238
|
return state.documents;
|
|
2508
2239
|
}
|
|
2509
|
-
function loadAll(input, iterator,
|
|
2510
|
-
if (iterator !== null && typeof iterator === "object" && typeof
|
|
2511
|
-
|
|
2240
|
+
function loadAll(input, iterator, options) {
|
|
2241
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
2242
|
+
options = iterator;
|
|
2512
2243
|
iterator = null;
|
|
2513
2244
|
}
|
|
2514
|
-
var documents = loadDocuments(input,
|
|
2245
|
+
var documents = loadDocuments(input, options);
|
|
2515
2246
|
if (typeof iterator !== "function") {
|
|
2516
2247
|
return documents;
|
|
2517
2248
|
}
|
|
@@ -2519,8 +2250,8 @@ var require_loader = __commonJS({
|
|
|
2519
2250
|
iterator(documents[index]);
|
|
2520
2251
|
}
|
|
2521
2252
|
}
|
|
2522
|
-
function load(input,
|
|
2523
|
-
var documents = loadDocuments(input,
|
|
2253
|
+
function load(input, options) {
|
|
2254
|
+
var documents = loadDocuments(input, options);
|
|
2524
2255
|
if (documents.length === 0) {
|
|
2525
2256
|
return void 0;
|
|
2526
2257
|
} else if (documents.length === 1) {
|
|
@@ -2528,26 +2259,26 @@ var require_loader = __commonJS({
|
|
|
2528
2259
|
}
|
|
2529
2260
|
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2530
2261
|
}
|
|
2531
|
-
function safeLoadAll(input, iterator,
|
|
2532
|
-
if (typeof iterator === "object" && iterator !== null && typeof
|
|
2533
|
-
|
|
2262
|
+
function safeLoadAll(input, iterator, options) {
|
|
2263
|
+
if (typeof iterator === "object" && iterator !== null && typeof options === "undefined") {
|
|
2264
|
+
options = iterator;
|
|
2534
2265
|
iterator = null;
|
|
2535
2266
|
}
|
|
2536
|
-
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA },
|
|
2267
|
+
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
2537
2268
|
}
|
|
2538
|
-
function safeLoad(input,
|
|
2539
|
-
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA },
|
|
2269
|
+
function safeLoad(input, options) {
|
|
2270
|
+
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
2540
2271
|
}
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2272
|
+
module.exports.loadAll = loadAll;
|
|
2273
|
+
module.exports.load = load;
|
|
2274
|
+
module.exports.safeLoadAll = safeLoadAll;
|
|
2275
|
+
module.exports.safeLoad = safeLoad;
|
|
2545
2276
|
}
|
|
2546
2277
|
});
|
|
2547
2278
|
|
|
2548
2279
|
// ../../node_modules/js-yaml/lib/js-yaml/dumper.js
|
|
2549
2280
|
var require_dumper = __commonJS({
|
|
2550
|
-
"../../node_modules/js-yaml/lib/js-yaml/dumper.js"(
|
|
2281
|
+
"../../node_modules/js-yaml/lib/js-yaml/dumper.js"(exports, module) {
|
|
2551
2282
|
"use strict";
|
|
2552
2283
|
var common = require_common();
|
|
2553
2284
|
var YAMLException = require_exception();
|
|
@@ -2649,18 +2380,18 @@ var require_dumper = __commonJS({
|
|
|
2649
2380
|
}
|
|
2650
2381
|
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2651
2382
|
}
|
|
2652
|
-
function State(
|
|
2653
|
-
this.schema =
|
|
2654
|
-
this.indent = Math.max(1,
|
|
2655
|
-
this.noArrayIndent =
|
|
2656
|
-
this.skipInvalid =
|
|
2657
|
-
this.flowLevel = common.isNothing(
|
|
2658
|
-
this.styleMap = compileStyleMap(this.schema,
|
|
2659
|
-
this.sortKeys =
|
|
2660
|
-
this.lineWidth =
|
|
2661
|
-
this.noRefs =
|
|
2662
|
-
this.noCompatMode =
|
|
2663
|
-
this.condenseFlow =
|
|
2383
|
+
function State(options) {
|
|
2384
|
+
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
2385
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
2386
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
2387
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
2388
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
2389
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
2390
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
2391
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
2392
|
+
this.noRefs = options["noRefs"] || false;
|
|
2393
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
2394
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
2664
2395
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
2665
2396
|
this.explicitTypes = this.schema.compiledExplicit;
|
|
2666
2397
|
this.tag = null;
|
|
@@ -2687,11 +2418,11 @@ var require_dumper = __commonJS({
|
|
|
2687
2418
|
function generateNextLine(state, level) {
|
|
2688
2419
|
return "\n" + common.repeat(" ", state.indent * level);
|
|
2689
2420
|
}
|
|
2690
|
-
function testImplicitResolving(state,
|
|
2421
|
+
function testImplicitResolving(state, str) {
|
|
2691
2422
|
var index, length, type;
|
|
2692
2423
|
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2693
2424
|
type = state.implicitTypes[index];
|
|
2694
|
-
if (type.resolve(
|
|
2425
|
+
if (type.resolve(str)) {
|
|
2695
2426
|
return true;
|
|
2696
2427
|
}
|
|
2697
2428
|
}
|
|
@@ -3078,24 +2809,24 @@ var require_dumper = __commonJS({
|
|
|
3078
2809
|
}
|
|
3079
2810
|
}
|
|
3080
2811
|
}
|
|
3081
|
-
function dump(input,
|
|
3082
|
-
|
|
3083
|
-
var state = new State(
|
|
2812
|
+
function dump(input, options) {
|
|
2813
|
+
options = options || {};
|
|
2814
|
+
var state = new State(options);
|
|
3084
2815
|
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
3085
2816
|
if (writeNode(state, 0, input, true, true)) return state.dump + "\n";
|
|
3086
2817
|
return "";
|
|
3087
2818
|
}
|
|
3088
|
-
function safeDump(input,
|
|
3089
|
-
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA },
|
|
2819
|
+
function safeDump(input, options) {
|
|
2820
|
+
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
3090
2821
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
2822
|
+
module.exports.dump = dump;
|
|
2823
|
+
module.exports.safeDump = safeDump;
|
|
3093
2824
|
}
|
|
3094
2825
|
});
|
|
3095
2826
|
|
|
3096
2827
|
// ../../node_modules/js-yaml/lib/js-yaml.js
|
|
3097
2828
|
var require_js_yaml = __commonJS({
|
|
3098
|
-
"../../node_modules/js-yaml/lib/js-yaml.js"(
|
|
2829
|
+
"../../node_modules/js-yaml/lib/js-yaml.js"(exports, module) {
|
|
3099
2830
|
"use strict";
|
|
3100
2831
|
var loader = require_loader();
|
|
3101
2832
|
var dumper = require_dumper();
|
|
@@ -3104,427 +2835,36 @@ var require_js_yaml = __commonJS({
|
|
|
3104
2835
|
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
|
3105
2836
|
};
|
|
3106
2837
|
}
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
2838
|
+
module.exports.Type = require_type();
|
|
2839
|
+
module.exports.Schema = require_schema();
|
|
2840
|
+
module.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
2841
|
+
module.exports.JSON_SCHEMA = require_json();
|
|
2842
|
+
module.exports.CORE_SCHEMA = require_core();
|
|
2843
|
+
module.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
2844
|
+
module.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
|
2845
|
+
module.exports.load = loader.load;
|
|
2846
|
+
module.exports.loadAll = loader.loadAll;
|
|
2847
|
+
module.exports.safeLoad = loader.safeLoad;
|
|
2848
|
+
module.exports.safeLoadAll = loader.safeLoadAll;
|
|
2849
|
+
module.exports.dump = dumper.dump;
|
|
2850
|
+
module.exports.safeDump = dumper.safeDump;
|
|
2851
|
+
module.exports.YAMLException = require_exception();
|
|
2852
|
+
module.exports.MINIMAL_SCHEMA = require_failsafe();
|
|
2853
|
+
module.exports.SAFE_SCHEMA = require_default_safe();
|
|
2854
|
+
module.exports.DEFAULT_SCHEMA = require_default_full();
|
|
2855
|
+
module.exports.scan = deprecated("scan");
|
|
2856
|
+
module.exports.parse = deprecated("parse");
|
|
2857
|
+
module.exports.compose = deprecated("compose");
|
|
2858
|
+
module.exports.addConstructor = deprecated("addConstructor");
|
|
3128
2859
|
}
|
|
3129
2860
|
});
|
|
3130
2861
|
|
|
3131
2862
|
// ../../node_modules/js-yaml/index.js
|
|
3132
2863
|
var require_js_yaml2 = __commonJS({
|
|
3133
|
-
"../../node_modules/js-yaml/index.js"(
|
|
3134
|
-
"use strict";
|
|
3135
|
-
var yaml4 = require_js_yaml();
|
|
3136
|
-
module2.exports = yaml4;
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
|
|
3140
|
-
// ../../node_modules/gray-matter/lib/engines.js
|
|
3141
|
-
var require_engines = __commonJS({
|
|
3142
|
-
"../../node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
3143
|
-
"use strict";
|
|
3144
|
-
var yaml = require_js_yaml2();
|
|
3145
|
-
var engines = exports = module.exports;
|
|
3146
|
-
engines.yaml = {
|
|
3147
|
-
parse: yaml.safeLoad.bind(yaml),
|
|
3148
|
-
stringify: yaml.safeDump.bind(yaml)
|
|
3149
|
-
};
|
|
3150
|
-
engines.json = {
|
|
3151
|
-
parse: JSON.parse.bind(JSON),
|
|
3152
|
-
stringify: function(obj, options2) {
|
|
3153
|
-
const opts = Object.assign({ replacer: null, space: 2 }, options2);
|
|
3154
|
-
return JSON.stringify(obj, opts.replacer, opts.space);
|
|
3155
|
-
}
|
|
3156
|
-
};
|
|
3157
|
-
engines.javascript = {
|
|
3158
|
-
parse: function parse(str, options, wrap) {
|
|
3159
|
-
try {
|
|
3160
|
-
if (wrap !== false) {
|
|
3161
|
-
str = "(function() {\nreturn " + str.trim() + ";\n}());";
|
|
3162
|
-
}
|
|
3163
|
-
return eval(str) || {};
|
|
3164
|
-
} catch (err) {
|
|
3165
|
-
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
|
3166
|
-
return parse(str, options, false);
|
|
3167
|
-
}
|
|
3168
|
-
throw new SyntaxError(err);
|
|
3169
|
-
}
|
|
3170
|
-
},
|
|
3171
|
-
stringify: function() {
|
|
3172
|
-
throw new Error("stringifying JavaScript is not supported");
|
|
3173
|
-
}
|
|
3174
|
-
};
|
|
3175
|
-
}
|
|
3176
|
-
});
|
|
3177
|
-
|
|
3178
|
-
// ../../node_modules/strip-bom-string/index.js
|
|
3179
|
-
var require_strip_bom_string = __commonJS({
|
|
3180
|
-
"../../node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
3181
|
-
"use strict";
|
|
3182
|
-
module2.exports = function(str2) {
|
|
3183
|
-
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
|
3184
|
-
return str2.slice(1);
|
|
3185
|
-
}
|
|
3186
|
-
return str2;
|
|
3187
|
-
};
|
|
3188
|
-
}
|
|
3189
|
-
});
|
|
3190
|
-
|
|
3191
|
-
// ../../node_modules/gray-matter/lib/utils.js
|
|
3192
|
-
var require_utils = __commonJS({
|
|
3193
|
-
"../../node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
3194
|
-
"use strict";
|
|
3195
|
-
var stripBom = require_strip_bom_string();
|
|
3196
|
-
var typeOf = require_kind_of();
|
|
3197
|
-
exports2.define = function(obj, key, val) {
|
|
3198
|
-
Reflect.defineProperty(obj, key, {
|
|
3199
|
-
enumerable: false,
|
|
3200
|
-
configurable: true,
|
|
3201
|
-
writable: true,
|
|
3202
|
-
value: val
|
|
3203
|
-
});
|
|
3204
|
-
};
|
|
3205
|
-
exports2.isBuffer = function(val) {
|
|
3206
|
-
return typeOf(val) === "buffer";
|
|
3207
|
-
};
|
|
3208
|
-
exports2.isObject = function(val) {
|
|
3209
|
-
return typeOf(val) === "object";
|
|
3210
|
-
};
|
|
3211
|
-
exports2.toBuffer = function(input) {
|
|
3212
|
-
return typeof input === "string" ? Buffer.from(input) : input;
|
|
3213
|
-
};
|
|
3214
|
-
exports2.toString = function(input) {
|
|
3215
|
-
if (exports2.isBuffer(input)) return stripBom(String(input));
|
|
3216
|
-
if (typeof input !== "string") {
|
|
3217
|
-
throw new TypeError("expected input to be a string or buffer");
|
|
3218
|
-
}
|
|
3219
|
-
return stripBom(input);
|
|
3220
|
-
};
|
|
3221
|
-
exports2.arrayify = function(val) {
|
|
3222
|
-
return val ? Array.isArray(val) ? val : [val] : [];
|
|
3223
|
-
};
|
|
3224
|
-
exports2.startsWith = function(str2, substr, len) {
|
|
3225
|
-
if (typeof len !== "number") len = substr.length;
|
|
3226
|
-
return str2.slice(0, len) === substr;
|
|
3227
|
-
};
|
|
3228
|
-
}
|
|
3229
|
-
});
|
|
3230
|
-
|
|
3231
|
-
// ../../node_modules/gray-matter/lib/defaults.js
|
|
3232
|
-
var require_defaults = __commonJS({
|
|
3233
|
-
"../../node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
3234
|
-
"use strict";
|
|
3235
|
-
var engines2 = require_engines();
|
|
3236
|
-
var utils = require_utils();
|
|
3237
|
-
module2.exports = function(options2) {
|
|
3238
|
-
const opts = Object.assign({}, options2);
|
|
3239
|
-
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---");
|
|
3240
|
-
if (opts.delimiters.length === 1) {
|
|
3241
|
-
opts.delimiters.push(opts.delimiters[0]);
|
|
3242
|
-
}
|
|
3243
|
-
opts.language = (opts.language || opts.lang || "yaml").toLowerCase();
|
|
3244
|
-
opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines);
|
|
3245
|
-
return opts;
|
|
3246
|
-
};
|
|
3247
|
-
}
|
|
3248
|
-
});
|
|
3249
|
-
|
|
3250
|
-
// ../../node_modules/gray-matter/lib/engine.js
|
|
3251
|
-
var require_engine = __commonJS({
|
|
3252
|
-
"../../node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
3253
|
-
"use strict";
|
|
3254
|
-
module2.exports = function(name, options2) {
|
|
3255
|
-
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
3256
|
-
if (typeof engine === "undefined") {
|
|
3257
|
-
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
3258
|
-
}
|
|
3259
|
-
if (typeof engine === "function") {
|
|
3260
|
-
engine = { parse: engine };
|
|
3261
|
-
}
|
|
3262
|
-
return engine;
|
|
3263
|
-
};
|
|
3264
|
-
function aliase(name) {
|
|
3265
|
-
switch (name.toLowerCase()) {
|
|
3266
|
-
case "js":
|
|
3267
|
-
case "javascript":
|
|
3268
|
-
return "javascript";
|
|
3269
|
-
case "coffee":
|
|
3270
|
-
case "coffeescript":
|
|
3271
|
-
case "cson":
|
|
3272
|
-
return "coffee";
|
|
3273
|
-
case "yaml":
|
|
3274
|
-
case "yml":
|
|
3275
|
-
return "yaml";
|
|
3276
|
-
default: {
|
|
3277
|
-
return name;
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
});
|
|
3283
|
-
|
|
3284
|
-
// ../../node_modules/gray-matter/lib/stringify.js
|
|
3285
|
-
var require_stringify = __commonJS({
|
|
3286
|
-
"../../node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
3287
|
-
"use strict";
|
|
3288
|
-
var typeOf = require_kind_of();
|
|
3289
|
-
var getEngine = require_engine();
|
|
3290
|
-
var defaults = require_defaults();
|
|
3291
|
-
module2.exports = function(file, data, options2) {
|
|
3292
|
-
if (data == null && options2 == null) {
|
|
3293
|
-
switch (typeOf(file)) {
|
|
3294
|
-
case "object":
|
|
3295
|
-
data = file.data;
|
|
3296
|
-
options2 = {};
|
|
3297
|
-
break;
|
|
3298
|
-
case "string":
|
|
3299
|
-
return file;
|
|
3300
|
-
default: {
|
|
3301
|
-
throw new TypeError("expected file to be a string or object");
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
}
|
|
3305
|
-
const str2 = file.content;
|
|
3306
|
-
const opts = defaults(options2);
|
|
3307
|
-
if (data == null) {
|
|
3308
|
-
if (!opts.data) return file;
|
|
3309
|
-
data = opts.data;
|
|
3310
|
-
}
|
|
3311
|
-
const language = file.language || opts.language;
|
|
3312
|
-
const engine = getEngine(language, opts);
|
|
3313
|
-
if (typeof engine.stringify !== "function") {
|
|
3314
|
-
throw new TypeError('expected "' + language + '.stringify" to be a function');
|
|
3315
|
-
}
|
|
3316
|
-
data = Object.assign({}, file.data, data);
|
|
3317
|
-
const open = opts.delimiters[0];
|
|
3318
|
-
const close = opts.delimiters[1];
|
|
3319
|
-
const matter2 = engine.stringify(data, options2).trim();
|
|
3320
|
-
let buf = "";
|
|
3321
|
-
if (matter2 !== "{}") {
|
|
3322
|
-
buf = newline(open) + newline(matter2) + newline(close);
|
|
3323
|
-
}
|
|
3324
|
-
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
|
3325
|
-
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
|
3326
|
-
buf += newline(file.excerpt) + newline(close);
|
|
3327
|
-
}
|
|
3328
|
-
}
|
|
3329
|
-
return buf + newline(str2);
|
|
3330
|
-
};
|
|
3331
|
-
function newline(str2) {
|
|
3332
|
-
return str2.slice(-1) !== "\n" ? str2 + "\n" : str2;
|
|
3333
|
-
}
|
|
3334
|
-
}
|
|
3335
|
-
});
|
|
3336
|
-
|
|
3337
|
-
// ../../node_modules/gray-matter/lib/excerpt.js
|
|
3338
|
-
var require_excerpt = __commonJS({
|
|
3339
|
-
"../../node_modules/gray-matter/lib/excerpt.js"(exports2, module2) {
|
|
3340
|
-
"use strict";
|
|
3341
|
-
var defaults = require_defaults();
|
|
3342
|
-
module2.exports = function(file, options2) {
|
|
3343
|
-
const opts = defaults(options2);
|
|
3344
|
-
if (file.data == null) {
|
|
3345
|
-
file.data = {};
|
|
3346
|
-
}
|
|
3347
|
-
if (typeof opts.excerpt === "function") {
|
|
3348
|
-
return opts.excerpt(file, opts);
|
|
3349
|
-
}
|
|
3350
|
-
const sep = file.data.excerpt_separator || opts.excerpt_separator;
|
|
3351
|
-
if (sep == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
3352
|
-
return file;
|
|
3353
|
-
}
|
|
3354
|
-
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0];
|
|
3355
|
-
const idx = file.content.indexOf(delimiter);
|
|
3356
|
-
if (idx !== -1) {
|
|
3357
|
-
file.excerpt = file.content.slice(0, idx);
|
|
3358
|
-
}
|
|
3359
|
-
return file;
|
|
3360
|
-
};
|
|
3361
|
-
}
|
|
3362
|
-
});
|
|
3363
|
-
|
|
3364
|
-
// ../../node_modules/gray-matter/lib/to-file.js
|
|
3365
|
-
var require_to_file = __commonJS({
|
|
3366
|
-
"../../node_modules/gray-matter/lib/to-file.js"(exports2, module2) {
|
|
3367
|
-
"use strict";
|
|
3368
|
-
var typeOf = require_kind_of();
|
|
3369
|
-
var stringify = require_stringify();
|
|
3370
|
-
var utils = require_utils();
|
|
3371
|
-
module2.exports = function(file) {
|
|
3372
|
-
if (typeOf(file) !== "object") {
|
|
3373
|
-
file = { content: file };
|
|
3374
|
-
}
|
|
3375
|
-
if (typeOf(file.data) !== "object") {
|
|
3376
|
-
file.data = {};
|
|
3377
|
-
}
|
|
3378
|
-
if (file.contents && file.content == null) {
|
|
3379
|
-
file.content = file.contents;
|
|
3380
|
-
}
|
|
3381
|
-
utils.define(file, "orig", utils.toBuffer(file.content));
|
|
3382
|
-
utils.define(file, "language", file.language || "");
|
|
3383
|
-
utils.define(file, "matter", file.matter || "");
|
|
3384
|
-
utils.define(file, "stringify", function(data, options2) {
|
|
3385
|
-
if (options2 && options2.language) {
|
|
3386
|
-
file.language = options2.language;
|
|
3387
|
-
}
|
|
3388
|
-
return stringify(file, data, options2);
|
|
3389
|
-
});
|
|
3390
|
-
file.content = utils.toString(file.content);
|
|
3391
|
-
file.isEmpty = false;
|
|
3392
|
-
file.excerpt = "";
|
|
3393
|
-
return file;
|
|
3394
|
-
};
|
|
3395
|
-
}
|
|
3396
|
-
});
|
|
3397
|
-
|
|
3398
|
-
// ../../node_modules/gray-matter/lib/parse.js
|
|
3399
|
-
var require_parse = __commonJS({
|
|
3400
|
-
"../../node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
|
3401
|
-
"use strict";
|
|
3402
|
-
var getEngine = require_engine();
|
|
3403
|
-
var defaults = require_defaults();
|
|
3404
|
-
module2.exports = function(language, str2, options2) {
|
|
3405
|
-
const opts = defaults(options2);
|
|
3406
|
-
const engine = getEngine(language, opts);
|
|
3407
|
-
if (typeof engine.parse !== "function") {
|
|
3408
|
-
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
3409
|
-
}
|
|
3410
|
-
return engine.parse(str2, opts);
|
|
3411
|
-
};
|
|
3412
|
-
}
|
|
3413
|
-
});
|
|
3414
|
-
|
|
3415
|
-
// ../../node_modules/gray-matter/index.js
|
|
3416
|
-
var require_gray_matter = __commonJS({
|
|
3417
|
-
"../../node_modules/gray-matter/index.js"(exports2, module2) {
|
|
2864
|
+
"../../node_modules/js-yaml/index.js"(exports, module) {
|
|
3418
2865
|
"use strict";
|
|
3419
|
-
var
|
|
3420
|
-
|
|
3421
|
-
var defaults = require_defaults();
|
|
3422
|
-
var stringify = require_stringify();
|
|
3423
|
-
var excerpt = require_excerpt();
|
|
3424
|
-
var engines2 = require_engines();
|
|
3425
|
-
var toFile = require_to_file();
|
|
3426
|
-
var parse2 = require_parse();
|
|
3427
|
-
var utils = require_utils();
|
|
3428
|
-
function matter2(input, options2) {
|
|
3429
|
-
if (input === "") {
|
|
3430
|
-
return { data: {}, content: input, excerpt: "", orig: input };
|
|
3431
|
-
}
|
|
3432
|
-
let file = toFile(input);
|
|
3433
|
-
const cached = matter2.cache[file.content];
|
|
3434
|
-
if (!options2) {
|
|
3435
|
-
if (cached) {
|
|
3436
|
-
file = Object.assign({}, cached);
|
|
3437
|
-
file.orig = cached.orig;
|
|
3438
|
-
return file;
|
|
3439
|
-
}
|
|
3440
|
-
matter2.cache[file.content] = file;
|
|
3441
|
-
}
|
|
3442
|
-
return parseMatter(file, options2);
|
|
3443
|
-
}
|
|
3444
|
-
function parseMatter(file, options2) {
|
|
3445
|
-
const opts = defaults(options2);
|
|
3446
|
-
const open = opts.delimiters[0];
|
|
3447
|
-
const close = "\n" + opts.delimiters[1];
|
|
3448
|
-
let str2 = file.content;
|
|
3449
|
-
if (opts.language) {
|
|
3450
|
-
file.language = opts.language;
|
|
3451
|
-
}
|
|
3452
|
-
const openLen = open.length;
|
|
3453
|
-
if (!utils.startsWith(str2, open, openLen)) {
|
|
3454
|
-
excerpt(file, opts);
|
|
3455
|
-
return file;
|
|
3456
|
-
}
|
|
3457
|
-
if (str2.charAt(openLen) === open.slice(-1)) {
|
|
3458
|
-
return file;
|
|
3459
|
-
}
|
|
3460
|
-
str2 = str2.slice(openLen);
|
|
3461
|
-
const len = str2.length;
|
|
3462
|
-
const language = matter2.language(str2, opts);
|
|
3463
|
-
if (language.name) {
|
|
3464
|
-
file.language = language.name;
|
|
3465
|
-
str2 = str2.slice(language.raw.length);
|
|
3466
|
-
}
|
|
3467
|
-
let closeIndex = str2.indexOf(close);
|
|
3468
|
-
if (closeIndex === -1) {
|
|
3469
|
-
closeIndex = len;
|
|
3470
|
-
}
|
|
3471
|
-
file.matter = str2.slice(0, closeIndex);
|
|
3472
|
-
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
|
3473
|
-
if (block === "") {
|
|
3474
|
-
file.isEmpty = true;
|
|
3475
|
-
file.empty = file.content;
|
|
3476
|
-
file.data = {};
|
|
3477
|
-
} else {
|
|
3478
|
-
file.data = parse2(file.language, file.matter, opts);
|
|
3479
|
-
}
|
|
3480
|
-
if (closeIndex === len) {
|
|
3481
|
-
file.content = "";
|
|
3482
|
-
} else {
|
|
3483
|
-
file.content = str2.slice(closeIndex + close.length);
|
|
3484
|
-
if (file.content[0] === "\r") {
|
|
3485
|
-
file.content = file.content.slice(1);
|
|
3486
|
-
}
|
|
3487
|
-
if (file.content[0] === "\n") {
|
|
3488
|
-
file.content = file.content.slice(1);
|
|
3489
|
-
}
|
|
3490
|
-
}
|
|
3491
|
-
excerpt(file, opts);
|
|
3492
|
-
if (opts.sections === true || typeof opts.section === "function") {
|
|
3493
|
-
sections(file, opts.section);
|
|
3494
|
-
}
|
|
3495
|
-
return file;
|
|
3496
|
-
}
|
|
3497
|
-
matter2.engines = engines2;
|
|
3498
|
-
matter2.stringify = function(file, data, options2) {
|
|
3499
|
-
if (typeof file === "string") file = matter2(file, options2);
|
|
3500
|
-
return stringify(file, data, options2);
|
|
3501
|
-
};
|
|
3502
|
-
matter2.read = function(filepath, options2) {
|
|
3503
|
-
const str2 = fs3.readFileSync(filepath, "utf8");
|
|
3504
|
-
const file = matter2(str2, options2);
|
|
3505
|
-
file.path = filepath;
|
|
3506
|
-
return file;
|
|
3507
|
-
};
|
|
3508
|
-
matter2.test = function(str2, options2) {
|
|
3509
|
-
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
|
3510
|
-
};
|
|
3511
|
-
matter2.language = function(str2, options2) {
|
|
3512
|
-
const opts = defaults(options2);
|
|
3513
|
-
const open = opts.delimiters[0];
|
|
3514
|
-
if (matter2.test(str2)) {
|
|
3515
|
-
str2 = str2.slice(open.length);
|
|
3516
|
-
}
|
|
3517
|
-
const language = str2.slice(0, str2.search(/\r?\n/));
|
|
3518
|
-
return {
|
|
3519
|
-
raw: language,
|
|
3520
|
-
name: language ? language.trim() : ""
|
|
3521
|
-
};
|
|
3522
|
-
};
|
|
3523
|
-
matter2.cache = {};
|
|
3524
|
-
matter2.clearCache = function() {
|
|
3525
|
-
matter2.cache = {};
|
|
3526
|
-
};
|
|
3527
|
-
module2.exports = matter2;
|
|
2866
|
+
var yaml3 = require_js_yaml();
|
|
2867
|
+
module.exports = yaml3;
|
|
3528
2868
|
}
|
|
3529
2869
|
});
|
|
3530
2870
|
|
|
@@ -3535,7 +2875,6 @@ import { createHash as createHash4 } from "node:crypto";
|
|
|
3535
2875
|
import path3 from "node:path";
|
|
3536
2876
|
|
|
3537
2877
|
// ../core/src/frontmatter.ts
|
|
3538
|
-
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
3539
2878
|
var import_js_yaml = __toESM(require_js_yaml2(), 1);
|
|
3540
2879
|
|
|
3541
2880
|
// ../core/src/frontmatter-contract.ts
|
|
@@ -3607,8 +2946,9 @@ var yamlEngine = {
|
|
|
3607
2946
|
return import_js_yaml.default.safeLoad(input, { schema: losslessDateSchema }) ?? {};
|
|
3608
2947
|
}
|
|
3609
2948
|
};
|
|
3610
|
-
function normalizeFrontmatter(data) {
|
|
2949
|
+
function normalizeFrontmatter(data, okfVersion) {
|
|
3611
2950
|
const out = { ...data };
|
|
2951
|
+
if (okfVersion === "0.2") return out;
|
|
3612
2952
|
const value = out.timestamp;
|
|
3613
2953
|
if (value instanceof Date) {
|
|
3614
2954
|
out.timestamp = value.toISOString();
|
|
@@ -3620,7 +2960,7 @@ function normalizeFrontmatter(data) {
|
|
|
3620
2960
|
}
|
|
3621
2961
|
return out;
|
|
3622
2962
|
}
|
|
3623
|
-
function parseMarkdown(raw, context) {
|
|
2963
|
+
function parseMarkdown(raw, context, options = {}) {
|
|
3624
2964
|
const split = splitLeadingFrontmatter(raw, context);
|
|
3625
2965
|
if (!("yamlSource" in split)) return { frontmatter: {}, body: split.body };
|
|
3626
2966
|
let parsed;
|
|
@@ -3629,7 +2969,7 @@ function parseMarkdown(raw, context) {
|
|
|
3629
2969
|
} catch (err) {
|
|
3630
2970
|
throw new MalformedDocumentError(context, err);
|
|
3631
2971
|
}
|
|
3632
|
-
const frontmatter2 = normalizeFrontmatter(parsed);
|
|
2972
|
+
const frontmatter2 = normalizeFrontmatter(parsed, options.okfVersion);
|
|
3633
2973
|
return { frontmatter: frontmatter2, body: split.body };
|
|
3634
2974
|
}
|
|
3635
2975
|
function normalizeDocumentBodyForStorage(body) {
|
|
@@ -3637,79 +2977,19 @@ function normalizeDocumentBodyForStorage(body) {
|
|
|
3637
2977
|
`;
|
|
3638
2978
|
}
|
|
3639
2979
|
function stringifyWithData(data, body) {
|
|
3640
|
-
const
|
|
3641
|
-
const yaml4 = engines2.yaml.stringify(data).trim();
|
|
2980
|
+
const dumped = import_js_yaml.default.safeDump(data).trim();
|
|
3642
2981
|
const content = body ?? "";
|
|
3643
2982
|
const newline = (value) => value.endsWith("\n") ? value : `${value}
|
|
3644
2983
|
`;
|
|
3645
|
-
if (
|
|
2984
|
+
if (dumped === "{}") return normalizeDocumentBodyForStorage(content);
|
|
3646
2985
|
return `---
|
|
3647
|
-
${newline(
|
|
2986
|
+
${newline(dumped)}---
|
|
3648
2987
|
${normalizeDocumentBodyForStorage(content)}`;
|
|
3649
2988
|
}
|
|
3650
2989
|
function stringifyDoc(frontmatter2, body) {
|
|
3651
2990
|
return stringifyWithData(frontmatter2, body);
|
|
3652
2991
|
}
|
|
3653
2992
|
|
|
3654
|
-
// ../core/src/content-type.ts
|
|
3655
|
-
var EXTENSION_CONTENT_TYPES = Object.freeze({
|
|
3656
|
-
// Text / markup / data (searchable + text-readable)
|
|
3657
|
-
html: "text/html; charset=utf-8",
|
|
3658
|
-
htm: "text/html; charset=utf-8",
|
|
3659
|
-
md: "text/markdown; charset=utf-8",
|
|
3660
|
-
markdown: "text/markdown; charset=utf-8",
|
|
3661
|
-
txt: "text/plain; charset=utf-8",
|
|
3662
|
-
text: "text/plain; charset=utf-8",
|
|
3663
|
-
log: "text/plain; charset=utf-8",
|
|
3664
|
-
csv: "text/csv; charset=utf-8",
|
|
3665
|
-
tsv: "text/tab-separated-values; charset=utf-8",
|
|
3666
|
-
json: "application/json; charset=utf-8",
|
|
3667
|
-
jsonl: "application/json; charset=utf-8",
|
|
3668
|
-
ndjson: "application/json; charset=utf-8",
|
|
3669
|
-
xml: "application/xml; charset=utf-8",
|
|
3670
|
-
yaml: "application/yaml; charset=utf-8",
|
|
3671
|
-
yml: "application/yaml; charset=utf-8",
|
|
3672
|
-
toml: "application/toml; charset=utf-8",
|
|
3673
|
-
css: "text/css; charset=utf-8",
|
|
3674
|
-
js: "text/javascript; charset=utf-8",
|
|
3675
|
-
mjs: "text/javascript; charset=utf-8",
|
|
3676
|
-
cjs: "text/javascript; charset=utf-8",
|
|
3677
|
-
// Images
|
|
3678
|
-
png: "image/png",
|
|
3679
|
-
jpg: "image/jpeg",
|
|
3680
|
-
jpeg: "image/jpeg",
|
|
3681
|
-
gif: "image/gif",
|
|
3682
|
-
webp: "image/webp",
|
|
3683
|
-
bmp: "image/bmp",
|
|
3684
|
-
ico: "image/x-icon",
|
|
3685
|
-
svg: "image/svg+xml",
|
|
3686
|
-
// Documents / archives / binary
|
|
3687
|
-
pdf: "application/pdf",
|
|
3688
|
-
zip: "application/zip",
|
|
3689
|
-
gz: "application/gzip",
|
|
3690
|
-
tar: "application/x-tar",
|
|
3691
|
-
wasm: "application/wasm",
|
|
3692
|
-
woff: "font/woff",
|
|
3693
|
-
woff2: "font/woff2"
|
|
3694
|
-
});
|
|
3695
|
-
function extensionOfDocKey(docKey) {
|
|
3696
|
-
const lastSegment = docKey.split("/").pop() ?? docKey;
|
|
3697
|
-
const dot = lastSegment.lastIndexOf(".");
|
|
3698
|
-
if (dot <= 0) return void 0;
|
|
3699
|
-
const ext = lastSegment.slice(dot + 1).toLowerCase();
|
|
3700
|
-
return ext.length > 0 ? ext : void 0;
|
|
3701
|
-
}
|
|
3702
|
-
function inferContentTypeFromDocKey(docKey) {
|
|
3703
|
-
const ext = extensionOfDocKey(docKey);
|
|
3704
|
-
if (!ext) return void 0;
|
|
3705
|
-
return EXTENSION_CONTENT_TYPES[ext];
|
|
3706
|
-
}
|
|
3707
|
-
var DEFAULT_BLOB_CONTENT_TYPE = "application/octet-stream";
|
|
3708
|
-
function resolveContentType(key, override) {
|
|
3709
|
-
if (typeof override === "string" && override.trim() !== "") return override;
|
|
3710
|
-
return inferContentTypeFromDocKey(key) ?? DEFAULT_BLOB_CONTENT_TYPE;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
2993
|
// ../core/src/errors.ts
|
|
3714
2994
|
var InvalidInputError = class extends Error {
|
|
3715
2995
|
constructor(message) {
|
|
@@ -3741,6 +3021,21 @@ var ConcurrentReplacementError = class extends Error {
|
|
|
3741
3021
|
}
|
|
3742
3022
|
};
|
|
3743
3023
|
|
|
3024
|
+
// ../core/src/okf-lifecycle.ts
|
|
3025
|
+
var OKF_LIFECYCLE_STATUSES = Object.freeze(["draft", "stable", "deprecated"]);
|
|
3026
|
+
function isOkfLifecycleStatus(value) {
|
|
3027
|
+
return typeof value === "string" && OKF_LIFECYCLE_STATUSES.includes(value);
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
// ../core/src/mutation-attribution.ts
|
|
3031
|
+
var SUPERBEE_UPDATED_BY_FIELD = "superbee_updated_by";
|
|
3032
|
+
function nonEmptyString(value) {
|
|
3033
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
3034
|
+
}
|
|
3035
|
+
function mutationActorFromFrontmatter(frontmatter2) {
|
|
3036
|
+
return nonEmptyString(frontmatter2[SUPERBEE_UPDATED_BY_FIELD]) ?? nonEmptyString(frontmatter2.updated_by) ?? nonEmptyString(frontmatter2.actor);
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3744
3039
|
// ../core/src/paths.ts
|
|
3745
3040
|
var RESERVED_FILENAMES = ["index.md", "log.md"];
|
|
3746
3041
|
function toPosix(p) {
|
|
@@ -3821,20 +3116,315 @@ function assertSafeReservedDir(dir) {
|
|
|
3821
3116
|
}
|
|
3822
3117
|
}
|
|
3823
3118
|
|
|
3824
|
-
// ../core/src/
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3119
|
+
// ../core/src/links.ts
|
|
3120
|
+
function normalizeSegments(segments) {
|
|
3121
|
+
const out = [];
|
|
3122
|
+
for (const segment of segments) {
|
|
3123
|
+
if (segment === "" || segment === ".") continue;
|
|
3124
|
+
if (segment === ".." && out.length > 0 && out[out.length - 1] !== "..") {
|
|
3125
|
+
out.pop();
|
|
3126
|
+
continue;
|
|
3127
|
+
}
|
|
3128
|
+
out.push(segment);
|
|
3129
|
+
}
|
|
3130
|
+
return out;
|
|
3131
|
+
}
|
|
3132
|
+
function joinPosix(base, rel) {
|
|
3133
|
+
return normalizeSegments([...base.split("/"), ...rel.split("/")]).join("/");
|
|
3134
|
+
}
|
|
3135
|
+
function isExternalHref(href) {
|
|
3136
|
+
const h = href.trim();
|
|
3137
|
+
return /^[a-z][a-z0-9+.-]*:\/\//i.test(h) || h.startsWith("mailto:") || h.startsWith("#");
|
|
3138
|
+
}
|
|
3139
|
+
function extractMarkdownLinks(body) {
|
|
3140
|
+
const out = [];
|
|
3141
|
+
let textOpen = -1;
|
|
3142
|
+
let afterClose;
|
|
3143
|
+
let hrefFirst;
|
|
3144
|
+
let hrefRest;
|
|
3145
|
+
for (let cursor = 0; cursor < body.length; cursor++) {
|
|
3146
|
+
const char = body[cursor];
|
|
3147
|
+
if (hrefRest) {
|
|
3148
|
+
if (char === ")") {
|
|
3149
|
+
if (hrefRest.open === 0 || body[hrefRest.open - 1] !== "!") {
|
|
3150
|
+
out.push({
|
|
3151
|
+
text: body.slice(hrefRest.open + 1, hrefRest.close),
|
|
3152
|
+
href: body.slice(hrefRest.hrefStart, cursor)
|
|
3153
|
+
});
|
|
3154
|
+
}
|
|
3155
|
+
textOpen = -1;
|
|
3156
|
+
afterClose = void 0;
|
|
3157
|
+
hrefFirst = void 0;
|
|
3158
|
+
hrefRest = void 0;
|
|
3159
|
+
continue;
|
|
3160
|
+
}
|
|
3161
|
+
if (char.trim() === "") hrefRest = void 0;
|
|
3162
|
+
}
|
|
3163
|
+
if (hrefFirst) {
|
|
3164
|
+
if (char !== ")" && char.trim() !== "" && !hrefRest) {
|
|
3165
|
+
hrefRest = hrefFirst;
|
|
3166
|
+
}
|
|
3167
|
+
hrefFirst = void 0;
|
|
3168
|
+
}
|
|
3169
|
+
if (afterClose) {
|
|
3170
|
+
if (char === "(") {
|
|
3171
|
+
hrefFirst = { ...afterClose, hrefStart: cursor + 1 };
|
|
3172
|
+
}
|
|
3173
|
+
afterClose = void 0;
|
|
3174
|
+
}
|
|
3175
|
+
if (textOpen >= 0 && char === "]") {
|
|
3176
|
+
afterClose = { open: textOpen, close: cursor };
|
|
3177
|
+
textOpen = -1;
|
|
3178
|
+
}
|
|
3179
|
+
if (char === "[" && textOpen < 0) textOpen = cursor;
|
|
3180
|
+
}
|
|
3181
|
+
return out;
|
|
3182
|
+
}
|
|
3183
|
+
function resolveConceptId(fromId, href) {
|
|
3184
|
+
const target = (href.split("#")[0] ?? "").split("?")[0]?.trim() ?? "";
|
|
3185
|
+
if (target === "" || isExternalHref(target)) return null;
|
|
3186
|
+
if (!target.endsWith(".md")) return null;
|
|
3187
|
+
let resolved;
|
|
3188
|
+
if (target.startsWith("/")) {
|
|
3189
|
+
resolved = target.slice(1);
|
|
3190
|
+
} else {
|
|
3191
|
+
const slash = fromId.lastIndexOf("/");
|
|
3192
|
+
const fromDir = slash >= 0 ? fromId.slice(0, slash) : "";
|
|
3193
|
+
resolved = joinPosix(fromDir, target);
|
|
3194
|
+
}
|
|
3195
|
+
resolved = resolved.replace(/^(\.\.\/)+/, "");
|
|
3196
|
+
if (isReservedFile(resolved)) return null;
|
|
3197
|
+
const id = resolved.replace(/\.md$/, "");
|
|
3198
|
+
try {
|
|
3199
|
+
assertSafeConceptId(id);
|
|
3200
|
+
return id;
|
|
3201
|
+
} catch (error) {
|
|
3202
|
+
if (error instanceof InvalidInputError) return null;
|
|
3203
|
+
throw error;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
function parseLinksFromDoc(doc) {
|
|
3207
|
+
const links = [];
|
|
3208
|
+
for (const raw of extractMarkdownLinks(doc.body)) {
|
|
3209
|
+
const to = resolveConceptId(doc.id, raw.href);
|
|
3210
|
+
if (to === null) continue;
|
|
3211
|
+
links.push({ from: doc.id, to, text: raw.text, href: raw.href });
|
|
3212
|
+
}
|
|
3213
|
+
return links;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
// ../core/src/portable-frontmatter.ts
|
|
3217
|
+
var import_js_yaml2 = __toESM(require_js_yaml2(), 1);
|
|
3218
|
+
function parseLeadingFrontmatter(raw, context) {
|
|
3219
|
+
const split = splitLeadingFrontmatter(raw, context);
|
|
3220
|
+
if (!("yamlSource" in split)) return {};
|
|
3221
|
+
try {
|
|
3222
|
+
const parsed = import_js_yaml2.default.safeLoad(split.yamlSource);
|
|
3223
|
+
if (parsed === void 0 || parsed === null) return {};
|
|
3224
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
3225
|
+
throw new TypeError("YAML frontmatter must be a mapping");
|
|
3226
|
+
}
|
|
3227
|
+
return parsed;
|
|
3228
|
+
} catch (error) {
|
|
3229
|
+
if (error instanceof MalformedDocumentError) throw error;
|
|
3230
|
+
throw new MalformedDocumentError(context, error);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
// ../core/src/query-filter.ts
|
|
3235
|
+
function matchesFilter(doc, filter) {
|
|
3236
|
+
if (filter.prefix && !doc.id.startsWith(filter.prefix)) return false;
|
|
3237
|
+
if (filter.type && doc.frontmatter.type !== filter.type) return false;
|
|
3238
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
3239
|
+
const tags = Array.isArray(doc.frontmatter.tags) ? doc.frontmatter.tags : [];
|
|
3240
|
+
if (!filter.tags.every((tag) => tags.includes(tag))) return false;
|
|
3241
|
+
}
|
|
3242
|
+
if (filter.fields) {
|
|
3243
|
+
const frontmatter2 = doc.frontmatter;
|
|
3244
|
+
for (const [key, expected] of Object.entries(filter.fields)) {
|
|
3245
|
+
const raw = frontmatter2[key];
|
|
3246
|
+
const actual = raw === void 0 || raw === null ? [] : (Array.isArray(raw) ? raw : [raw]).map((value) => String(value));
|
|
3247
|
+
if (!actual.includes(expected)) return false;
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
return true;
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
// ../core/src/engine.ts
|
|
3254
|
+
async function readBundleOkfVersion(backend) {
|
|
3255
|
+
const index = await backend.readReserved("", "index.md");
|
|
3256
|
+
if (!index) return void 0;
|
|
3257
|
+
const value = parseLeadingFrontmatter(index.content, "index.md").okf_version;
|
|
3258
|
+
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
3259
|
+
}
|
|
3260
|
+
function assertReadableConceptId(id) {
|
|
3261
|
+
assertSafeConceptId(id);
|
|
3262
|
+
const rel = pathFromConceptId(id);
|
|
3263
|
+
if (isReservedFile(rel)) {
|
|
3264
|
+
throw new InvalidInputError(`'${id}' is a reserved file (index.md / log.md), not a concept document.`);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
async function readDocVersioned(backend, id) {
|
|
3268
|
+
assertReadableConceptId(id);
|
|
3269
|
+
return backend.read(id);
|
|
3270
|
+
}
|
|
3271
|
+
function isEnoent(err) {
|
|
3272
|
+
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
3273
|
+
}
|
|
3274
|
+
async function readManyExisting(backend, ids, onMalformed) {
|
|
3275
|
+
try {
|
|
3276
|
+
return await backend.readMany(ids);
|
|
3277
|
+
} catch (err) {
|
|
3278
|
+
const malformed = err instanceof MalformedDocumentError;
|
|
3279
|
+
if (!isEnoent(err) && !(malformed && onMalformed)) throw err;
|
|
3280
|
+
const out = [];
|
|
3281
|
+
for (const id of ids) {
|
|
3282
|
+
try {
|
|
3283
|
+
out.push(await backend.read(id));
|
|
3284
|
+
} catch (candidate) {
|
|
3285
|
+
if (isEnoent(candidate)) continue;
|
|
3286
|
+
if (candidate instanceof MalformedDocumentError && onMalformed) {
|
|
3287
|
+
onMalformed({ id, reason: candidate.detail });
|
|
3288
|
+
continue;
|
|
3289
|
+
}
|
|
3290
|
+
throw candidate;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
return out;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
async function scanMatching(backend, filter, onSkip) {
|
|
3297
|
+
const ids = await backend.list(filter.prefix);
|
|
3298
|
+
const results = [];
|
|
3299
|
+
for (const result of await readManyExisting(backend, ids, onSkip)) {
|
|
3300
|
+
if (matchesFilter(result.doc, filter)) results.push(result);
|
|
3301
|
+
}
|
|
3302
|
+
results.sort((a, b) => a.doc.id.localeCompare(b.doc.id));
|
|
3303
|
+
return results;
|
|
3304
|
+
}
|
|
3305
|
+
async function query(backend, filter = {}, options = {}) {
|
|
3306
|
+
return (await scanMatching(backend, filter, options.onSkip)).map((result) => result.doc);
|
|
3307
|
+
}
|
|
3308
|
+
async function queryHeads(backend, filter = {}, options = {}) {
|
|
3309
|
+
if (backend.queryHeads) {
|
|
3310
|
+
const rows = (await backend.queryHeads(filter)).filter((row) => matchesFilter(row, filter));
|
|
3311
|
+
rows.sort((a, b) => a.id.localeCompare(b.id));
|
|
3312
|
+
return rows;
|
|
3313
|
+
}
|
|
3314
|
+
return (await scanMatching(backend, filter, options.onSkip)).map(({ doc, version }) => ({
|
|
3315
|
+
id: doc.id,
|
|
3316
|
+
frontmatter: doc.frontmatter,
|
|
3317
|
+
version
|
|
3318
|
+
}));
|
|
3319
|
+
}
|
|
3320
|
+
function normalizeEdgeSelector(raw) {
|
|
3321
|
+
if (raw.endsWith("/")) {
|
|
3322
|
+
const stem = raw.slice(0, -1);
|
|
3323
|
+
assertSafeConceptId(stem);
|
|
3324
|
+
return `${stem}/`;
|
|
3325
|
+
}
|
|
3326
|
+
assertSafeConceptId(raw);
|
|
3327
|
+
return raw;
|
|
3328
|
+
}
|
|
3329
|
+
function matchesEdgeSelector(value, selectors) {
|
|
3330
|
+
if (selectors === void 0) return true;
|
|
3331
|
+
return selectors.some(
|
|
3332
|
+
(selector2) => selector2.endsWith("/") ? value.startsWith(selector2) : value === selector2
|
|
3333
|
+
);
|
|
3334
|
+
}
|
|
3335
|
+
function toSelectorList(value) {
|
|
3336
|
+
if (value === void 0) return void 0;
|
|
3337
|
+
return Array.isArray(value) ? value : [value];
|
|
3338
|
+
}
|
|
3339
|
+
async function queryEdges(backend, filter = {}) {
|
|
3340
|
+
const fromSelectors = toSelectorList(filter.from)?.map(normalizeEdgeSelector);
|
|
3341
|
+
const toSelectors = toSelectorList(filter.to)?.map(normalizeEdgeSelector);
|
|
3342
|
+
const edges = [];
|
|
3343
|
+
for (const doc of await query(backend)) {
|
|
3344
|
+
for (const link of parseLinksFromDoc(doc)) {
|
|
3345
|
+
if (!matchesEdgeSelector(link.from, fromSelectors)) continue;
|
|
3346
|
+
if (!matchesEdgeSelector(link.to, toSelectors)) continue;
|
|
3347
|
+
if (filter.text !== void 0 && link.text !== filter.text) continue;
|
|
3348
|
+
edges.push(link);
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || a.text.localeCompare(b.text));
|
|
3352
|
+
return edges;
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// ../core/src/content-type.ts
|
|
3356
|
+
var EXTENSION_CONTENT_TYPES = Object.freeze({
|
|
3357
|
+
// Text / markup / data (searchable + text-readable)
|
|
3358
|
+
html: "text/html; charset=utf-8",
|
|
3359
|
+
htm: "text/html; charset=utf-8",
|
|
3360
|
+
md: "text/markdown; charset=utf-8",
|
|
3361
|
+
markdown: "text/markdown; charset=utf-8",
|
|
3362
|
+
txt: "text/plain; charset=utf-8",
|
|
3363
|
+
text: "text/plain; charset=utf-8",
|
|
3364
|
+
log: "text/plain; charset=utf-8",
|
|
3365
|
+
csv: "text/csv; charset=utf-8",
|
|
3366
|
+
tsv: "text/tab-separated-values; charset=utf-8",
|
|
3367
|
+
json: "application/json; charset=utf-8",
|
|
3368
|
+
jsonl: "application/json; charset=utf-8",
|
|
3369
|
+
ndjson: "application/json; charset=utf-8",
|
|
3370
|
+
xml: "application/xml; charset=utf-8",
|
|
3371
|
+
yaml: "application/yaml; charset=utf-8",
|
|
3372
|
+
yml: "application/yaml; charset=utf-8",
|
|
3373
|
+
toml: "application/toml; charset=utf-8",
|
|
3374
|
+
css: "text/css; charset=utf-8",
|
|
3375
|
+
js: "text/javascript; charset=utf-8",
|
|
3376
|
+
mjs: "text/javascript; charset=utf-8",
|
|
3377
|
+
cjs: "text/javascript; charset=utf-8",
|
|
3378
|
+
// Images
|
|
3379
|
+
png: "image/png",
|
|
3380
|
+
jpg: "image/jpeg",
|
|
3381
|
+
jpeg: "image/jpeg",
|
|
3382
|
+
gif: "image/gif",
|
|
3383
|
+
webp: "image/webp",
|
|
3384
|
+
bmp: "image/bmp",
|
|
3385
|
+
ico: "image/x-icon",
|
|
3386
|
+
svg: "image/svg+xml",
|
|
3387
|
+
// Documents / archives / binary
|
|
3388
|
+
pdf: "application/pdf",
|
|
3389
|
+
zip: "application/zip",
|
|
3390
|
+
gz: "application/gzip",
|
|
3391
|
+
tar: "application/x-tar",
|
|
3392
|
+
wasm: "application/wasm",
|
|
3393
|
+
woff: "font/woff",
|
|
3394
|
+
woff2: "font/woff2"
|
|
3395
|
+
});
|
|
3396
|
+
function extensionOfDocKey(docKey) {
|
|
3397
|
+
const lastSegment = docKey.split("/").pop() ?? docKey;
|
|
3398
|
+
const dot = lastSegment.lastIndexOf(".");
|
|
3399
|
+
if (dot <= 0) return void 0;
|
|
3400
|
+
const ext = lastSegment.slice(dot + 1).toLowerCase();
|
|
3401
|
+
return ext.length > 0 ? ext : void 0;
|
|
3402
|
+
}
|
|
3403
|
+
function inferContentTypeFromDocKey(docKey) {
|
|
3404
|
+
const ext = extensionOfDocKey(docKey);
|
|
3405
|
+
if (!ext) return void 0;
|
|
3406
|
+
return EXTENSION_CONTENT_TYPES[ext];
|
|
3407
|
+
}
|
|
3408
|
+
var DEFAULT_BLOB_CONTENT_TYPE = "application/octet-stream";
|
|
3409
|
+
function resolveContentType(key, override) {
|
|
3410
|
+
if (typeof override === "string" && override.trim() !== "") return override;
|
|
3411
|
+
return inferContentTypeFromDocKey(key) ?? DEFAULT_BLOB_CONTENT_TYPE;
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
// ../core/src/filesystem-identity.ts
|
|
3415
|
+
import { promises as fs2 } from "node:fs";
|
|
3416
|
+
import path2 from "node:path";
|
|
3417
|
+
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
3418
|
+
|
|
3419
|
+
// ../core/src/filesystem-lock.ts
|
|
3420
|
+
import { promises as fs, realpathSync } from "node:fs";
|
|
3421
|
+
import { homedir, hostname, userInfo } from "node:os";
|
|
3422
|
+
import path from "node:path";
|
|
3423
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3424
|
+
var OWNER_FILE = "owner.json";
|
|
3425
|
+
var DEFAULT_WAIT_MS = 5e3;
|
|
3426
|
+
var DEFAULT_POLL_MS = 25;
|
|
3427
|
+
var FilesystemMutationLockError = class extends Error {
|
|
3838
3428
|
lockPath;
|
|
3839
3429
|
owner;
|
|
3840
3430
|
stale;
|
|
@@ -4013,9 +3603,9 @@ async function resolvedPortableRoot(portableRoot) {
|
|
|
4013
3603
|
if (portableRoot === void 0) return void 0;
|
|
4014
3604
|
return fs.realpath(portableRoot).catch(() => path.resolve(portableRoot));
|
|
4015
3605
|
}
|
|
4016
|
-
async function selectLockRoot(
|
|
4017
|
-
const portableRoot = await resolvedPortableRoot(
|
|
4018
|
-
const lockRoot =
|
|
3606
|
+
async function selectLockRoot(options) {
|
|
3607
|
+
const portableRoot = await resolvedPortableRoot(options.portableRoot);
|
|
3608
|
+
const lockRoot = options.lockRoot !== void 0 ? explicitFilesystemMutationLockRoot(options.lockRoot, portableRoot) : filesystemMutationLockRoot(portableRoot);
|
|
4019
3609
|
await ensurePrivateLockRoot(lockRoot);
|
|
4020
3610
|
return lockRoot;
|
|
4021
3611
|
}
|
|
@@ -4102,12 +3692,12 @@ var IDENTITY_KEY_SHAPE = /^[0-9a-f]{64}$/;
|
|
|
4102
3692
|
function assertIdentityKey(key) {
|
|
4103
3693
|
if (!IDENTITY_KEY_SHAPE.test(key)) throw new TypeError("identity key must be a lowercase hex sha256 digest");
|
|
4104
3694
|
}
|
|
4105
|
-
async function acquireFilesystemIdentityLock(key, identity,
|
|
3695
|
+
async function acquireFilesystemIdentityLock(key, identity, options = {}) {
|
|
4106
3696
|
assertIdentityKey(key);
|
|
4107
|
-
const waitMs = positiveOption(
|
|
4108
|
-
const pollMs = positiveOption(
|
|
3697
|
+
const waitMs = positiveOption(options.waitMs, DEFAULT_WAIT_MS, "waitMs");
|
|
3698
|
+
const pollMs = positiveOption(options.pollMs, DEFAULT_POLL_MS, "pollMs");
|
|
4109
3699
|
const owner = newOwner(identity);
|
|
4110
|
-
const lockRoot = await selectLockRoot(
|
|
3700
|
+
const lockRoot = await selectLockRoot(options);
|
|
4111
3701
|
return claimLockPath(path.join(lockRoot, `${key}.lock`), owner, waitMs, pollMs);
|
|
4112
3702
|
}
|
|
4113
3703
|
|
|
@@ -4539,15 +4129,6 @@ var nodeFilesystemIdentityPort = Object.freeze({
|
|
|
4539
4129
|
}
|
|
4540
4130
|
});
|
|
4541
4131
|
|
|
4542
|
-
// ../core/src/mutation-attribution.ts
|
|
4543
|
-
var SUPERBEE_UPDATED_BY_FIELD = "superbee_updated_by";
|
|
4544
|
-
function nonEmptyString(value) {
|
|
4545
|
-
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
4546
|
-
}
|
|
4547
|
-
function mutationActorFromFrontmatter(frontmatter2) {
|
|
4548
|
-
return nonEmptyString(frontmatter2[SUPERBEE_UPDATED_BY_FIELD]) ?? nonEmptyString(frontmatter2.updated_by) ?? nonEmptyString(frontmatter2.actor);
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
4132
|
// ../core/src/versioning.ts
|
|
4552
4133
|
import { createHash as createHash3 } from "node:crypto";
|
|
4553
4134
|
|
|
@@ -4627,7 +4208,7 @@ function reservedPath(dir, name) {
|
|
|
4627
4208
|
const d = toPosix(dir).replace(/^\.?\//, "").replace(/\/$/, "");
|
|
4628
4209
|
return d === "" ? name : `${d}/${name}`;
|
|
4629
4210
|
}
|
|
4630
|
-
var FilesystemBackend = class {
|
|
4211
|
+
var FilesystemBackend = class _FilesystemBackend {
|
|
4631
4212
|
#root;
|
|
4632
4213
|
/**
|
|
4633
4214
|
* The root is resolved once here: a relative root would otherwise re-resolve against the
|
|
@@ -4639,44 +4220,61 @@ var FilesystemBackend = class {
|
|
|
4639
4220
|
publicationRoots.set(this, this.#root);
|
|
4640
4221
|
}
|
|
4641
4222
|
async read(id) {
|
|
4223
|
+
return this.#readWithEdition(id, () => this.#readEdition());
|
|
4224
|
+
}
|
|
4225
|
+
async #readEdition() {
|
|
4226
|
+
try {
|
|
4227
|
+
return await readBundleOkfVersion(this);
|
|
4228
|
+
} catch (error) {
|
|
4229
|
+
if (!(error instanceof MalformedDocumentError)) throw error;
|
|
4230
|
+
return void 0;
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
async #readWithEdition(id, edition) {
|
|
4642
4234
|
assertSafeConceptId(id);
|
|
4643
4235
|
const rel = pathFromConceptId(id);
|
|
4644
4236
|
const observed = await observeExact(nodeFilesystemIdentityPort, this.#root, rel, readBytes);
|
|
4645
4237
|
if (observed.state === "absent") throw notFound(this.#root, rel);
|
|
4646
4238
|
const raw = observed.value.toString("utf8");
|
|
4647
|
-
const { frontmatter: frontmatter2, body } = parseMarkdown(raw, rel);
|
|
4239
|
+
const { frontmatter: frontmatter2, body } = parseMarkdown(raw, rel, { okfVersion: await edition() });
|
|
4648
4240
|
return { doc: { id, frontmatter: frontmatter2, body }, version: versionOfBytes(raw) };
|
|
4649
4241
|
}
|
|
4650
4242
|
async readMany(ids) {
|
|
4651
4243
|
for (const id of ids) assertSafeConceptId(id);
|
|
4652
4244
|
const out = [];
|
|
4653
|
-
|
|
4245
|
+
if (this.read !== _FilesystemBackend.prototype.read) {
|
|
4246
|
+
for (const id of ids) out.push(await this.read(id));
|
|
4247
|
+
return out;
|
|
4248
|
+
}
|
|
4249
|
+
let editionPromise;
|
|
4250
|
+
const edition = () => editionPromise ??= this.#readEdition();
|
|
4251
|
+
for (const id of ids) out.push(await this.#readWithEdition(id, edition));
|
|
4654
4252
|
return out;
|
|
4655
4253
|
}
|
|
4656
|
-
async write(id, doc,
|
|
4254
|
+
async write(id, doc, options = {}) {
|
|
4657
4255
|
assertSafeConceptId(id);
|
|
4658
4256
|
const raw = stringifyDoc(doc.frontmatter, doc.body ?? "");
|
|
4659
4257
|
const rel = pathFromConceptId(id);
|
|
4660
4258
|
return mutateExact(nodeFilesystemIdentityPort, this.#root, rel, async (target) => {
|
|
4661
|
-
if (
|
|
4259
|
+
if (options.expectedVersion !== void 0) {
|
|
4662
4260
|
const bytes = await target.current();
|
|
4663
4261
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
4664
|
-
if (current !==
|
|
4665
|
-
throw new VersionConflict(id,
|
|
4262
|
+
if (current !== options.expectedVersion) {
|
|
4263
|
+
throw new VersionConflict(id, options.expectedVersion, current);
|
|
4666
4264
|
}
|
|
4667
4265
|
}
|
|
4668
4266
|
await target.replace(Buffer.from(raw, "utf8"));
|
|
4669
4267
|
return versionOfBytes(raw);
|
|
4670
4268
|
});
|
|
4671
4269
|
}
|
|
4672
|
-
async delete(id,
|
|
4270
|
+
async delete(id, options = {}) {
|
|
4673
4271
|
assertSafeConceptId(id);
|
|
4674
4272
|
return mutateExact(nodeFilesystemIdentityPort, this.#root, pathFromConceptId(id), async (target) => {
|
|
4675
4273
|
const bytes = await target.current();
|
|
4676
4274
|
if (bytes === null) return false;
|
|
4677
4275
|
const current = versionOfBytes(bytes.toString("utf8"));
|
|
4678
|
-
if (
|
|
4679
|
-
throw new VersionConflict(id,
|
|
4276
|
+
if (options.expectedVersion !== void 0 && current !== options.expectedVersion) {
|
|
4277
|
+
throw new VersionConflict(id, options.expectedVersion, current);
|
|
4680
4278
|
}
|
|
4681
4279
|
await target.remove();
|
|
4682
4280
|
return true;
|
|
@@ -4730,15 +4328,15 @@ var FilesystemBackend = class {
|
|
|
4730
4328
|
const content = observed.value.toString("utf8");
|
|
4731
4329
|
return { content, version: versionOfBytes(content) };
|
|
4732
4330
|
}
|
|
4733
|
-
async writeReserved(dir, name, content,
|
|
4331
|
+
async writeReserved(dir, name, content, options = {}) {
|
|
4734
4332
|
assertSafeReservedDir(dir);
|
|
4735
4333
|
const rel = reservedPath(dir, name);
|
|
4736
4334
|
return mutateExact(nodeFilesystemIdentityPort, this.#root, rel, async (target) => {
|
|
4737
|
-
if (
|
|
4335
|
+
if (options.expectedVersion !== void 0) {
|
|
4738
4336
|
const bytes = await target.current();
|
|
4739
4337
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
4740
|
-
if (current !==
|
|
4741
|
-
throw new VersionConflict(rel,
|
|
4338
|
+
if (current !== options.expectedVersion) {
|
|
4339
|
+
throw new VersionConflict(rel, options.expectedVersion, current);
|
|
4742
4340
|
}
|
|
4743
4341
|
}
|
|
4744
4342
|
await target.replace(Buffer.from(content, "utf8"));
|
|
@@ -4753,28 +4351,28 @@ var FilesystemBackend = class {
|
|
|
4753
4351
|
const bytes = observed.value;
|
|
4754
4352
|
return { bytes, contentType: resolveContentType(key), version: blobVersion(bytes) };
|
|
4755
4353
|
}
|
|
4756
|
-
async writeBlob(key, bytes, _contentType,
|
|
4354
|
+
async writeBlob(key, bytes, _contentType, options = {}) {
|
|
4757
4355
|
assertSafeBlobKey(key);
|
|
4758
4356
|
return mutateExact(nodeFilesystemIdentityPort, this.#root, key, async (target) => {
|
|
4759
|
-
if (
|
|
4357
|
+
if (options.expectedVersion !== void 0) {
|
|
4760
4358
|
const existing = await target.current();
|
|
4761
4359
|
const current = existing === null ? null : blobVersion(existing);
|
|
4762
|
-
if (current !==
|
|
4763
|
-
throw new VersionConflict(key,
|
|
4360
|
+
if (current !== options.expectedVersion) {
|
|
4361
|
+
throw new VersionConflict(key, options.expectedVersion, current);
|
|
4764
4362
|
}
|
|
4765
4363
|
}
|
|
4766
4364
|
await target.replace(bytes);
|
|
4767
4365
|
return blobVersion(bytes);
|
|
4768
4366
|
});
|
|
4769
4367
|
}
|
|
4770
|
-
async deleteBlob(key,
|
|
4368
|
+
async deleteBlob(key, options = {}) {
|
|
4771
4369
|
assertSafeBlobKey(key);
|
|
4772
4370
|
return mutateExact(nodeFilesystemIdentityPort, this.#root, key, async (target) => {
|
|
4773
4371
|
const existing = await target.current();
|
|
4774
4372
|
if (existing === null) return false;
|
|
4775
4373
|
const current = blobVersion(existing);
|
|
4776
|
-
if (
|
|
4777
|
-
throw new VersionConflict(key,
|
|
4374
|
+
if (options.expectedVersion !== void 0 && current !== options.expectedVersion) {
|
|
4375
|
+
throw new VersionConflict(key, options.expectedVersion, current);
|
|
4778
4376
|
}
|
|
4779
4377
|
await target.remove();
|
|
4780
4378
|
return true;
|
|
@@ -4803,242 +4401,6 @@ var FilesystemBackend = class {
|
|
|
4803
4401
|
}
|
|
4804
4402
|
};
|
|
4805
4403
|
|
|
4806
|
-
// ../core/src/links.ts
|
|
4807
|
-
function normalizeSegments(segments) {
|
|
4808
|
-
const out = [];
|
|
4809
|
-
for (const segment of segments) {
|
|
4810
|
-
if (segment === "" || segment === ".") continue;
|
|
4811
|
-
if (segment === ".." && out.length > 0 && out[out.length - 1] !== "..") {
|
|
4812
|
-
out.pop();
|
|
4813
|
-
continue;
|
|
4814
|
-
}
|
|
4815
|
-
out.push(segment);
|
|
4816
|
-
}
|
|
4817
|
-
return out;
|
|
4818
|
-
}
|
|
4819
|
-
function joinPosix(base, rel) {
|
|
4820
|
-
return normalizeSegments([...base.split("/"), ...rel.split("/")]).join("/");
|
|
4821
|
-
}
|
|
4822
|
-
function isExternalHref(href) {
|
|
4823
|
-
const h = href.trim();
|
|
4824
|
-
return /^[a-z][a-z0-9+.-]*:\/\//i.test(h) || h.startsWith("mailto:") || h.startsWith("#");
|
|
4825
|
-
}
|
|
4826
|
-
function extractMarkdownLinks(body) {
|
|
4827
|
-
const out = [];
|
|
4828
|
-
let textOpen = -1;
|
|
4829
|
-
let afterClose;
|
|
4830
|
-
let hrefFirst;
|
|
4831
|
-
let hrefRest;
|
|
4832
|
-
for (let cursor = 0; cursor < body.length; cursor++) {
|
|
4833
|
-
const char = body[cursor];
|
|
4834
|
-
if (hrefRest) {
|
|
4835
|
-
if (char === ")") {
|
|
4836
|
-
if (hrefRest.open === 0 || body[hrefRest.open - 1] !== "!") {
|
|
4837
|
-
out.push({
|
|
4838
|
-
text: body.slice(hrefRest.open + 1, hrefRest.close),
|
|
4839
|
-
href: body.slice(hrefRest.hrefStart, cursor)
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
textOpen = -1;
|
|
4843
|
-
afterClose = void 0;
|
|
4844
|
-
hrefFirst = void 0;
|
|
4845
|
-
hrefRest = void 0;
|
|
4846
|
-
continue;
|
|
4847
|
-
}
|
|
4848
|
-
if (char.trim() === "") hrefRest = void 0;
|
|
4849
|
-
}
|
|
4850
|
-
if (hrefFirst) {
|
|
4851
|
-
if (char !== ")" && char.trim() !== "" && !hrefRest) {
|
|
4852
|
-
hrefRest = hrefFirst;
|
|
4853
|
-
}
|
|
4854
|
-
hrefFirst = void 0;
|
|
4855
|
-
}
|
|
4856
|
-
if (afterClose) {
|
|
4857
|
-
if (char === "(") {
|
|
4858
|
-
hrefFirst = { ...afterClose, hrefStart: cursor + 1 };
|
|
4859
|
-
}
|
|
4860
|
-
afterClose = void 0;
|
|
4861
|
-
}
|
|
4862
|
-
if (textOpen >= 0 && char === "]") {
|
|
4863
|
-
afterClose = { open: textOpen, close: cursor };
|
|
4864
|
-
textOpen = -1;
|
|
4865
|
-
}
|
|
4866
|
-
if (char === "[" && textOpen < 0) textOpen = cursor;
|
|
4867
|
-
}
|
|
4868
|
-
return out;
|
|
4869
|
-
}
|
|
4870
|
-
function resolveConceptId(fromId, href) {
|
|
4871
|
-
const target = (href.split("#")[0] ?? "").split("?")[0]?.trim() ?? "";
|
|
4872
|
-
if (target === "" || isExternalHref(target)) return null;
|
|
4873
|
-
if (!target.endsWith(".md")) return null;
|
|
4874
|
-
let resolved;
|
|
4875
|
-
if (target.startsWith("/")) {
|
|
4876
|
-
resolved = target.slice(1);
|
|
4877
|
-
} else {
|
|
4878
|
-
const slash = fromId.lastIndexOf("/");
|
|
4879
|
-
const fromDir = slash >= 0 ? fromId.slice(0, slash) : "";
|
|
4880
|
-
resolved = joinPosix(fromDir, target);
|
|
4881
|
-
}
|
|
4882
|
-
resolved = resolved.replace(/^(\.\.\/)+/, "");
|
|
4883
|
-
if (isReservedFile(resolved)) return null;
|
|
4884
|
-
const id = resolved.replace(/\.md$/, "");
|
|
4885
|
-
try {
|
|
4886
|
-
assertSafeConceptId(id);
|
|
4887
|
-
return id;
|
|
4888
|
-
} catch (error) {
|
|
4889
|
-
if (error instanceof InvalidInputError) return null;
|
|
4890
|
-
throw error;
|
|
4891
|
-
}
|
|
4892
|
-
}
|
|
4893
|
-
function parseLinksFromDoc(doc) {
|
|
4894
|
-
const links = [];
|
|
4895
|
-
for (const raw of extractMarkdownLinks(doc.body)) {
|
|
4896
|
-
const to = resolveConceptId(doc.id, raw.href);
|
|
4897
|
-
if (to === null) continue;
|
|
4898
|
-
links.push({ from: doc.id, to, text: raw.text, href: raw.href });
|
|
4899
|
-
}
|
|
4900
|
-
return links;
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
|
-
// ../core/src/portable-frontmatter.ts
|
|
4904
|
-
var import_js_yaml2 = __toESM(require_js_yaml2(), 1);
|
|
4905
|
-
function parseLeadingFrontmatter(raw, context) {
|
|
4906
|
-
const split = splitLeadingFrontmatter(raw, context);
|
|
4907
|
-
if (!("yamlSource" in split)) return {};
|
|
4908
|
-
try {
|
|
4909
|
-
const parsed = import_js_yaml2.default.safeLoad(split.yamlSource);
|
|
4910
|
-
if (parsed === void 0 || parsed === null) return {};
|
|
4911
|
-
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
4912
|
-
throw new TypeError("YAML frontmatter must be a mapping");
|
|
4913
|
-
}
|
|
4914
|
-
return parsed;
|
|
4915
|
-
} catch (error) {
|
|
4916
|
-
if (error instanceof MalformedDocumentError) throw error;
|
|
4917
|
-
throw new MalformedDocumentError(context, error);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
|
|
4921
|
-
// ../core/src/query-filter.ts
|
|
4922
|
-
function matchesFilter(doc, filter) {
|
|
4923
|
-
if (filter.prefix && !doc.id.startsWith(filter.prefix)) return false;
|
|
4924
|
-
if (filter.type && doc.frontmatter.type !== filter.type) return false;
|
|
4925
|
-
if (filter.tags && filter.tags.length > 0) {
|
|
4926
|
-
const tags = Array.isArray(doc.frontmatter.tags) ? doc.frontmatter.tags : [];
|
|
4927
|
-
if (!filter.tags.every((tag) => tags.includes(tag))) return false;
|
|
4928
|
-
}
|
|
4929
|
-
if (filter.fields) {
|
|
4930
|
-
const frontmatter2 = doc.frontmatter;
|
|
4931
|
-
for (const [key, expected] of Object.entries(filter.fields)) {
|
|
4932
|
-
const raw = frontmatter2[key];
|
|
4933
|
-
const actual = raw === void 0 || raw === null ? [] : (Array.isArray(raw) ? raw : [raw]).map((value) => String(value));
|
|
4934
|
-
if (!actual.includes(expected)) return false;
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
|
-
return true;
|
|
4938
|
-
}
|
|
4939
|
-
|
|
4940
|
-
// ../core/src/engine.ts
|
|
4941
|
-
async function readBundleOkfVersion(backend) {
|
|
4942
|
-
const index = await backend.readReserved("", "index.md");
|
|
4943
|
-
if (!index) return void 0;
|
|
4944
|
-
const value = parseLeadingFrontmatter(index.content, "index.md").okf_version;
|
|
4945
|
-
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
4946
|
-
}
|
|
4947
|
-
function assertReadableConceptId(id) {
|
|
4948
|
-
assertSafeConceptId(id);
|
|
4949
|
-
const rel = pathFromConceptId(id);
|
|
4950
|
-
if (isReservedFile(rel)) {
|
|
4951
|
-
throw new InvalidInputError(`'${id}' is a reserved file (index.md / log.md), not a concept document.`);
|
|
4952
|
-
}
|
|
4953
|
-
}
|
|
4954
|
-
async function readDocVersioned(backend, id) {
|
|
4955
|
-
assertReadableConceptId(id);
|
|
4956
|
-
return backend.read(id);
|
|
4957
|
-
}
|
|
4958
|
-
function isEnoent(err) {
|
|
4959
|
-
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
4960
|
-
}
|
|
4961
|
-
async function readManyExisting(backend, ids, onMalformed) {
|
|
4962
|
-
try {
|
|
4963
|
-
return await backend.readMany(ids);
|
|
4964
|
-
} catch (err) {
|
|
4965
|
-
const malformed = err instanceof MalformedDocumentError;
|
|
4966
|
-
if (!isEnoent(err) && !(malformed && onMalformed)) throw err;
|
|
4967
|
-
const out = [];
|
|
4968
|
-
for (const id of ids) {
|
|
4969
|
-
try {
|
|
4970
|
-
out.push(await backend.read(id));
|
|
4971
|
-
} catch (candidate) {
|
|
4972
|
-
if (isEnoent(candidate)) continue;
|
|
4973
|
-
if (candidate instanceof MalformedDocumentError && onMalformed) {
|
|
4974
|
-
onMalformed({ id, reason: candidate.detail });
|
|
4975
|
-
continue;
|
|
4976
|
-
}
|
|
4977
|
-
throw candidate;
|
|
4978
|
-
}
|
|
4979
|
-
}
|
|
4980
|
-
return out;
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
async function scanMatching(backend, filter, onSkip) {
|
|
4984
|
-
const ids = await backend.list(filter.prefix);
|
|
4985
|
-
const results = [];
|
|
4986
|
-
for (const result of await readManyExisting(backend, ids, onSkip)) {
|
|
4987
|
-
if (matchesFilter(result.doc, filter)) results.push(result);
|
|
4988
|
-
}
|
|
4989
|
-
results.sort((a, b) => a.doc.id.localeCompare(b.doc.id));
|
|
4990
|
-
return results;
|
|
4991
|
-
}
|
|
4992
|
-
async function query(backend, filter = {}, options2 = {}) {
|
|
4993
|
-
return (await scanMatching(backend, filter, options2.onSkip)).map((result) => result.doc);
|
|
4994
|
-
}
|
|
4995
|
-
async function queryHeads(backend, filter = {}, options2 = {}) {
|
|
4996
|
-
if (backend.queryHeads) {
|
|
4997
|
-
const rows = (await backend.queryHeads(filter)).filter((row) => matchesFilter(row, filter));
|
|
4998
|
-
rows.sort((a, b) => a.id.localeCompare(b.id));
|
|
4999
|
-
return rows;
|
|
5000
|
-
}
|
|
5001
|
-
return (await scanMatching(backend, filter, options2.onSkip)).map(({ doc, version }) => ({
|
|
5002
|
-
id: doc.id,
|
|
5003
|
-
frontmatter: doc.frontmatter,
|
|
5004
|
-
version
|
|
5005
|
-
}));
|
|
5006
|
-
}
|
|
5007
|
-
function normalizeEdgeSelector(raw) {
|
|
5008
|
-
if (raw.endsWith("/")) {
|
|
5009
|
-
const stem = raw.slice(0, -1);
|
|
5010
|
-
assertSafeConceptId(stem);
|
|
5011
|
-
return `${stem}/`;
|
|
5012
|
-
}
|
|
5013
|
-
assertSafeConceptId(raw);
|
|
5014
|
-
return raw;
|
|
5015
|
-
}
|
|
5016
|
-
function matchesEdgeSelector(value, selectors) {
|
|
5017
|
-
if (selectors === void 0) return true;
|
|
5018
|
-
return selectors.some(
|
|
5019
|
-
(selector2) => selector2.endsWith("/") ? value.startsWith(selector2) : value === selector2
|
|
5020
|
-
);
|
|
5021
|
-
}
|
|
5022
|
-
function toSelectorList(value) {
|
|
5023
|
-
if (value === void 0) return void 0;
|
|
5024
|
-
return Array.isArray(value) ? value : [value];
|
|
5025
|
-
}
|
|
5026
|
-
async function queryEdges(backend, filter = {}) {
|
|
5027
|
-
const fromSelectors = toSelectorList(filter.from)?.map(normalizeEdgeSelector);
|
|
5028
|
-
const toSelectors = toSelectorList(filter.to)?.map(normalizeEdgeSelector);
|
|
5029
|
-
const edges = [];
|
|
5030
|
-
for (const doc of await query(backend)) {
|
|
5031
|
-
for (const link of parseLinksFromDoc(doc)) {
|
|
5032
|
-
if (!matchesEdgeSelector(link.from, fromSelectors)) continue;
|
|
5033
|
-
if (!matchesEdgeSelector(link.to, toSelectors)) continue;
|
|
5034
|
-
if (filter.text !== void 0 && link.text !== filter.text) continue;
|
|
5035
|
-
edges.push(link);
|
|
5036
|
-
}
|
|
5037
|
-
}
|
|
5038
|
-
edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || a.text.localeCompare(b.text));
|
|
5039
|
-
return edges;
|
|
5040
|
-
}
|
|
5041
|
-
|
|
5042
4404
|
// ../core/src/bundle.ts
|
|
5043
4405
|
function backendFor(bundle) {
|
|
5044
4406
|
return bundle.backend ?? new FilesystemBackend(bundle.root);
|
|
@@ -5049,11 +4411,11 @@ async function readBundleOkfVersion2(bundle) {
|
|
|
5049
4411
|
async function readDocVersioned2(bundle, id) {
|
|
5050
4412
|
return readDocVersioned(backendFor(bundle), id);
|
|
5051
4413
|
}
|
|
5052
|
-
async function query2(bundle, filter = {},
|
|
5053
|
-
return query(backendFor(bundle), filter,
|
|
4414
|
+
async function query2(bundle, filter = {}, options = {}) {
|
|
4415
|
+
return query(backendFor(bundle), filter, options);
|
|
5054
4416
|
}
|
|
5055
|
-
async function queryHeads2(bundle, filter = {},
|
|
5056
|
-
return queryHeads(backendFor(bundle), filter,
|
|
4417
|
+
async function queryHeads2(bundle, filter = {}, options = {}) {
|
|
4418
|
+
return queryHeads(backendFor(bundle), filter, options);
|
|
5057
4419
|
}
|
|
5058
4420
|
async function queryEdges2(bundle, filter = {}) {
|
|
5059
4421
|
return queryEdges(backendFor(bundle), filter);
|
|
@@ -5062,11 +4424,11 @@ async function queryEdges2(bundle, filter = {}) {
|
|
|
5062
4424
|
// ../core/src/kinds.ts
|
|
5063
4425
|
var CONVENTIONS_PREFIX = "conventions/";
|
|
5064
4426
|
var CONVENTION_TYPE = "Convention";
|
|
5065
|
-
function buildKindRegistry(docs, initialWarnings = []) {
|
|
4427
|
+
function buildKindRegistry(docs, initialWarnings = [], options = {}) {
|
|
5066
4428
|
const kinds = /* @__PURE__ */ new Map();
|
|
5067
4429
|
const warnings = [...initialWarnings];
|
|
5068
4430
|
for (const doc of [...docs].sort((a, b) => a.id.localeCompare(b.id))) {
|
|
5069
|
-
const parsed = parseConventionDoc(doc);
|
|
4431
|
+
const parsed = parseConventionDoc(doc, options);
|
|
5070
4432
|
if (!parsed.ok) {
|
|
5071
4433
|
warnings.push({
|
|
5072
4434
|
code: "KIND_CONVENTION_MALFORMED",
|
|
@@ -5197,7 +4559,7 @@ function toStringArrayLenient(value, path4, docId, warnings) {
|
|
|
5197
4559
|
}
|
|
5198
4560
|
return out;
|
|
5199
4561
|
}
|
|
5200
|
-
var RESERVED_KIND_FIELD_NAMES = ["type", "dir", "remote", "json", "help", "body", "body-file"];
|
|
4562
|
+
var RESERVED_KIND_FIELD_NAMES = ["type", "dir", "remote", "json", "help", "body", "body-file", "stale-after"];
|
|
5201
4563
|
var RESERVED_FIELD_NAMES = new Set(RESERVED_KIND_FIELD_NAMES);
|
|
5202
4564
|
var VALID_FIELDS_KEYS = /* @__PURE__ */ new Set([
|
|
5203
4565
|
"required",
|
|
@@ -5212,7 +4574,7 @@ var CLAIM_COORDINATE_KEYS = [
|
|
|
5212
4574
|
["owner_field", "ownerField"],
|
|
5213
4575
|
["state_field", "stateField"]
|
|
5214
4576
|
];
|
|
5215
|
-
function parseConventionDoc(doc) {
|
|
4577
|
+
function parseConventionDoc(doc, options = {}) {
|
|
5216
4578
|
const fm = doc.frontmatter;
|
|
5217
4579
|
const governs = typeof fm.governs === "string" ? fm.governs.trim() : "";
|
|
5218
4580
|
if (governs === "") {
|
|
@@ -5283,6 +4645,14 @@ function parseConventionDoc(doc) {
|
|
|
5283
4645
|
}
|
|
5284
4646
|
}
|
|
5285
4647
|
}
|
|
4648
|
+
if (options.okfVersion === "0.2" && values.status?.some((value) => !isOkfLifecycleStatus(value))) {
|
|
4649
|
+
warnings.push({
|
|
4650
|
+
code: "OKF_WORKFLOW_STATUS_COLLISION",
|
|
4651
|
+
message: `kind convention '${doc.id}' declares 'fields.values.status' with values outside the OKF v0.2 lifecycle (${OKF_LIFECYCLE_STATUSES.join(", ")}); instance authoring rejects those values. Move workflow state to 'superbee_progress_status' (CLI '--progress_status') and migrate its required/optional, descriptions, values, value_descriptions, terminal declarations and instances.`,
|
|
4652
|
+
field: "fields.values.status",
|
|
4653
|
+
severity: "warning"
|
|
4654
|
+
});
|
|
4655
|
+
}
|
|
5286
4656
|
const declaredFieldNames = /* @__PURE__ */ new Set([...required, ...optional]);
|
|
5287
4657
|
for (const field of Object.keys(values)) {
|
|
5288
4658
|
if (!declaredFieldNames.has(field)) {
|
|
@@ -5659,7 +5029,11 @@ async function loadKinds(bundle) {
|
|
|
5659
5029
|
severity: "warning"
|
|
5660
5030
|
})
|
|
5661
5031
|
});
|
|
5662
|
-
|
|
5032
|
+
const okfVersion = await readBundleOkfVersion2(bundle).catch((error) => {
|
|
5033
|
+
if (!(error instanceof MalformedDocumentError)) throw error;
|
|
5034
|
+
return void 0;
|
|
5035
|
+
});
|
|
5036
|
+
return buildKindRegistry(docs, warnings, { okfVersion });
|
|
5663
5037
|
}
|
|
5664
5038
|
|
|
5665
5039
|
// ../core/src/page.ts
|
|
@@ -5896,8 +5270,8 @@ function boundedRows(rows, params, kinds) {
|
|
|
5896
5270
|
return applyQuerySelectionFilters(rows, { ...params, limit: requested }, kinds);
|
|
5897
5271
|
}
|
|
5898
5272
|
var BridgeService = class {
|
|
5899
|
-
constructor(
|
|
5900
|
-
this.options =
|
|
5273
|
+
constructor(options) {
|
|
5274
|
+
this.options = options;
|
|
5901
5275
|
}
|
|
5902
5276
|
subscriptions = /* @__PURE__ */ new Map();
|
|
5903
5277
|
nextPollGeneration = 0;
|
|
@@ -6159,16 +5533,16 @@ var PublicationError = class extends Error {
|
|
|
6159
5533
|
actual;
|
|
6160
5534
|
details;
|
|
6161
5535
|
cause;
|
|
6162
|
-
constructor(code, message,
|
|
5536
|
+
constructor(code, message, options = {}) {
|
|
6163
5537
|
super(message);
|
|
6164
5538
|
this.name = "PublicationError";
|
|
6165
5539
|
this.code = code;
|
|
6166
|
-
this.retryable =
|
|
6167
|
-
if (
|
|
6168
|
-
if (
|
|
6169
|
-
if (
|
|
6170
|
-
if (
|
|
6171
|
-
if (
|
|
5540
|
+
this.retryable = options.retryable ?? false;
|
|
5541
|
+
if (options.subject !== void 0) this.subject = options.subject;
|
|
5542
|
+
if (options.expected !== void 0) this.expected = options.expected;
|
|
5543
|
+
if (options.actual !== void 0) this.actual = options.actual;
|
|
5544
|
+
if (options.details !== void 0) this.details = options.details;
|
|
5545
|
+
if (options.cause !== void 0) this.cause = options.cause;
|
|
6172
5546
|
}
|
|
6173
5547
|
};
|
|
6174
5548
|
function isPublicationError(value) {
|
|
@@ -6280,15 +5654,15 @@ var STATIC_LAUNCH_ID = "publication-snapshot";
|
|
|
6280
5654
|
function digest(bytes) {
|
|
6281
5655
|
return `sha256:${createHash4("sha256").update(bytes).digest("hex")}`;
|
|
6282
5656
|
}
|
|
6283
|
-
function createPublicationBridge(
|
|
6284
|
-
if (
|
|
5657
|
+
function createPublicationBridge(options) {
|
|
5658
|
+
if (options.protocol !== PUBLICATION_BRIDGE_V0) {
|
|
6285
5659
|
throw new PublicationError("CAPABILITY_UNAVAILABLE", "the requested publication bridge protocol is unsupported");
|
|
6286
5660
|
}
|
|
6287
|
-
const registration =
|
|
5661
|
+
const registration = options.snapshot.manifest.views.find((view) => view.id === options.admittedView.id);
|
|
6288
5662
|
if (registration?.access === "bundle-propose") {
|
|
6289
5663
|
throw new PublicationError("INVALID_BRIDGE_ADMISSION", "static publication cannot admit a bundle-propose View");
|
|
6290
5664
|
}
|
|
6291
|
-
if (!registration || registration.entry !==
|
|
5665
|
+
if (!registration || registration.entry !== options.admittedView.entry || registration.access !== options.admittedView.access || registration.entryObject.digest !== options.admittedView.entryDigest) {
|
|
6292
5666
|
throw new PublicationError("INVALID_BRIDGE_ADMISSION", "the admitted View does not exactly match the snapshot");
|
|
6293
5667
|
}
|
|
6294
5668
|
const capability = registration.access;
|
|
@@ -6299,8 +5673,8 @@ function createPublicationBridge(options2) {
|
|
|
6299
5673
|
revoke() {
|
|
6300
5674
|
}
|
|
6301
5675
|
};
|
|
6302
|
-
const documents = new Map(
|
|
6303
|
-
const backend = new PublicationSnapshotBackend(
|
|
5676
|
+
const documents = new Map(options.snapshot.manifest.documents.map((row) => [row.id, row]));
|
|
5677
|
+
const backend = new PublicationSnapshotBackend(options.snapshot);
|
|
6304
5678
|
return {
|
|
6305
5679
|
async handle(rawRequest) {
|
|
6306
5680
|
let rendered;
|
|
@@ -6308,7 +5682,7 @@ function createPublicationBridge(options2) {
|
|
|
6308
5682
|
const id = rawRequest.docId;
|
|
6309
5683
|
const row = documents.get(id);
|
|
6310
5684
|
if (row) {
|
|
6311
|
-
const bytes = await
|
|
5685
|
+
const bytes = await options.snapshot.readObject(row.rendered.html);
|
|
6312
5686
|
if (digest(bytes) !== row.rendered.html.digest) {
|
|
6313
5687
|
throw new PublicationError("OBJECT_DIGEST_MISMATCH", "rendered document digest mismatch", { subject: id });
|
|
6314
5688
|
}
|
|
@@ -6346,21 +5720,3 @@ export {
|
|
|
6346
5720
|
createPublicationBridge,
|
|
6347
5721
|
isPublicationError
|
|
6348
5722
|
};
|
|
6349
|
-
/*! Bundled license information:
|
|
6350
|
-
|
|
6351
|
-
is-extendable/index.js:
|
|
6352
|
-
(*!
|
|
6353
|
-
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
6354
|
-
*
|
|
6355
|
-
* Copyright (c) 2015, Jon Schlinkert.
|
|
6356
|
-
* Licensed under the MIT License.
|
|
6357
|
-
*)
|
|
6358
|
-
|
|
6359
|
-
strip-bom-string/index.js:
|
|
6360
|
-
(*!
|
|
6361
|
-
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
6362
|
-
*
|
|
6363
|
-
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
6364
|
-
* Released under the MIT License.
|
|
6365
|
-
*)
|
|
6366
|
-
*/
|