sentinelflow 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +3752 -252
- package/package.json +2 -6
package/dist/bundle.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
#!/usr/bin/env node
|
|
3
2
|
"use strict";
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __commonJS = (cb, mod) => function __require() {
|
|
6
5
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
6
|
};
|
|
8
7
|
|
|
9
|
-
//
|
|
8
|
+
// ../core/dist/schema/agent.js
|
|
10
9
|
var require_agent = __commonJS({
|
|
11
|
-
"
|
|
10
|
+
"../core/dist/schema/agent.js"(exports2) {
|
|
12
11
|
"use strict";
|
|
13
12
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14
13
|
exports2.createAgent = createAgent;
|
|
@@ -52,9 +51,9 @@ var require_agent = __commonJS({
|
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
|
|
55
|
-
//
|
|
54
|
+
// ../core/dist/schema/finding.js
|
|
56
55
|
var require_finding = __commonJS({
|
|
57
|
-
"
|
|
56
|
+
"../core/dist/schema/finding.js"(exports2) {
|
|
58
57
|
"use strict";
|
|
59
58
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
60
59
|
exports2.createScanReport = createScanReport;
|
|
@@ -81,17 +80,17 @@ var require_finding = __commonJS({
|
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
82
|
|
|
84
|
-
//
|
|
83
|
+
// ../core/dist/schema/event.js
|
|
85
84
|
var require_event = __commonJS({
|
|
86
|
-
"
|
|
85
|
+
"../core/dist/schema/event.js"(exports2) {
|
|
87
86
|
"use strict";
|
|
88
87
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
89
88
|
}
|
|
90
89
|
});
|
|
91
90
|
|
|
92
|
-
//
|
|
91
|
+
// ../core/dist/registry/local.js
|
|
93
92
|
var require_local = __commonJS({
|
|
94
|
-
"
|
|
93
|
+
"../core/dist/registry/local.js"(exports2) {
|
|
95
94
|
"use strict";
|
|
96
95
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
97
96
|
if (k2 === void 0) k2 = k;
|
|
@@ -150,205 +149,3688 @@ var require_local = __commonJS({
|
|
|
150
149
|
if (fs.existsSync(tmpPath)) {
|
|
151
150
|
fs.unlinkSync(tmpPath);
|
|
152
151
|
}
|
|
153
|
-
} catch {
|
|
152
|
+
} catch {
|
|
153
|
+
}
|
|
154
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
155
|
+
throw new Error(`Failed to write ${filePath}: ${message}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function safeReadJSON(filePath, fallback) {
|
|
159
|
+
try {
|
|
160
|
+
if (!fs.existsSync(filePath)) {
|
|
161
|
+
return fallback;
|
|
162
|
+
}
|
|
163
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
164
|
+
if (raw.trim() === "") {
|
|
165
|
+
return fallback;
|
|
166
|
+
}
|
|
167
|
+
return JSON.parse(raw);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
170
|
+
console.warn(`Warning: Could not read ${filePath}: ${message}. Using defaults.`);
|
|
171
|
+
return fallback;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
var LocalRegistry = class {
|
|
175
|
+
basePath;
|
|
176
|
+
agents = /* @__PURE__ */ new Map();
|
|
177
|
+
reports = [];
|
|
178
|
+
events = [];
|
|
179
|
+
initialized = false;
|
|
180
|
+
constructor(projectRoot) {
|
|
181
|
+
this.basePath = path.join(projectRoot, SF_DIR);
|
|
182
|
+
}
|
|
183
|
+
// ─── Lifecycle ────────────────────────────────────────────
|
|
184
|
+
async initialize() {
|
|
185
|
+
if (this.initialized)
|
|
186
|
+
return;
|
|
187
|
+
if (!fs.existsSync(this.basePath)) {
|
|
188
|
+
fs.mkdirSync(this.basePath, { recursive: true });
|
|
189
|
+
}
|
|
190
|
+
const agentsData = safeReadJSON(path.join(this.basePath, AGENTS_FILE), []);
|
|
191
|
+
for (const agent of agentsData) {
|
|
192
|
+
this.agents.set(agent.id, agent);
|
|
193
|
+
}
|
|
194
|
+
this.reports = safeReadJSON(path.join(this.basePath, REPORTS_FILE), []);
|
|
195
|
+
this.events = safeReadJSON(path.join(this.basePath, EVENTS_FILE), []);
|
|
196
|
+
this.initialized = true;
|
|
197
|
+
}
|
|
198
|
+
async close() {
|
|
199
|
+
if (!this.initialized)
|
|
200
|
+
return;
|
|
201
|
+
this.persistAll();
|
|
202
|
+
this.initialized = false;
|
|
203
|
+
}
|
|
204
|
+
// ─── Persistence ──────────────────────────────────────────
|
|
205
|
+
persistAgents() {
|
|
206
|
+
atomicWriteSync(path.join(this.basePath, AGENTS_FILE), JSON.stringify([...this.agents.values()], null, 2));
|
|
207
|
+
}
|
|
208
|
+
persistReports() {
|
|
209
|
+
atomicWriteSync(path.join(this.basePath, REPORTS_FILE), JSON.stringify(this.reports, null, 2));
|
|
210
|
+
}
|
|
211
|
+
persistAll() {
|
|
212
|
+
this.persistAgents();
|
|
213
|
+
this.persistReports();
|
|
214
|
+
}
|
|
215
|
+
ensureInitialized() {
|
|
216
|
+
if (!this.initialized) {
|
|
217
|
+
throw new Error("Registry not initialized. Call initialize() before using the registry.");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// ─── Agent CRUD ───────────────────────────────────────────
|
|
221
|
+
async upsertAgent(agent) {
|
|
222
|
+
this.ensureInitialized();
|
|
223
|
+
agent.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
224
|
+
this.agents.set(agent.id, agent);
|
|
225
|
+
this.persistAgents();
|
|
226
|
+
}
|
|
227
|
+
async getAgent(id) {
|
|
228
|
+
this.ensureInitialized();
|
|
229
|
+
return this.agents.get(id) ?? null;
|
|
230
|
+
}
|
|
231
|
+
async getAgentByName(name, framework) {
|
|
232
|
+
this.ensureInitialized();
|
|
233
|
+
for (const agent of this.agents.values()) {
|
|
234
|
+
if (agent.name === name && agent.framework === framework) {
|
|
235
|
+
return agent;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
async listAgents(options2) {
|
|
241
|
+
this.ensureInitialized();
|
|
242
|
+
let agents = [...this.agents.values()];
|
|
243
|
+
if (options2?.framework) {
|
|
244
|
+
agents = agents.filter((a) => a.framework === options2.framework);
|
|
245
|
+
}
|
|
246
|
+
if (options2?.status) {
|
|
247
|
+
agents = agents.filter((a) => a.governance.status === options2.status);
|
|
248
|
+
}
|
|
249
|
+
if (options2?.risk_level) {
|
|
250
|
+
agents = agents.filter((a) => a.governance.risk_level === options2.risk_level);
|
|
251
|
+
}
|
|
252
|
+
if (options2?.owner) {
|
|
253
|
+
agents = agents.filter((a) => a.owner === options2.owner);
|
|
254
|
+
}
|
|
255
|
+
if (options2?.team) {
|
|
256
|
+
agents = agents.filter((a) => a.team === options2.team);
|
|
257
|
+
}
|
|
258
|
+
const offset = options2?.offset ?? 0;
|
|
259
|
+
const limit = options2?.limit ?? 100;
|
|
260
|
+
return agents.slice(offset, offset + limit);
|
|
261
|
+
}
|
|
262
|
+
async deleteAgent(id) {
|
|
263
|
+
this.ensureInitialized();
|
|
264
|
+
if (!this.agents.has(id)) {
|
|
265
|
+
throw new Error(`Agent not found: ${id}`);
|
|
266
|
+
}
|
|
267
|
+
this.agents.delete(id);
|
|
268
|
+
this.persistAgents();
|
|
269
|
+
}
|
|
270
|
+
async countAgents() {
|
|
271
|
+
this.ensureInitialized();
|
|
272
|
+
return this.agents.size;
|
|
273
|
+
}
|
|
274
|
+
// ─── Findings ─────────────────────────────────────────────
|
|
275
|
+
async storeScanReport(report) {
|
|
276
|
+
this.ensureInitialized();
|
|
277
|
+
this.reports.push(report);
|
|
278
|
+
if (this.reports.length > MAX_REPORTS) {
|
|
279
|
+
this.reports = this.reports.slice(-MAX_REPORTS);
|
|
280
|
+
}
|
|
281
|
+
this.persistReports();
|
|
282
|
+
}
|
|
283
|
+
async getLatestScanReport() {
|
|
284
|
+
this.ensureInitialized();
|
|
285
|
+
if (this.reports.length === 0)
|
|
286
|
+
return null;
|
|
287
|
+
return this.reports[this.reports.length - 1] ?? null;
|
|
288
|
+
}
|
|
289
|
+
async listFindings(agentId) {
|
|
290
|
+
this.ensureInitialized();
|
|
291
|
+
const latest = await this.getLatestScanReport();
|
|
292
|
+
if (!latest)
|
|
293
|
+
return [];
|
|
294
|
+
if (agentId) {
|
|
295
|
+
return latest.findings.filter((f) => f.agent_id === agentId);
|
|
296
|
+
}
|
|
297
|
+
return latest.findings;
|
|
298
|
+
}
|
|
299
|
+
// ─── Events (Phase 2) ────────────────────────────────────
|
|
300
|
+
async ingestEvents(events) {
|
|
301
|
+
this.ensureInitialized();
|
|
302
|
+
this.events.push(...events);
|
|
303
|
+
if (this.events.length > MAX_EVENTS) {
|
|
304
|
+
this.events = this.events.slice(-MAX_EVENTS);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
async queryEvents(agentId, limit = 100) {
|
|
308
|
+
this.ensureInitialized();
|
|
309
|
+
return this.events.filter((e) => e.agent_id === agentId).slice(-limit);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
exports2.LocalRegistry = LocalRegistry;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// ../core/dist/index.js
|
|
317
|
+
var require_dist = __commonJS({
|
|
318
|
+
"../core/dist/index.js"(exports2) {
|
|
319
|
+
"use strict";
|
|
320
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
321
|
+
if (k2 === void 0) k2 = k;
|
|
322
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
323
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
324
|
+
desc = { enumerable: true, get: function() {
|
|
325
|
+
return m[k];
|
|
326
|
+
} };
|
|
327
|
+
}
|
|
328
|
+
Object.defineProperty(o, k2, desc);
|
|
329
|
+
}) : (function(o, m, k, k2) {
|
|
330
|
+
if (k2 === void 0) k2 = k;
|
|
331
|
+
o[k2] = m[k];
|
|
332
|
+
}));
|
|
333
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
334
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
|
|
335
|
+
};
|
|
336
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
337
|
+
exports2.LocalRegistry = void 0;
|
|
338
|
+
__exportStar(require_agent(), exports2);
|
|
339
|
+
__exportStar(require_finding(), exports2);
|
|
340
|
+
__exportStar(require_event(), exports2);
|
|
341
|
+
var local_1 = require_local();
|
|
342
|
+
Object.defineProperty(exports2, "LocalRegistry", { enumerable: true, get: function() {
|
|
343
|
+
return local_1.LocalRegistry;
|
|
344
|
+
} });
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// ../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js
|
|
349
|
+
var require_kind_of = __commonJS({
|
|
350
|
+
"../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"(exports2, module2) {
|
|
351
|
+
var toString = Object.prototype.toString;
|
|
352
|
+
module2.exports = function kindOf(val) {
|
|
353
|
+
if (val === void 0) return "undefined";
|
|
354
|
+
if (val === null) return "null";
|
|
355
|
+
var type = typeof val;
|
|
356
|
+
if (type === "boolean") return "boolean";
|
|
357
|
+
if (type === "string") return "string";
|
|
358
|
+
if (type === "number") return "number";
|
|
359
|
+
if (type === "symbol") return "symbol";
|
|
360
|
+
if (type === "function") {
|
|
361
|
+
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
|
362
|
+
}
|
|
363
|
+
if (isArray(val)) return "array";
|
|
364
|
+
if (isBuffer(val)) return "buffer";
|
|
365
|
+
if (isArguments(val)) return "arguments";
|
|
366
|
+
if (isDate(val)) return "date";
|
|
367
|
+
if (isError(val)) return "error";
|
|
368
|
+
if (isRegexp(val)) return "regexp";
|
|
369
|
+
switch (ctorName(val)) {
|
|
370
|
+
case "Symbol":
|
|
371
|
+
return "symbol";
|
|
372
|
+
case "Promise":
|
|
373
|
+
return "promise";
|
|
374
|
+
// Set, Map, WeakSet, WeakMap
|
|
375
|
+
case "WeakMap":
|
|
376
|
+
return "weakmap";
|
|
377
|
+
case "WeakSet":
|
|
378
|
+
return "weakset";
|
|
379
|
+
case "Map":
|
|
380
|
+
return "map";
|
|
381
|
+
case "Set":
|
|
382
|
+
return "set";
|
|
383
|
+
// 8-bit typed arrays
|
|
384
|
+
case "Int8Array":
|
|
385
|
+
return "int8array";
|
|
386
|
+
case "Uint8Array":
|
|
387
|
+
return "uint8array";
|
|
388
|
+
case "Uint8ClampedArray":
|
|
389
|
+
return "uint8clampedarray";
|
|
390
|
+
// 16-bit typed arrays
|
|
391
|
+
case "Int16Array":
|
|
392
|
+
return "int16array";
|
|
393
|
+
case "Uint16Array":
|
|
394
|
+
return "uint16array";
|
|
395
|
+
// 32-bit typed arrays
|
|
396
|
+
case "Int32Array":
|
|
397
|
+
return "int32array";
|
|
398
|
+
case "Uint32Array":
|
|
399
|
+
return "uint32array";
|
|
400
|
+
case "Float32Array":
|
|
401
|
+
return "float32array";
|
|
402
|
+
case "Float64Array":
|
|
403
|
+
return "float64array";
|
|
404
|
+
}
|
|
405
|
+
if (isGeneratorObj(val)) {
|
|
406
|
+
return "generator";
|
|
407
|
+
}
|
|
408
|
+
type = toString.call(val);
|
|
409
|
+
switch (type) {
|
|
410
|
+
case "[object Object]":
|
|
411
|
+
return "object";
|
|
412
|
+
// iterators
|
|
413
|
+
case "[object Map Iterator]":
|
|
414
|
+
return "mapiterator";
|
|
415
|
+
case "[object Set Iterator]":
|
|
416
|
+
return "setiterator";
|
|
417
|
+
case "[object String Iterator]":
|
|
418
|
+
return "stringiterator";
|
|
419
|
+
case "[object Array Iterator]":
|
|
420
|
+
return "arrayiterator";
|
|
421
|
+
}
|
|
422
|
+
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
423
|
+
};
|
|
424
|
+
function ctorName(val) {
|
|
425
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
426
|
+
}
|
|
427
|
+
function isArray(val) {
|
|
428
|
+
if (Array.isArray) return Array.isArray(val);
|
|
429
|
+
return val instanceof Array;
|
|
430
|
+
}
|
|
431
|
+
function isError(val) {
|
|
432
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
433
|
+
}
|
|
434
|
+
function isDate(val) {
|
|
435
|
+
if (val instanceof Date) return true;
|
|
436
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
437
|
+
}
|
|
438
|
+
function isRegexp(val) {
|
|
439
|
+
if (val instanceof RegExp) return true;
|
|
440
|
+
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
|
|
441
|
+
}
|
|
442
|
+
function isGeneratorFn(name, val) {
|
|
443
|
+
return ctorName(name) === "GeneratorFunction";
|
|
444
|
+
}
|
|
445
|
+
function isGeneratorObj(val) {
|
|
446
|
+
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
|
|
447
|
+
}
|
|
448
|
+
function isArguments(val) {
|
|
449
|
+
try {
|
|
450
|
+
if (typeof val.length === "number" && typeof val.callee === "function") {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
} catch (err) {
|
|
454
|
+
if (err.message.indexOf("callee") !== -1) {
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
function isBuffer(val) {
|
|
461
|
+
if (val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
462
|
+
return val.constructor.isBuffer(val);
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// ../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js
|
|
470
|
+
var require_is_extendable = __commonJS({
|
|
471
|
+
"../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js"(exports2, module2) {
|
|
472
|
+
"use strict";
|
|
473
|
+
module2.exports = function isExtendable(val) {
|
|
474
|
+
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// ../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js
|
|
480
|
+
var require_extend_shallow = __commonJS({
|
|
481
|
+
"../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js"(exports2, module2) {
|
|
482
|
+
"use strict";
|
|
483
|
+
var isObject = require_is_extendable();
|
|
484
|
+
module2.exports = function extend(o) {
|
|
485
|
+
if (!isObject(o)) {
|
|
486
|
+
o = {};
|
|
487
|
+
}
|
|
488
|
+
var len = arguments.length;
|
|
489
|
+
for (var i = 1; i < len; i++) {
|
|
490
|
+
var obj = arguments[i];
|
|
491
|
+
if (isObject(obj)) {
|
|
492
|
+
assign(o, obj);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return o;
|
|
496
|
+
};
|
|
497
|
+
function assign(a, b) {
|
|
498
|
+
for (var key in b) {
|
|
499
|
+
if (hasOwn(b, key)) {
|
|
500
|
+
a[key] = b[key];
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function hasOwn(obj, key) {
|
|
505
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// ../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js
|
|
511
|
+
var require_section_matter = __commonJS({
|
|
512
|
+
"../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js"(exports2, module2) {
|
|
513
|
+
"use strict";
|
|
514
|
+
var typeOf = require_kind_of();
|
|
515
|
+
var extend = require_extend_shallow();
|
|
516
|
+
module2.exports = function(input, options2) {
|
|
517
|
+
if (typeof options2 === "function") {
|
|
518
|
+
options2 = { parse: options2 };
|
|
519
|
+
}
|
|
520
|
+
var file = toObject(input);
|
|
521
|
+
var defaults = { section_delimiter: "---", parse: identity };
|
|
522
|
+
var opts = extend({}, defaults, options2);
|
|
523
|
+
var delim = opts.section_delimiter;
|
|
524
|
+
var lines = file.content.split(/\r?\n/);
|
|
525
|
+
var sections = null;
|
|
526
|
+
var section = createSection();
|
|
527
|
+
var content = [];
|
|
528
|
+
var stack = [];
|
|
529
|
+
function initSections(val) {
|
|
530
|
+
file.content = val;
|
|
531
|
+
sections = [];
|
|
532
|
+
content = [];
|
|
533
|
+
}
|
|
534
|
+
function closeSection(val) {
|
|
535
|
+
if (stack.length) {
|
|
536
|
+
section.key = getKey(stack[0], delim);
|
|
537
|
+
section.content = val;
|
|
538
|
+
opts.parse(section, sections);
|
|
539
|
+
sections.push(section);
|
|
540
|
+
section = createSection();
|
|
541
|
+
content = [];
|
|
542
|
+
stack = [];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
for (var i = 0; i < lines.length; i++) {
|
|
546
|
+
var line = lines[i];
|
|
547
|
+
var len = stack.length;
|
|
548
|
+
var ln = line.trim();
|
|
549
|
+
if (isDelimiter(ln, delim)) {
|
|
550
|
+
if (ln.length === 3 && i !== 0) {
|
|
551
|
+
if (len === 0 || len === 2) {
|
|
552
|
+
content.push(line);
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
stack.push(ln);
|
|
556
|
+
section.data = content.join("\n");
|
|
557
|
+
content = [];
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
if (sections === null) {
|
|
561
|
+
initSections(content.join("\n"));
|
|
562
|
+
}
|
|
563
|
+
if (len === 2) {
|
|
564
|
+
closeSection(content.join("\n"));
|
|
565
|
+
}
|
|
566
|
+
stack.push(ln);
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
content.push(line);
|
|
570
|
+
}
|
|
571
|
+
if (sections === null) {
|
|
572
|
+
initSections(content.join("\n"));
|
|
573
|
+
} else {
|
|
574
|
+
closeSection(content.join("\n"));
|
|
575
|
+
}
|
|
576
|
+
file.sections = sections;
|
|
577
|
+
return file;
|
|
578
|
+
};
|
|
579
|
+
function isDelimiter(line, delim) {
|
|
580
|
+
if (line.slice(0, delim.length) !== delim) {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
function toObject(input) {
|
|
589
|
+
if (typeOf(input) !== "object") {
|
|
590
|
+
input = { content: input };
|
|
591
|
+
}
|
|
592
|
+
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
|
593
|
+
throw new TypeError("expected a buffer or string");
|
|
594
|
+
}
|
|
595
|
+
input.content = input.content.toString();
|
|
596
|
+
input.sections = [];
|
|
597
|
+
return input;
|
|
598
|
+
}
|
|
599
|
+
function getKey(val, delim) {
|
|
600
|
+
return val ? val.slice(delim.length).trim() : "";
|
|
601
|
+
}
|
|
602
|
+
function createSection() {
|
|
603
|
+
return { key: "", data: "", content: "" };
|
|
604
|
+
}
|
|
605
|
+
function identity(val) {
|
|
606
|
+
return val;
|
|
607
|
+
}
|
|
608
|
+
function isBuffer(val) {
|
|
609
|
+
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
610
|
+
return val.constructor.isBuffer(val);
|
|
611
|
+
}
|
|
612
|
+
return false;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/common.js
|
|
618
|
+
var require_common = __commonJS({
|
|
619
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
|
620
|
+
"use strict";
|
|
621
|
+
function isNothing(subject) {
|
|
622
|
+
return typeof subject === "undefined" || subject === null;
|
|
623
|
+
}
|
|
624
|
+
function isObject(subject) {
|
|
625
|
+
return typeof subject === "object" && subject !== null;
|
|
626
|
+
}
|
|
627
|
+
function toArray(sequence) {
|
|
628
|
+
if (Array.isArray(sequence)) return sequence;
|
|
629
|
+
else if (isNothing(sequence)) return [];
|
|
630
|
+
return [sequence];
|
|
631
|
+
}
|
|
632
|
+
function extend(target, source) {
|
|
633
|
+
var index, length, key, sourceKeys;
|
|
634
|
+
if (source) {
|
|
635
|
+
sourceKeys = Object.keys(source);
|
|
636
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
637
|
+
key = sourceKeys[index];
|
|
638
|
+
target[key] = source[key];
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return target;
|
|
642
|
+
}
|
|
643
|
+
function repeat(string, count) {
|
|
644
|
+
var result = "", cycle;
|
|
645
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
646
|
+
result += string;
|
|
647
|
+
}
|
|
648
|
+
return result;
|
|
649
|
+
}
|
|
650
|
+
function isNegativeZero(number) {
|
|
651
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
652
|
+
}
|
|
653
|
+
module2.exports.isNothing = isNothing;
|
|
654
|
+
module2.exports.isObject = isObject;
|
|
655
|
+
module2.exports.toArray = toArray;
|
|
656
|
+
module2.exports.repeat = repeat;
|
|
657
|
+
module2.exports.isNegativeZero = isNegativeZero;
|
|
658
|
+
module2.exports.extend = extend;
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/exception.js
|
|
663
|
+
var require_exception = __commonJS({
|
|
664
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
|
665
|
+
"use strict";
|
|
666
|
+
function YAMLException(reason, mark) {
|
|
667
|
+
Error.call(this);
|
|
668
|
+
this.name = "YAMLException";
|
|
669
|
+
this.reason = reason;
|
|
670
|
+
this.mark = mark;
|
|
671
|
+
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
|
|
672
|
+
if (Error.captureStackTrace) {
|
|
673
|
+
Error.captureStackTrace(this, this.constructor);
|
|
674
|
+
} else {
|
|
675
|
+
this.stack = new Error().stack || "";
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
679
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
680
|
+
YAMLException.prototype.toString = function toString(compact) {
|
|
681
|
+
var result = this.name + ": ";
|
|
682
|
+
result += this.reason || "(unknown reason)";
|
|
683
|
+
if (!compact && this.mark) {
|
|
684
|
+
result += " " + this.mark.toString();
|
|
685
|
+
}
|
|
686
|
+
return result;
|
|
687
|
+
};
|
|
688
|
+
module2.exports = YAMLException;
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/mark.js
|
|
693
|
+
var require_mark = __commonJS({
|
|
694
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
|
695
|
+
"use strict";
|
|
696
|
+
var common = require_common();
|
|
697
|
+
function Mark(name, buffer, position, line, column) {
|
|
698
|
+
this.name = name;
|
|
699
|
+
this.buffer = buffer;
|
|
700
|
+
this.position = position;
|
|
701
|
+
this.line = line;
|
|
702
|
+
this.column = column;
|
|
703
|
+
}
|
|
704
|
+
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
705
|
+
var head, start, tail, end, snippet;
|
|
706
|
+
if (!this.buffer) return null;
|
|
707
|
+
indent = indent || 4;
|
|
708
|
+
maxLength = maxLength || 75;
|
|
709
|
+
head = "";
|
|
710
|
+
start = this.position;
|
|
711
|
+
while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
|
|
712
|
+
start -= 1;
|
|
713
|
+
if (this.position - start > maxLength / 2 - 1) {
|
|
714
|
+
head = " ... ";
|
|
715
|
+
start += 5;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
tail = "";
|
|
720
|
+
end = this.position;
|
|
721
|
+
while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
|
722
|
+
end += 1;
|
|
723
|
+
if (end - this.position > maxLength / 2 - 1) {
|
|
724
|
+
tail = " ... ";
|
|
725
|
+
end -= 5;
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
snippet = this.buffer.slice(start, end);
|
|
730
|
+
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
731
|
+
};
|
|
732
|
+
Mark.prototype.toString = function toString(compact) {
|
|
733
|
+
var snippet, where = "";
|
|
734
|
+
if (this.name) {
|
|
735
|
+
where += 'in "' + this.name + '" ';
|
|
736
|
+
}
|
|
737
|
+
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
|
738
|
+
if (!compact) {
|
|
739
|
+
snippet = this.getSnippet();
|
|
740
|
+
if (snippet) {
|
|
741
|
+
where += ":\n" + snippet;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return where;
|
|
745
|
+
};
|
|
746
|
+
module2.exports = Mark;
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type.js
|
|
751
|
+
var require_type = __commonJS({
|
|
752
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
|
753
|
+
"use strict";
|
|
754
|
+
var YAMLException = require_exception();
|
|
755
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
756
|
+
"kind",
|
|
757
|
+
"resolve",
|
|
758
|
+
"construct",
|
|
759
|
+
"instanceOf",
|
|
760
|
+
"predicate",
|
|
761
|
+
"represent",
|
|
762
|
+
"defaultStyle",
|
|
763
|
+
"styleAliases"
|
|
764
|
+
];
|
|
765
|
+
var YAML_NODE_KINDS = [
|
|
766
|
+
"scalar",
|
|
767
|
+
"sequence",
|
|
768
|
+
"mapping"
|
|
769
|
+
];
|
|
770
|
+
function compileStyleAliases(map) {
|
|
771
|
+
var result = {};
|
|
772
|
+
if (map !== null) {
|
|
773
|
+
Object.keys(map).forEach(function(style) {
|
|
774
|
+
map[style].forEach(function(alias) {
|
|
775
|
+
result[String(alias)] = style;
|
|
776
|
+
});
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
return result;
|
|
780
|
+
}
|
|
781
|
+
function Type(tag, options2) {
|
|
782
|
+
options2 = options2 || {};
|
|
783
|
+
Object.keys(options2).forEach(function(name) {
|
|
784
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
785
|
+
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
this.tag = tag;
|
|
789
|
+
this.kind = options2["kind"] || null;
|
|
790
|
+
this.resolve = options2["resolve"] || function() {
|
|
791
|
+
return true;
|
|
792
|
+
};
|
|
793
|
+
this.construct = options2["construct"] || function(data) {
|
|
794
|
+
return data;
|
|
795
|
+
};
|
|
796
|
+
this.instanceOf = options2["instanceOf"] || null;
|
|
797
|
+
this.predicate = options2["predicate"] || null;
|
|
798
|
+
this.represent = options2["represent"] || null;
|
|
799
|
+
this.defaultStyle = options2["defaultStyle"] || null;
|
|
800
|
+
this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
|
|
801
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
802
|
+
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
module2.exports = Type;
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema.js
|
|
810
|
+
var require_schema = __commonJS({
|
|
811
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
|
812
|
+
"use strict";
|
|
813
|
+
var common = require_common();
|
|
814
|
+
var YAMLException = require_exception();
|
|
815
|
+
var Type = require_type();
|
|
816
|
+
function compileList(schema, name, result) {
|
|
817
|
+
var exclude = [];
|
|
818
|
+
schema.include.forEach(function(includedSchema) {
|
|
819
|
+
result = compileList(includedSchema, name, result);
|
|
820
|
+
});
|
|
821
|
+
schema[name].forEach(function(currentType) {
|
|
822
|
+
result.forEach(function(previousType, previousIndex) {
|
|
823
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
824
|
+
exclude.push(previousIndex);
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
result.push(currentType);
|
|
828
|
+
});
|
|
829
|
+
return result.filter(function(type, index) {
|
|
830
|
+
return exclude.indexOf(index) === -1;
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function compileMap() {
|
|
834
|
+
var result = {
|
|
835
|
+
scalar: {},
|
|
836
|
+
sequence: {},
|
|
837
|
+
mapping: {},
|
|
838
|
+
fallback: {}
|
|
839
|
+
}, index, length;
|
|
840
|
+
function collectType(type) {
|
|
841
|
+
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
842
|
+
}
|
|
843
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
844
|
+
arguments[index].forEach(collectType);
|
|
845
|
+
}
|
|
846
|
+
return result;
|
|
847
|
+
}
|
|
848
|
+
function Schema(definition) {
|
|
849
|
+
this.include = definition.include || [];
|
|
850
|
+
this.implicit = definition.implicit || [];
|
|
851
|
+
this.explicit = definition.explicit || [];
|
|
852
|
+
this.implicit.forEach(function(type) {
|
|
853
|
+
if (type.loadKind && type.loadKind !== "scalar") {
|
|
854
|
+
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
this.compiledImplicit = compileList(this, "implicit", []);
|
|
858
|
+
this.compiledExplicit = compileList(this, "explicit", []);
|
|
859
|
+
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
860
|
+
}
|
|
861
|
+
Schema.DEFAULT = null;
|
|
862
|
+
Schema.create = function createSchema() {
|
|
863
|
+
var schemas, types;
|
|
864
|
+
switch (arguments.length) {
|
|
865
|
+
case 1:
|
|
866
|
+
schemas = Schema.DEFAULT;
|
|
867
|
+
types = arguments[0];
|
|
868
|
+
break;
|
|
869
|
+
case 2:
|
|
870
|
+
schemas = arguments[0];
|
|
871
|
+
types = arguments[1];
|
|
872
|
+
break;
|
|
873
|
+
default:
|
|
874
|
+
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
875
|
+
}
|
|
876
|
+
schemas = common.toArray(schemas);
|
|
877
|
+
types = common.toArray(types);
|
|
878
|
+
if (!schemas.every(function(schema) {
|
|
879
|
+
return schema instanceof Schema;
|
|
880
|
+
})) {
|
|
881
|
+
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
882
|
+
}
|
|
883
|
+
if (!types.every(function(type) {
|
|
884
|
+
return type instanceof Type;
|
|
885
|
+
})) {
|
|
886
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
887
|
+
}
|
|
888
|
+
return new Schema({
|
|
889
|
+
include: schemas,
|
|
890
|
+
explicit: types
|
|
891
|
+
});
|
|
892
|
+
};
|
|
893
|
+
module2.exports = Schema;
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/str.js
|
|
898
|
+
var require_str = __commonJS({
|
|
899
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
|
900
|
+
"use strict";
|
|
901
|
+
var Type = require_type();
|
|
902
|
+
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
903
|
+
kind: "scalar",
|
|
904
|
+
construct: function(data) {
|
|
905
|
+
return data !== null ? data : "";
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/seq.js
|
|
912
|
+
var require_seq = __commonJS({
|
|
913
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
|
914
|
+
"use strict";
|
|
915
|
+
var Type = require_type();
|
|
916
|
+
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
917
|
+
kind: "sequence",
|
|
918
|
+
construct: function(data) {
|
|
919
|
+
return data !== null ? data : [];
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/map.js
|
|
926
|
+
var require_map = __commonJS({
|
|
927
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
|
928
|
+
"use strict";
|
|
929
|
+
var Type = require_type();
|
|
930
|
+
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
931
|
+
kind: "mapping",
|
|
932
|
+
construct: function(data) {
|
|
933
|
+
return data !== null ? data : {};
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
|
940
|
+
var require_failsafe = __commonJS({
|
|
941
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
|
942
|
+
"use strict";
|
|
943
|
+
var Schema = require_schema();
|
|
944
|
+
module2.exports = new Schema({
|
|
945
|
+
explicit: [
|
|
946
|
+
require_str(),
|
|
947
|
+
require_seq(),
|
|
948
|
+
require_map()
|
|
949
|
+
]
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/null.js
|
|
955
|
+
var require_null = __commonJS({
|
|
956
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
|
957
|
+
"use strict";
|
|
958
|
+
var Type = require_type();
|
|
959
|
+
function resolveYamlNull(data) {
|
|
960
|
+
if (data === null) return true;
|
|
961
|
+
var max = data.length;
|
|
962
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
963
|
+
}
|
|
964
|
+
function constructYamlNull() {
|
|
965
|
+
return null;
|
|
966
|
+
}
|
|
967
|
+
function isNull(object) {
|
|
968
|
+
return object === null;
|
|
969
|
+
}
|
|
970
|
+
module2.exports = new Type("tag:yaml.org,2002:null", {
|
|
971
|
+
kind: "scalar",
|
|
972
|
+
resolve: resolveYamlNull,
|
|
973
|
+
construct: constructYamlNull,
|
|
974
|
+
predicate: isNull,
|
|
975
|
+
represent: {
|
|
976
|
+
canonical: function() {
|
|
977
|
+
return "~";
|
|
978
|
+
},
|
|
979
|
+
lowercase: function() {
|
|
980
|
+
return "null";
|
|
981
|
+
},
|
|
982
|
+
uppercase: function() {
|
|
983
|
+
return "NULL";
|
|
984
|
+
},
|
|
985
|
+
camelcase: function() {
|
|
986
|
+
return "Null";
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
defaultStyle: "lowercase"
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/bool.js
|
|
995
|
+
var require_bool = __commonJS({
|
|
996
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
|
997
|
+
"use strict";
|
|
998
|
+
var Type = require_type();
|
|
999
|
+
function resolveYamlBoolean(data) {
|
|
1000
|
+
if (data === null) return false;
|
|
1001
|
+
var max = data.length;
|
|
1002
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
1003
|
+
}
|
|
1004
|
+
function constructYamlBoolean(data) {
|
|
1005
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
1006
|
+
}
|
|
1007
|
+
function isBoolean(object) {
|
|
1008
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
1009
|
+
}
|
|
1010
|
+
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
|
1011
|
+
kind: "scalar",
|
|
1012
|
+
resolve: resolveYamlBoolean,
|
|
1013
|
+
construct: constructYamlBoolean,
|
|
1014
|
+
predicate: isBoolean,
|
|
1015
|
+
represent: {
|
|
1016
|
+
lowercase: function(object) {
|
|
1017
|
+
return object ? "true" : "false";
|
|
1018
|
+
},
|
|
1019
|
+
uppercase: function(object) {
|
|
1020
|
+
return object ? "TRUE" : "FALSE";
|
|
1021
|
+
},
|
|
1022
|
+
camelcase: function(object) {
|
|
1023
|
+
return object ? "True" : "False";
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
defaultStyle: "lowercase"
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/int.js
|
|
1032
|
+
var require_int = __commonJS({
|
|
1033
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
|
1034
|
+
"use strict";
|
|
1035
|
+
var common = require_common();
|
|
1036
|
+
var Type = require_type();
|
|
1037
|
+
function isHexCode(c) {
|
|
1038
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
1039
|
+
}
|
|
1040
|
+
function isOctCode(c) {
|
|
1041
|
+
return 48 <= c && c <= 55;
|
|
1042
|
+
}
|
|
1043
|
+
function isDecCode(c) {
|
|
1044
|
+
return 48 <= c && c <= 57;
|
|
1045
|
+
}
|
|
1046
|
+
function resolveYamlInteger(data) {
|
|
1047
|
+
if (data === null) return false;
|
|
1048
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
1049
|
+
if (!max) return false;
|
|
1050
|
+
ch = data[index];
|
|
1051
|
+
if (ch === "-" || ch === "+") {
|
|
1052
|
+
ch = data[++index];
|
|
1053
|
+
}
|
|
1054
|
+
if (ch === "0") {
|
|
1055
|
+
if (index + 1 === max) return true;
|
|
1056
|
+
ch = data[++index];
|
|
1057
|
+
if (ch === "b") {
|
|
1058
|
+
index++;
|
|
1059
|
+
for (; index < max; index++) {
|
|
1060
|
+
ch = data[index];
|
|
1061
|
+
if (ch === "_") continue;
|
|
1062
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
1063
|
+
hasDigits = true;
|
|
1064
|
+
}
|
|
1065
|
+
return hasDigits && ch !== "_";
|
|
1066
|
+
}
|
|
1067
|
+
if (ch === "x") {
|
|
1068
|
+
index++;
|
|
1069
|
+
for (; index < max; index++) {
|
|
1070
|
+
ch = data[index];
|
|
1071
|
+
if (ch === "_") continue;
|
|
1072
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
1073
|
+
hasDigits = true;
|
|
1074
|
+
}
|
|
1075
|
+
return hasDigits && ch !== "_";
|
|
1076
|
+
}
|
|
1077
|
+
for (; index < max; index++) {
|
|
1078
|
+
ch = data[index];
|
|
1079
|
+
if (ch === "_") continue;
|
|
1080
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
1081
|
+
hasDigits = true;
|
|
1082
|
+
}
|
|
1083
|
+
return hasDigits && ch !== "_";
|
|
1084
|
+
}
|
|
1085
|
+
if (ch === "_") return false;
|
|
1086
|
+
for (; index < max; index++) {
|
|
1087
|
+
ch = data[index];
|
|
1088
|
+
if (ch === "_") continue;
|
|
1089
|
+
if (ch === ":") break;
|
|
1090
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
1091
|
+
return false;
|
|
1092
|
+
}
|
|
1093
|
+
hasDigits = true;
|
|
1094
|
+
}
|
|
1095
|
+
if (!hasDigits || ch === "_") return false;
|
|
1096
|
+
if (ch !== ":") return true;
|
|
1097
|
+
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
1098
|
+
}
|
|
1099
|
+
function constructYamlInteger(data) {
|
|
1100
|
+
var value = data, sign = 1, ch, base, digits = [];
|
|
1101
|
+
if (value.indexOf("_") !== -1) {
|
|
1102
|
+
value = value.replace(/_/g, "");
|
|
1103
|
+
}
|
|
1104
|
+
ch = value[0];
|
|
1105
|
+
if (ch === "-" || ch === "+") {
|
|
1106
|
+
if (ch === "-") sign = -1;
|
|
1107
|
+
value = value.slice(1);
|
|
1108
|
+
ch = value[0];
|
|
1109
|
+
}
|
|
1110
|
+
if (value === "0") return 0;
|
|
1111
|
+
if (ch === "0") {
|
|
1112
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
1113
|
+
if (value[1] === "x") return sign * parseInt(value, 16);
|
|
1114
|
+
return sign * parseInt(value, 8);
|
|
1115
|
+
}
|
|
1116
|
+
if (value.indexOf(":") !== -1) {
|
|
1117
|
+
value.split(":").forEach(function(v) {
|
|
1118
|
+
digits.unshift(parseInt(v, 10));
|
|
1119
|
+
});
|
|
1120
|
+
value = 0;
|
|
1121
|
+
base = 1;
|
|
1122
|
+
digits.forEach(function(d) {
|
|
1123
|
+
value += d * base;
|
|
1124
|
+
base *= 60;
|
|
1125
|
+
});
|
|
1126
|
+
return sign * value;
|
|
1127
|
+
}
|
|
1128
|
+
return sign * parseInt(value, 10);
|
|
1129
|
+
}
|
|
1130
|
+
function isInteger(object) {
|
|
1131
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
1132
|
+
}
|
|
1133
|
+
module2.exports = new Type("tag:yaml.org,2002:int", {
|
|
1134
|
+
kind: "scalar",
|
|
1135
|
+
resolve: resolveYamlInteger,
|
|
1136
|
+
construct: constructYamlInteger,
|
|
1137
|
+
predicate: isInteger,
|
|
1138
|
+
represent: {
|
|
1139
|
+
binary: function(obj) {
|
|
1140
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
1141
|
+
},
|
|
1142
|
+
octal: function(obj) {
|
|
1143
|
+
return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
|
|
1144
|
+
},
|
|
1145
|
+
decimal: function(obj) {
|
|
1146
|
+
return obj.toString(10);
|
|
1147
|
+
},
|
|
1148
|
+
/* eslint-disable max-len */
|
|
1149
|
+
hexadecimal: function(obj) {
|
|
1150
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
defaultStyle: "decimal",
|
|
1154
|
+
styleAliases: {
|
|
1155
|
+
binary: [2, "bin"],
|
|
1156
|
+
octal: [8, "oct"],
|
|
1157
|
+
decimal: [10, "dec"],
|
|
1158
|
+
hexadecimal: [16, "hex"]
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/float.js
|
|
1165
|
+
var require_float = __commonJS({
|
|
1166
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
|
1167
|
+
"use strict";
|
|
1168
|
+
var common = require_common();
|
|
1169
|
+
var Type = require_type();
|
|
1170
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
1171
|
+
// 2.5e4, 2.5 and integers
|
|
1172
|
+
"^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
1173
|
+
);
|
|
1174
|
+
function resolveYamlFloat(data) {
|
|
1175
|
+
if (data === null) return false;
|
|
1176
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
1177
|
+
// Probably should update regexp & check speed
|
|
1178
|
+
data[data.length - 1] === "_") {
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
return true;
|
|
1182
|
+
}
|
|
1183
|
+
function constructYamlFloat(data) {
|
|
1184
|
+
var value, sign, base, digits;
|
|
1185
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
1186
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
1187
|
+
digits = [];
|
|
1188
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
1189
|
+
value = value.slice(1);
|
|
1190
|
+
}
|
|
1191
|
+
if (value === ".inf") {
|
|
1192
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
1193
|
+
} else if (value === ".nan") {
|
|
1194
|
+
return NaN;
|
|
1195
|
+
} else if (value.indexOf(":") >= 0) {
|
|
1196
|
+
value.split(":").forEach(function(v) {
|
|
1197
|
+
digits.unshift(parseFloat(v, 10));
|
|
1198
|
+
});
|
|
1199
|
+
value = 0;
|
|
1200
|
+
base = 1;
|
|
1201
|
+
digits.forEach(function(d) {
|
|
1202
|
+
value += d * base;
|
|
1203
|
+
base *= 60;
|
|
1204
|
+
});
|
|
1205
|
+
return sign * value;
|
|
1206
|
+
}
|
|
1207
|
+
return sign * parseFloat(value, 10);
|
|
1208
|
+
}
|
|
1209
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
1210
|
+
function representYamlFloat(object, style) {
|
|
1211
|
+
var res;
|
|
1212
|
+
if (isNaN(object)) {
|
|
1213
|
+
switch (style) {
|
|
1214
|
+
case "lowercase":
|
|
1215
|
+
return ".nan";
|
|
1216
|
+
case "uppercase":
|
|
1217
|
+
return ".NAN";
|
|
1218
|
+
case "camelcase":
|
|
1219
|
+
return ".NaN";
|
|
1220
|
+
}
|
|
1221
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
1222
|
+
switch (style) {
|
|
1223
|
+
case "lowercase":
|
|
1224
|
+
return ".inf";
|
|
1225
|
+
case "uppercase":
|
|
1226
|
+
return ".INF";
|
|
1227
|
+
case "camelcase":
|
|
1228
|
+
return ".Inf";
|
|
1229
|
+
}
|
|
1230
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
1231
|
+
switch (style) {
|
|
1232
|
+
case "lowercase":
|
|
1233
|
+
return "-.inf";
|
|
1234
|
+
case "uppercase":
|
|
1235
|
+
return "-.INF";
|
|
1236
|
+
case "camelcase":
|
|
1237
|
+
return "-.Inf";
|
|
1238
|
+
}
|
|
1239
|
+
} else if (common.isNegativeZero(object)) {
|
|
1240
|
+
return "-0.0";
|
|
1241
|
+
}
|
|
1242
|
+
res = object.toString(10);
|
|
1243
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
1244
|
+
}
|
|
1245
|
+
function isFloat(object) {
|
|
1246
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
1247
|
+
}
|
|
1248
|
+
module2.exports = new Type("tag:yaml.org,2002:float", {
|
|
1249
|
+
kind: "scalar",
|
|
1250
|
+
resolve: resolveYamlFloat,
|
|
1251
|
+
construct: constructYamlFloat,
|
|
1252
|
+
predicate: isFloat,
|
|
1253
|
+
represent: representYamlFloat,
|
|
1254
|
+
defaultStyle: "lowercase"
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/json.js
|
|
1260
|
+
var require_json = __commonJS({
|
|
1261
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
|
1262
|
+
"use strict";
|
|
1263
|
+
var Schema = require_schema();
|
|
1264
|
+
module2.exports = new Schema({
|
|
1265
|
+
include: [
|
|
1266
|
+
require_failsafe()
|
|
1267
|
+
],
|
|
1268
|
+
implicit: [
|
|
1269
|
+
require_null(),
|
|
1270
|
+
require_bool(),
|
|
1271
|
+
require_int(),
|
|
1272
|
+
require_float()
|
|
1273
|
+
]
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/core.js
|
|
1279
|
+
var require_core = __commonJS({
|
|
1280
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
|
1281
|
+
"use strict";
|
|
1282
|
+
var Schema = require_schema();
|
|
1283
|
+
module2.exports = new Schema({
|
|
1284
|
+
include: [
|
|
1285
|
+
require_json()
|
|
1286
|
+
]
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
|
1292
|
+
var require_timestamp = __commonJS({
|
|
1293
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
|
1294
|
+
"use strict";
|
|
1295
|
+
var Type = require_type();
|
|
1296
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
1297
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
1298
|
+
);
|
|
1299
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
1300
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
1301
|
+
);
|
|
1302
|
+
function resolveYamlTimestamp(data) {
|
|
1303
|
+
if (data === null) return false;
|
|
1304
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
1305
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
1306
|
+
return false;
|
|
1307
|
+
}
|
|
1308
|
+
function constructYamlTimestamp(data) {
|
|
1309
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
1310
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
1311
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
1312
|
+
if (match === null) throw new Error("Date resolve error");
|
|
1313
|
+
year = +match[1];
|
|
1314
|
+
month = +match[2] - 1;
|
|
1315
|
+
day = +match[3];
|
|
1316
|
+
if (!match[4]) {
|
|
1317
|
+
return new Date(Date.UTC(year, month, day));
|
|
1318
|
+
}
|
|
1319
|
+
hour = +match[4];
|
|
1320
|
+
minute = +match[5];
|
|
1321
|
+
second = +match[6];
|
|
1322
|
+
if (match[7]) {
|
|
1323
|
+
fraction = match[7].slice(0, 3);
|
|
1324
|
+
while (fraction.length < 3) {
|
|
1325
|
+
fraction += "0";
|
|
1326
|
+
}
|
|
1327
|
+
fraction = +fraction;
|
|
1328
|
+
}
|
|
1329
|
+
if (match[9]) {
|
|
1330
|
+
tz_hour = +match[10];
|
|
1331
|
+
tz_minute = +(match[11] || 0);
|
|
1332
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
1333
|
+
if (match[9] === "-") delta = -delta;
|
|
1334
|
+
}
|
|
1335
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
1336
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
1337
|
+
return date;
|
|
1338
|
+
}
|
|
1339
|
+
function representYamlTimestamp(object) {
|
|
1340
|
+
return object.toISOString();
|
|
1341
|
+
}
|
|
1342
|
+
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
1343
|
+
kind: "scalar",
|
|
1344
|
+
resolve: resolveYamlTimestamp,
|
|
1345
|
+
construct: constructYamlTimestamp,
|
|
1346
|
+
instanceOf: Date,
|
|
1347
|
+
represent: representYamlTimestamp
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/merge.js
|
|
1353
|
+
var require_merge = __commonJS({
|
|
1354
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
|
1355
|
+
"use strict";
|
|
1356
|
+
var Type = require_type();
|
|
1357
|
+
function resolveYamlMerge(data) {
|
|
1358
|
+
return data === "<<" || data === null;
|
|
1359
|
+
}
|
|
1360
|
+
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
|
1361
|
+
kind: "scalar",
|
|
1362
|
+
resolve: resolveYamlMerge
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
|
1368
|
+
var require_binary = __commonJS({
|
|
1369
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
|
1370
|
+
"use strict";
|
|
1371
|
+
var NodeBuffer;
|
|
1372
|
+
try {
|
|
1373
|
+
_require = require;
|
|
1374
|
+
NodeBuffer = _require("buffer").Buffer;
|
|
1375
|
+
} catch (__) {
|
|
1376
|
+
}
|
|
1377
|
+
var _require;
|
|
1378
|
+
var Type = require_type();
|
|
1379
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1380
|
+
function resolveYamlBinary(data) {
|
|
1381
|
+
if (data === null) return false;
|
|
1382
|
+
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
1383
|
+
for (idx = 0; idx < max; idx++) {
|
|
1384
|
+
code = map.indexOf(data.charAt(idx));
|
|
1385
|
+
if (code > 64) continue;
|
|
1386
|
+
if (code < 0) return false;
|
|
1387
|
+
bitlen += 6;
|
|
1388
|
+
}
|
|
1389
|
+
return bitlen % 8 === 0;
|
|
1390
|
+
}
|
|
1391
|
+
function constructYamlBinary(data) {
|
|
1392
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
|
1393
|
+
for (idx = 0; idx < max; idx++) {
|
|
1394
|
+
if (idx % 4 === 0 && idx) {
|
|
1395
|
+
result.push(bits >> 16 & 255);
|
|
1396
|
+
result.push(bits >> 8 & 255);
|
|
1397
|
+
result.push(bits & 255);
|
|
1398
|
+
}
|
|
1399
|
+
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
1400
|
+
}
|
|
1401
|
+
tailbits = max % 4 * 6;
|
|
1402
|
+
if (tailbits === 0) {
|
|
1403
|
+
result.push(bits >> 16 & 255);
|
|
1404
|
+
result.push(bits >> 8 & 255);
|
|
1405
|
+
result.push(bits & 255);
|
|
1406
|
+
} else if (tailbits === 18) {
|
|
1407
|
+
result.push(bits >> 10 & 255);
|
|
1408
|
+
result.push(bits >> 2 & 255);
|
|
1409
|
+
} else if (tailbits === 12) {
|
|
1410
|
+
result.push(bits >> 4 & 255);
|
|
1411
|
+
}
|
|
1412
|
+
if (NodeBuffer) {
|
|
1413
|
+
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
|
1414
|
+
}
|
|
1415
|
+
return result;
|
|
1416
|
+
}
|
|
1417
|
+
function representYamlBinary(object) {
|
|
1418
|
+
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
|
1419
|
+
for (idx = 0; idx < max; idx++) {
|
|
1420
|
+
if (idx % 3 === 0 && idx) {
|
|
1421
|
+
result += map[bits >> 18 & 63];
|
|
1422
|
+
result += map[bits >> 12 & 63];
|
|
1423
|
+
result += map[bits >> 6 & 63];
|
|
1424
|
+
result += map[bits & 63];
|
|
1425
|
+
}
|
|
1426
|
+
bits = (bits << 8) + object[idx];
|
|
1427
|
+
}
|
|
1428
|
+
tail = max % 3;
|
|
1429
|
+
if (tail === 0) {
|
|
1430
|
+
result += map[bits >> 18 & 63];
|
|
1431
|
+
result += map[bits >> 12 & 63];
|
|
1432
|
+
result += map[bits >> 6 & 63];
|
|
1433
|
+
result += map[bits & 63];
|
|
1434
|
+
} else if (tail === 2) {
|
|
1435
|
+
result += map[bits >> 10 & 63];
|
|
1436
|
+
result += map[bits >> 4 & 63];
|
|
1437
|
+
result += map[bits << 2 & 63];
|
|
1438
|
+
result += map[64];
|
|
1439
|
+
} else if (tail === 1) {
|
|
1440
|
+
result += map[bits >> 2 & 63];
|
|
1441
|
+
result += map[bits << 4 & 63];
|
|
1442
|
+
result += map[64];
|
|
1443
|
+
result += map[64];
|
|
1444
|
+
}
|
|
1445
|
+
return result;
|
|
1446
|
+
}
|
|
1447
|
+
function isBinary(object) {
|
|
1448
|
+
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
1449
|
+
}
|
|
1450
|
+
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
|
1451
|
+
kind: "scalar",
|
|
1452
|
+
resolve: resolveYamlBinary,
|
|
1453
|
+
construct: constructYamlBinary,
|
|
1454
|
+
predicate: isBinary,
|
|
1455
|
+
represent: representYamlBinary
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/omap.js
|
|
1461
|
+
var require_omap = __commonJS({
|
|
1462
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
|
1463
|
+
"use strict";
|
|
1464
|
+
var Type = require_type();
|
|
1465
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1466
|
+
var _toString = Object.prototype.toString;
|
|
1467
|
+
function resolveYamlOmap(data) {
|
|
1468
|
+
if (data === null) return true;
|
|
1469
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
1470
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1471
|
+
pair = object[index];
|
|
1472
|
+
pairHasKey = false;
|
|
1473
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1474
|
+
for (pairKey in pair) {
|
|
1475
|
+
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
1476
|
+
if (!pairHasKey) pairHasKey = true;
|
|
1477
|
+
else return false;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
if (!pairHasKey) return false;
|
|
1481
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
1482
|
+
else return false;
|
|
1483
|
+
}
|
|
1484
|
+
return true;
|
|
1485
|
+
}
|
|
1486
|
+
function constructYamlOmap(data) {
|
|
1487
|
+
return data !== null ? data : [];
|
|
1488
|
+
}
|
|
1489
|
+
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
|
1490
|
+
kind: "sequence",
|
|
1491
|
+
resolve: resolveYamlOmap,
|
|
1492
|
+
construct: constructYamlOmap
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
|
|
1497
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
|
1498
|
+
var require_pairs = __commonJS({
|
|
1499
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
|
1500
|
+
"use strict";
|
|
1501
|
+
var Type = require_type();
|
|
1502
|
+
var _toString = Object.prototype.toString;
|
|
1503
|
+
function resolveYamlPairs(data) {
|
|
1504
|
+
if (data === null) return true;
|
|
1505
|
+
var index, length, pair, keys, result, object = data;
|
|
1506
|
+
result = new Array(object.length);
|
|
1507
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1508
|
+
pair = object[index];
|
|
1509
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1510
|
+
keys = Object.keys(pair);
|
|
1511
|
+
if (keys.length !== 1) return false;
|
|
1512
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1513
|
+
}
|
|
1514
|
+
return true;
|
|
1515
|
+
}
|
|
1516
|
+
function constructYamlPairs(data) {
|
|
1517
|
+
if (data === null) return [];
|
|
1518
|
+
var index, length, pair, keys, result, object = data;
|
|
1519
|
+
result = new Array(object.length);
|
|
1520
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1521
|
+
pair = object[index];
|
|
1522
|
+
keys = Object.keys(pair);
|
|
1523
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1524
|
+
}
|
|
1525
|
+
return result;
|
|
1526
|
+
}
|
|
1527
|
+
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
1528
|
+
kind: "sequence",
|
|
1529
|
+
resolve: resolveYamlPairs,
|
|
1530
|
+
construct: constructYamlPairs
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
|
|
1535
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/set.js
|
|
1536
|
+
var require_set = __commonJS({
|
|
1537
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
|
1538
|
+
"use strict";
|
|
1539
|
+
var Type = require_type();
|
|
1540
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1541
|
+
function resolveYamlSet(data) {
|
|
1542
|
+
if (data === null) return true;
|
|
1543
|
+
var key, object = data;
|
|
1544
|
+
for (key in object) {
|
|
1545
|
+
if (_hasOwnProperty.call(object, key)) {
|
|
1546
|
+
if (object[key] !== null) return false;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return true;
|
|
1550
|
+
}
|
|
1551
|
+
function constructYamlSet(data) {
|
|
1552
|
+
return data !== null ? data : {};
|
|
1553
|
+
}
|
|
1554
|
+
module2.exports = new Type("tag:yaml.org,2002:set", {
|
|
1555
|
+
kind: "mapping",
|
|
1556
|
+
resolve: resolveYamlSet,
|
|
1557
|
+
construct: constructYamlSet
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
|
|
1562
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
|
1563
|
+
var require_default_safe = __commonJS({
|
|
1564
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
|
1565
|
+
"use strict";
|
|
1566
|
+
var Schema = require_schema();
|
|
1567
|
+
module2.exports = new Schema({
|
|
1568
|
+
include: [
|
|
1569
|
+
require_core()
|
|
1570
|
+
],
|
|
1571
|
+
implicit: [
|
|
1572
|
+
require_timestamp(),
|
|
1573
|
+
require_merge()
|
|
1574
|
+
],
|
|
1575
|
+
explicit: [
|
|
1576
|
+
require_binary(),
|
|
1577
|
+
require_omap(),
|
|
1578
|
+
require_pairs(),
|
|
1579
|
+
require_set()
|
|
1580
|
+
]
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
|
|
1585
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
|
1586
|
+
var require_undefined = __commonJS({
|
|
1587
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
|
1588
|
+
"use strict";
|
|
1589
|
+
var Type = require_type();
|
|
1590
|
+
function resolveJavascriptUndefined() {
|
|
1591
|
+
return true;
|
|
1592
|
+
}
|
|
1593
|
+
function constructJavascriptUndefined() {
|
|
1594
|
+
return void 0;
|
|
1595
|
+
}
|
|
1596
|
+
function representJavascriptUndefined() {
|
|
1597
|
+
return "";
|
|
1598
|
+
}
|
|
1599
|
+
function isUndefined(object) {
|
|
1600
|
+
return typeof object === "undefined";
|
|
1601
|
+
}
|
|
1602
|
+
module2.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
|
1603
|
+
kind: "scalar",
|
|
1604
|
+
resolve: resolveJavascriptUndefined,
|
|
1605
|
+
construct: constructJavascriptUndefined,
|
|
1606
|
+
predicate: isUndefined,
|
|
1607
|
+
represent: representJavascriptUndefined
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
|
1613
|
+
var require_regexp = __commonJS({
|
|
1614
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
|
1615
|
+
"use strict";
|
|
1616
|
+
var Type = require_type();
|
|
1617
|
+
function resolveJavascriptRegExp(data) {
|
|
1618
|
+
if (data === null) return false;
|
|
1619
|
+
if (data.length === 0) return false;
|
|
1620
|
+
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1621
|
+
if (regexp[0] === "/") {
|
|
1622
|
+
if (tail) modifiers = tail[1];
|
|
1623
|
+
if (modifiers.length > 3) return false;
|
|
1624
|
+
if (regexp[regexp.length - modifiers.length - 1] !== "/") return false;
|
|
1625
|
+
}
|
|
1626
|
+
return true;
|
|
1627
|
+
}
|
|
1628
|
+
function constructJavascriptRegExp(data) {
|
|
1629
|
+
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1630
|
+
if (regexp[0] === "/") {
|
|
1631
|
+
if (tail) modifiers = tail[1];
|
|
1632
|
+
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
1633
|
+
}
|
|
1634
|
+
return new RegExp(regexp, modifiers);
|
|
1635
|
+
}
|
|
1636
|
+
function representJavascriptRegExp(object) {
|
|
1637
|
+
var result = "/" + object.source + "/";
|
|
1638
|
+
if (object.global) result += "g";
|
|
1639
|
+
if (object.multiline) result += "m";
|
|
1640
|
+
if (object.ignoreCase) result += "i";
|
|
1641
|
+
return result;
|
|
1642
|
+
}
|
|
1643
|
+
function isRegExp(object) {
|
|
1644
|
+
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
1645
|
+
}
|
|
1646
|
+
module2.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
|
1647
|
+
kind: "scalar",
|
|
1648
|
+
resolve: resolveJavascriptRegExp,
|
|
1649
|
+
construct: constructJavascriptRegExp,
|
|
1650
|
+
predicate: isRegExp,
|
|
1651
|
+
represent: representJavascriptRegExp
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
|
|
1656
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
|
1657
|
+
var require_function = __commonJS({
|
|
1658
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
|
1659
|
+
"use strict";
|
|
1660
|
+
var esprima;
|
|
1661
|
+
try {
|
|
1662
|
+
_require = require;
|
|
1663
|
+
esprima = _require("esprima");
|
|
1664
|
+
} catch (_) {
|
|
1665
|
+
if (typeof window !== "undefined") esprima = window.esprima;
|
|
1666
|
+
}
|
|
1667
|
+
var _require;
|
|
1668
|
+
var Type = require_type();
|
|
1669
|
+
function resolveJavascriptFunction(data) {
|
|
1670
|
+
if (data === null) return false;
|
|
1671
|
+
try {
|
|
1672
|
+
var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
|
|
1673
|
+
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
return true;
|
|
1677
|
+
} catch (err) {
|
|
1678
|
+
return false;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
function constructJavascriptFunction(data) {
|
|
1682
|
+
var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
|
|
1683
|
+
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
1684
|
+
throw new Error("Failed to resolve function");
|
|
1685
|
+
}
|
|
1686
|
+
ast.body[0].expression.params.forEach(function(param) {
|
|
1687
|
+
params.push(param.name);
|
|
1688
|
+
});
|
|
1689
|
+
body = ast.body[0].expression.body.range;
|
|
1690
|
+
if (ast.body[0].expression.body.type === "BlockStatement") {
|
|
1691
|
+
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
|
1692
|
+
}
|
|
1693
|
+
return new Function(params, "return " + source.slice(body[0], body[1]));
|
|
1694
|
+
}
|
|
1695
|
+
function representJavascriptFunction(object) {
|
|
1696
|
+
return object.toString();
|
|
1697
|
+
}
|
|
1698
|
+
function isFunction(object) {
|
|
1699
|
+
return Object.prototype.toString.call(object) === "[object Function]";
|
|
1700
|
+
}
|
|
1701
|
+
module2.exports = new Type("tag:yaml.org,2002:js/function", {
|
|
1702
|
+
kind: "scalar",
|
|
1703
|
+
resolve: resolveJavascriptFunction,
|
|
1704
|
+
construct: constructJavascriptFunction,
|
|
1705
|
+
predicate: isFunction,
|
|
1706
|
+
represent: representJavascriptFunction
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
|
1712
|
+
var require_default_full = __commonJS({
|
|
1713
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
|
1714
|
+
"use strict";
|
|
1715
|
+
var Schema = require_schema();
|
|
1716
|
+
module2.exports = Schema.DEFAULT = new Schema({
|
|
1717
|
+
include: [
|
|
1718
|
+
require_default_safe()
|
|
1719
|
+
],
|
|
1720
|
+
explicit: [
|
|
1721
|
+
require_undefined(),
|
|
1722
|
+
require_regexp(),
|
|
1723
|
+
require_function()
|
|
1724
|
+
]
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/loader.js
|
|
1730
|
+
var require_loader = __commonJS({
|
|
1731
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
|
1732
|
+
"use strict";
|
|
1733
|
+
var common = require_common();
|
|
1734
|
+
var YAMLException = require_exception();
|
|
1735
|
+
var Mark = require_mark();
|
|
1736
|
+
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
1737
|
+
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
1738
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1739
|
+
var CONTEXT_FLOW_IN = 1;
|
|
1740
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
1741
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
1742
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
1743
|
+
var CHOMPING_CLIP = 1;
|
|
1744
|
+
var CHOMPING_STRIP = 2;
|
|
1745
|
+
var CHOMPING_KEEP = 3;
|
|
1746
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1747
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1748
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
1749
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
1750
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1751
|
+
function _class(obj) {
|
|
1752
|
+
return Object.prototype.toString.call(obj);
|
|
1753
|
+
}
|
|
1754
|
+
function is_EOL(c) {
|
|
1755
|
+
return c === 10 || c === 13;
|
|
1756
|
+
}
|
|
1757
|
+
function is_WHITE_SPACE(c) {
|
|
1758
|
+
return c === 9 || c === 32;
|
|
1759
|
+
}
|
|
1760
|
+
function is_WS_OR_EOL(c) {
|
|
1761
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1762
|
+
}
|
|
1763
|
+
function is_FLOW_INDICATOR(c) {
|
|
1764
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1765
|
+
}
|
|
1766
|
+
function fromHexCode(c) {
|
|
1767
|
+
var lc;
|
|
1768
|
+
if (48 <= c && c <= 57) {
|
|
1769
|
+
return c - 48;
|
|
1770
|
+
}
|
|
1771
|
+
lc = c | 32;
|
|
1772
|
+
if (97 <= lc && lc <= 102) {
|
|
1773
|
+
return lc - 97 + 10;
|
|
1774
|
+
}
|
|
1775
|
+
return -1;
|
|
1776
|
+
}
|
|
1777
|
+
function escapedHexLen(c) {
|
|
1778
|
+
if (c === 120) {
|
|
1779
|
+
return 2;
|
|
1780
|
+
}
|
|
1781
|
+
if (c === 117) {
|
|
1782
|
+
return 4;
|
|
1783
|
+
}
|
|
1784
|
+
if (c === 85) {
|
|
1785
|
+
return 8;
|
|
1786
|
+
}
|
|
1787
|
+
return 0;
|
|
1788
|
+
}
|
|
1789
|
+
function fromDecimalCode(c) {
|
|
1790
|
+
if (48 <= c && c <= 57) {
|
|
1791
|
+
return c - 48;
|
|
1792
|
+
}
|
|
1793
|
+
return -1;
|
|
1794
|
+
}
|
|
1795
|
+
function simpleEscapeSequence(c) {
|
|
1796
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1797
|
+
}
|
|
1798
|
+
function charFromCodepoint(c) {
|
|
1799
|
+
if (c <= 65535) {
|
|
1800
|
+
return String.fromCharCode(c);
|
|
1801
|
+
}
|
|
1802
|
+
return String.fromCharCode(
|
|
1803
|
+
(c - 65536 >> 10) + 55296,
|
|
1804
|
+
(c - 65536 & 1023) + 56320
|
|
1805
|
+
);
|
|
1806
|
+
}
|
|
1807
|
+
function setProperty(object, key, value) {
|
|
1808
|
+
if (key === "__proto__") {
|
|
1809
|
+
Object.defineProperty(object, key, {
|
|
1810
|
+
configurable: true,
|
|
1811
|
+
enumerable: true,
|
|
1812
|
+
writable: true,
|
|
1813
|
+
value
|
|
1814
|
+
});
|
|
1815
|
+
} else {
|
|
1816
|
+
object[key] = value;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
var simpleEscapeCheck = new Array(256);
|
|
1820
|
+
var simpleEscapeMap = new Array(256);
|
|
1821
|
+
for (i = 0; i < 256; i++) {
|
|
1822
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1823
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1824
|
+
}
|
|
1825
|
+
var i;
|
|
1826
|
+
function State(input, options2) {
|
|
1827
|
+
this.input = input;
|
|
1828
|
+
this.filename = options2["filename"] || null;
|
|
1829
|
+
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
1830
|
+
this.onWarning = options2["onWarning"] || null;
|
|
1831
|
+
this.legacy = options2["legacy"] || false;
|
|
1832
|
+
this.json = options2["json"] || false;
|
|
1833
|
+
this.listener = options2["listener"] || null;
|
|
1834
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
1835
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
1836
|
+
this.length = input.length;
|
|
1837
|
+
this.position = 0;
|
|
1838
|
+
this.line = 0;
|
|
1839
|
+
this.lineStart = 0;
|
|
1840
|
+
this.lineIndent = 0;
|
|
1841
|
+
this.documents = [];
|
|
1842
|
+
}
|
|
1843
|
+
function generateError(state, message) {
|
|
1844
|
+
return new YAMLException(
|
|
1845
|
+
message,
|
|
1846
|
+
new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)
|
|
1847
|
+
);
|
|
1848
|
+
}
|
|
1849
|
+
function throwError(state, message) {
|
|
1850
|
+
throw generateError(state, message);
|
|
1851
|
+
}
|
|
1852
|
+
function throwWarning(state, message) {
|
|
1853
|
+
if (state.onWarning) {
|
|
1854
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
var directiveHandlers = {
|
|
1858
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1859
|
+
var match, major, minor;
|
|
1860
|
+
if (state.version !== null) {
|
|
1861
|
+
throwError(state, "duplication of %YAML directive");
|
|
1862
|
+
}
|
|
1863
|
+
if (args.length !== 1) {
|
|
1864
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1865
|
+
}
|
|
1866
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1867
|
+
if (match === null) {
|
|
1868
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1869
|
+
}
|
|
1870
|
+
major = parseInt(match[1], 10);
|
|
1871
|
+
minor = parseInt(match[2], 10);
|
|
1872
|
+
if (major !== 1) {
|
|
1873
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1874
|
+
}
|
|
1875
|
+
state.version = args[0];
|
|
1876
|
+
state.checkLineBreaks = minor < 2;
|
|
1877
|
+
if (minor !== 1 && minor !== 2) {
|
|
1878
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1879
|
+
}
|
|
1880
|
+
},
|
|
1881
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1882
|
+
var handle, prefix;
|
|
1883
|
+
if (args.length !== 2) {
|
|
1884
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1885
|
+
}
|
|
1886
|
+
handle = args[0];
|
|
1887
|
+
prefix = args[1];
|
|
1888
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1889
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1890
|
+
}
|
|
1891
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1892
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1893
|
+
}
|
|
1894
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1895
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1896
|
+
}
|
|
1897
|
+
state.tagMap[handle] = prefix;
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1901
|
+
var _position, _length, _character, _result;
|
|
1902
|
+
if (start < end) {
|
|
1903
|
+
_result = state.input.slice(start, end);
|
|
1904
|
+
if (checkJson) {
|
|
1905
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1906
|
+
_character = _result.charCodeAt(_position);
|
|
1907
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1908
|
+
throwError(state, "expected valid JSON character");
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1912
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1913
|
+
}
|
|
1914
|
+
state.result += _result;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1918
|
+
var sourceKeys, key, index, quantity;
|
|
1919
|
+
if (!common.isObject(source)) {
|
|
1920
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1921
|
+
}
|
|
1922
|
+
sourceKeys = Object.keys(source);
|
|
1923
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1924
|
+
key = sourceKeys[index];
|
|
1925
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
1926
|
+
setProperty(destination, key, source[key]);
|
|
1927
|
+
overridableKeys[key] = true;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
|
1932
|
+
var index, quantity;
|
|
1933
|
+
if (Array.isArray(keyNode)) {
|
|
1934
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1935
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1936
|
+
if (Array.isArray(keyNode[index])) {
|
|
1937
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1938
|
+
}
|
|
1939
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1940
|
+
keyNode[index] = "[object Object]";
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1945
|
+
keyNode = "[object Object]";
|
|
1946
|
+
}
|
|
1947
|
+
keyNode = String(keyNode);
|
|
1948
|
+
if (_result === null) {
|
|
1949
|
+
_result = {};
|
|
1950
|
+
}
|
|
1951
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1952
|
+
if (Array.isArray(valueNode)) {
|
|
1953
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1954
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1955
|
+
}
|
|
1956
|
+
} else {
|
|
1957
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1958
|
+
}
|
|
1959
|
+
} else {
|
|
1960
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1961
|
+
state.line = startLine || state.line;
|
|
1962
|
+
state.position = startPos || state.position;
|
|
1963
|
+
throwError(state, "duplicated mapping key");
|
|
1964
|
+
}
|
|
1965
|
+
setProperty(_result, keyNode, valueNode);
|
|
1966
|
+
delete overridableKeys[keyNode];
|
|
1967
|
+
}
|
|
1968
|
+
return _result;
|
|
1969
|
+
}
|
|
1970
|
+
function readLineBreak(state) {
|
|
1971
|
+
var ch;
|
|
1972
|
+
ch = state.input.charCodeAt(state.position);
|
|
1973
|
+
if (ch === 10) {
|
|
1974
|
+
state.position++;
|
|
1975
|
+
} else if (ch === 13) {
|
|
1976
|
+
state.position++;
|
|
1977
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1978
|
+
state.position++;
|
|
1979
|
+
}
|
|
1980
|
+
} else {
|
|
1981
|
+
throwError(state, "a line break is expected");
|
|
1982
|
+
}
|
|
1983
|
+
state.line += 1;
|
|
1984
|
+
state.lineStart = state.position;
|
|
1985
|
+
}
|
|
1986
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1987
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1988
|
+
while (ch !== 0) {
|
|
1989
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1990
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1991
|
+
}
|
|
1992
|
+
if (allowComments && ch === 35) {
|
|
1993
|
+
do {
|
|
1994
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1995
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1996
|
+
}
|
|
1997
|
+
if (is_EOL(ch)) {
|
|
1998
|
+
readLineBreak(state);
|
|
1999
|
+
ch = state.input.charCodeAt(state.position);
|
|
2000
|
+
lineBreaks++;
|
|
2001
|
+
state.lineIndent = 0;
|
|
2002
|
+
while (ch === 32) {
|
|
2003
|
+
state.lineIndent++;
|
|
2004
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2005
|
+
}
|
|
2006
|
+
} else {
|
|
2007
|
+
break;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
2011
|
+
throwWarning(state, "deficient indentation");
|
|
2012
|
+
}
|
|
2013
|
+
return lineBreaks;
|
|
2014
|
+
}
|
|
2015
|
+
function testDocumentSeparator(state) {
|
|
2016
|
+
var _position = state.position, ch;
|
|
2017
|
+
ch = state.input.charCodeAt(_position);
|
|
2018
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
2019
|
+
_position += 3;
|
|
2020
|
+
ch = state.input.charCodeAt(_position);
|
|
2021
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
2022
|
+
return true;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return false;
|
|
2026
|
+
}
|
|
2027
|
+
function writeFoldedLines(state, count) {
|
|
2028
|
+
if (count === 1) {
|
|
2029
|
+
state.result += " ";
|
|
2030
|
+
} else if (count > 1) {
|
|
2031
|
+
state.result += common.repeat("\n", count - 1);
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
2035
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
2036
|
+
ch = state.input.charCodeAt(state.position);
|
|
2037
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
2038
|
+
return false;
|
|
2039
|
+
}
|
|
2040
|
+
if (ch === 63 || ch === 45) {
|
|
2041
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2042
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2043
|
+
return false;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
state.kind = "scalar";
|
|
2047
|
+
state.result = "";
|
|
2048
|
+
captureStart = captureEnd = state.position;
|
|
2049
|
+
hasPendingContent = false;
|
|
2050
|
+
while (ch !== 0) {
|
|
2051
|
+
if (ch === 58) {
|
|
2052
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2053
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
} else if (ch === 35) {
|
|
2057
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
2058
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
2062
|
+
break;
|
|
2063
|
+
} else if (is_EOL(ch)) {
|
|
2064
|
+
_line = state.line;
|
|
2065
|
+
_lineStart = state.lineStart;
|
|
2066
|
+
_lineIndent = state.lineIndent;
|
|
2067
|
+
skipSeparationSpace(state, false, -1);
|
|
2068
|
+
if (state.lineIndent >= nodeIndent) {
|
|
2069
|
+
hasPendingContent = true;
|
|
2070
|
+
ch = state.input.charCodeAt(state.position);
|
|
2071
|
+
continue;
|
|
2072
|
+
} else {
|
|
2073
|
+
state.position = captureEnd;
|
|
2074
|
+
state.line = _line;
|
|
2075
|
+
state.lineStart = _lineStart;
|
|
2076
|
+
state.lineIndent = _lineIndent;
|
|
2077
|
+
break;
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
if (hasPendingContent) {
|
|
2081
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2082
|
+
writeFoldedLines(state, state.line - _line);
|
|
2083
|
+
captureStart = captureEnd = state.position;
|
|
2084
|
+
hasPendingContent = false;
|
|
2085
|
+
}
|
|
2086
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
2087
|
+
captureEnd = state.position + 1;
|
|
2088
|
+
}
|
|
2089
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2090
|
+
}
|
|
2091
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2092
|
+
if (state.result) {
|
|
2093
|
+
return true;
|
|
2094
|
+
}
|
|
2095
|
+
state.kind = _kind;
|
|
2096
|
+
state.result = _result;
|
|
2097
|
+
return false;
|
|
2098
|
+
}
|
|
2099
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
2100
|
+
var ch, captureStart, captureEnd;
|
|
2101
|
+
ch = state.input.charCodeAt(state.position);
|
|
2102
|
+
if (ch !== 39) {
|
|
2103
|
+
return false;
|
|
2104
|
+
}
|
|
2105
|
+
state.kind = "scalar";
|
|
2106
|
+
state.result = "";
|
|
2107
|
+
state.position++;
|
|
2108
|
+
captureStart = captureEnd = state.position;
|
|
2109
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2110
|
+
if (ch === 39) {
|
|
2111
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2112
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2113
|
+
if (ch === 39) {
|
|
2114
|
+
captureStart = state.position;
|
|
2115
|
+
state.position++;
|
|
2116
|
+
captureEnd = state.position;
|
|
2117
|
+
} else {
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
} else if (is_EOL(ch)) {
|
|
2121
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2122
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2123
|
+
captureStart = captureEnd = state.position;
|
|
2124
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2125
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
2126
|
+
} else {
|
|
2127
|
+
state.position++;
|
|
2128
|
+
captureEnd = state.position;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
2132
|
+
}
|
|
2133
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
2134
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
2135
|
+
ch = state.input.charCodeAt(state.position);
|
|
2136
|
+
if (ch !== 34) {
|
|
2137
|
+
return false;
|
|
2138
|
+
}
|
|
2139
|
+
state.kind = "scalar";
|
|
2140
|
+
state.result = "";
|
|
2141
|
+
state.position++;
|
|
2142
|
+
captureStart = captureEnd = state.position;
|
|
2143
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2144
|
+
if (ch === 34) {
|
|
2145
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2146
|
+
state.position++;
|
|
2147
|
+
return true;
|
|
2148
|
+
} else if (ch === 92) {
|
|
2149
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2150
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2151
|
+
if (is_EOL(ch)) {
|
|
2152
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
2153
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
2154
|
+
state.result += simpleEscapeMap[ch];
|
|
2155
|
+
state.position++;
|
|
2156
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
2157
|
+
hexLength = tmp;
|
|
2158
|
+
hexResult = 0;
|
|
2159
|
+
for (; hexLength > 0; hexLength--) {
|
|
2160
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2161
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
2162
|
+
hexResult = (hexResult << 4) + tmp;
|
|
2163
|
+
} else {
|
|
2164
|
+
throwError(state, "expected hexadecimal character");
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
state.result += charFromCodepoint(hexResult);
|
|
2168
|
+
state.position++;
|
|
2169
|
+
} else {
|
|
2170
|
+
throwError(state, "unknown escape sequence");
|
|
2171
|
+
}
|
|
2172
|
+
captureStart = captureEnd = state.position;
|
|
2173
|
+
} else if (is_EOL(ch)) {
|
|
2174
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2175
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2176
|
+
captureStart = captureEnd = state.position;
|
|
2177
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2178
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
2179
|
+
} else {
|
|
2180
|
+
state.position++;
|
|
2181
|
+
captureEnd = state.position;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
2185
|
+
}
|
|
2186
|
+
function readFlowCollection(state, nodeIndent) {
|
|
2187
|
+
var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
|
|
2188
|
+
ch = state.input.charCodeAt(state.position);
|
|
2189
|
+
if (ch === 91) {
|
|
2190
|
+
terminator = 93;
|
|
2191
|
+
isMapping = false;
|
|
2192
|
+
_result = [];
|
|
2193
|
+
} else if (ch === 123) {
|
|
2194
|
+
terminator = 125;
|
|
2195
|
+
isMapping = true;
|
|
2196
|
+
_result = {};
|
|
2197
|
+
} else {
|
|
2198
|
+
return false;
|
|
2199
|
+
}
|
|
2200
|
+
if (state.anchor !== null) {
|
|
2201
|
+
state.anchorMap[state.anchor] = _result;
|
|
2202
|
+
}
|
|
2203
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2204
|
+
while (ch !== 0) {
|
|
2205
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2206
|
+
ch = state.input.charCodeAt(state.position);
|
|
2207
|
+
if (ch === terminator) {
|
|
2208
|
+
state.position++;
|
|
2209
|
+
state.tag = _tag;
|
|
2210
|
+
state.anchor = _anchor;
|
|
2211
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
2212
|
+
state.result = _result;
|
|
2213
|
+
return true;
|
|
2214
|
+
} else if (!readNext) {
|
|
2215
|
+
throwError(state, "missed comma between flow collection entries");
|
|
2216
|
+
}
|
|
2217
|
+
keyTag = keyNode = valueNode = null;
|
|
2218
|
+
isPair = isExplicitPair = false;
|
|
2219
|
+
if (ch === 63) {
|
|
2220
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2221
|
+
if (is_WS_OR_EOL(following)) {
|
|
2222
|
+
isPair = isExplicitPair = true;
|
|
2223
|
+
state.position++;
|
|
2224
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
_line = state.line;
|
|
2228
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2229
|
+
keyTag = state.tag;
|
|
2230
|
+
keyNode = state.result;
|
|
2231
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2232
|
+
ch = state.input.charCodeAt(state.position);
|
|
2233
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
2234
|
+
isPair = true;
|
|
2235
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2236
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2237
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2238
|
+
valueNode = state.result;
|
|
2239
|
+
}
|
|
2240
|
+
if (isMapping) {
|
|
2241
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
2242
|
+
} else if (isPair) {
|
|
2243
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
|
2244
|
+
} else {
|
|
2245
|
+
_result.push(keyNode);
|
|
2246
|
+
}
|
|
2247
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2248
|
+
ch = state.input.charCodeAt(state.position);
|
|
2249
|
+
if (ch === 44) {
|
|
2250
|
+
readNext = true;
|
|
2251
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2252
|
+
} else {
|
|
2253
|
+
readNext = false;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2257
|
+
}
|
|
2258
|
+
function readBlockScalar(state, nodeIndent) {
|
|
2259
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
2260
|
+
ch = state.input.charCodeAt(state.position);
|
|
2261
|
+
if (ch === 124) {
|
|
2262
|
+
folding = false;
|
|
2263
|
+
} else if (ch === 62) {
|
|
2264
|
+
folding = true;
|
|
2265
|
+
} else {
|
|
2266
|
+
return false;
|
|
2267
|
+
}
|
|
2268
|
+
state.kind = "scalar";
|
|
2269
|
+
state.result = "";
|
|
2270
|
+
while (ch !== 0) {
|
|
2271
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2272
|
+
if (ch === 43 || ch === 45) {
|
|
2273
|
+
if (CHOMPING_CLIP === chomping) {
|
|
2274
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
2275
|
+
} else {
|
|
2276
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
2277
|
+
}
|
|
2278
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
2279
|
+
if (tmp === 0) {
|
|
2280
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
2281
|
+
} else if (!detectedIndent) {
|
|
2282
|
+
textIndent = nodeIndent + tmp - 1;
|
|
2283
|
+
detectedIndent = true;
|
|
2284
|
+
} else {
|
|
2285
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
2286
|
+
}
|
|
2287
|
+
} else {
|
|
2288
|
+
break;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2292
|
+
do {
|
|
2293
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2294
|
+
} while (is_WHITE_SPACE(ch));
|
|
2295
|
+
if (ch === 35) {
|
|
2296
|
+
do {
|
|
2297
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2298
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
while (ch !== 0) {
|
|
2302
|
+
readLineBreak(state);
|
|
2303
|
+
state.lineIndent = 0;
|
|
2304
|
+
ch = state.input.charCodeAt(state.position);
|
|
2305
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
2306
|
+
state.lineIndent++;
|
|
2307
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2308
|
+
}
|
|
2309
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
2310
|
+
textIndent = state.lineIndent;
|
|
2311
|
+
}
|
|
2312
|
+
if (is_EOL(ch)) {
|
|
2313
|
+
emptyLines++;
|
|
2314
|
+
continue;
|
|
2315
|
+
}
|
|
2316
|
+
if (state.lineIndent < textIndent) {
|
|
2317
|
+
if (chomping === CHOMPING_KEEP) {
|
|
2318
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2319
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
2320
|
+
if (didReadContent) {
|
|
2321
|
+
state.result += "\n";
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
break;
|
|
2325
|
+
}
|
|
2326
|
+
if (folding) {
|
|
2327
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2328
|
+
atMoreIndented = true;
|
|
2329
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2330
|
+
} else if (atMoreIndented) {
|
|
2331
|
+
atMoreIndented = false;
|
|
2332
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
2333
|
+
} else if (emptyLines === 0) {
|
|
2334
|
+
if (didReadContent) {
|
|
2335
|
+
state.result += " ";
|
|
2336
|
+
}
|
|
2337
|
+
} else {
|
|
2338
|
+
state.result += common.repeat("\n", emptyLines);
|
|
2339
|
+
}
|
|
2340
|
+
} else {
|
|
2341
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2342
|
+
}
|
|
2343
|
+
didReadContent = true;
|
|
2344
|
+
detectedIndent = true;
|
|
2345
|
+
emptyLines = 0;
|
|
2346
|
+
captureStart = state.position;
|
|
2347
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
2348
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2349
|
+
}
|
|
2350
|
+
captureSegment(state, captureStart, state.position, false);
|
|
2351
|
+
}
|
|
2352
|
+
return true;
|
|
2353
|
+
}
|
|
2354
|
+
function readBlockSequence(state, nodeIndent) {
|
|
2355
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
2356
|
+
if (state.anchor !== null) {
|
|
2357
|
+
state.anchorMap[state.anchor] = _result;
|
|
2358
|
+
}
|
|
2359
|
+
ch = state.input.charCodeAt(state.position);
|
|
2360
|
+
while (ch !== 0) {
|
|
2361
|
+
if (ch !== 45) {
|
|
2362
|
+
break;
|
|
2363
|
+
}
|
|
2364
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2365
|
+
if (!is_WS_OR_EOL(following)) {
|
|
2366
|
+
break;
|
|
2367
|
+
}
|
|
2368
|
+
detected = true;
|
|
2369
|
+
state.position++;
|
|
2370
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2371
|
+
if (state.lineIndent <= nodeIndent) {
|
|
2372
|
+
_result.push(null);
|
|
2373
|
+
ch = state.input.charCodeAt(state.position);
|
|
2374
|
+
continue;
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
_line = state.line;
|
|
2378
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2379
|
+
_result.push(state.result);
|
|
2380
|
+
skipSeparationSpace(state, true, -1);
|
|
2381
|
+
ch = state.input.charCodeAt(state.position);
|
|
2382
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2383
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
2384
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2385
|
+
break;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
if (detected) {
|
|
2389
|
+
state.tag = _tag;
|
|
2390
|
+
state.anchor = _anchor;
|
|
2391
|
+
state.kind = "sequence";
|
|
2392
|
+
state.result = _result;
|
|
2393
|
+
return true;
|
|
2394
|
+
}
|
|
2395
|
+
return false;
|
|
2396
|
+
}
|
|
2397
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2398
|
+
var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
2399
|
+
if (state.anchor !== null) {
|
|
2400
|
+
state.anchorMap[state.anchor] = _result;
|
|
2401
|
+
}
|
|
2402
|
+
ch = state.input.charCodeAt(state.position);
|
|
2403
|
+
while (ch !== 0) {
|
|
2404
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2405
|
+
_line = state.line;
|
|
2406
|
+
_pos = state.position;
|
|
2407
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
2408
|
+
if (ch === 63) {
|
|
2409
|
+
if (atExplicitKey) {
|
|
2410
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2411
|
+
keyTag = keyNode = valueNode = null;
|
|
2412
|
+
}
|
|
2413
|
+
detected = true;
|
|
2414
|
+
atExplicitKey = true;
|
|
2415
|
+
allowCompact = true;
|
|
2416
|
+
} else if (atExplicitKey) {
|
|
2417
|
+
atExplicitKey = false;
|
|
2418
|
+
allowCompact = true;
|
|
2419
|
+
} else {
|
|
2420
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
2421
|
+
}
|
|
2422
|
+
state.position += 1;
|
|
2423
|
+
ch = following;
|
|
2424
|
+
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
2425
|
+
if (state.line === _line) {
|
|
2426
|
+
ch = state.input.charCodeAt(state.position);
|
|
2427
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2428
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2429
|
+
}
|
|
2430
|
+
if (ch === 58) {
|
|
2431
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2432
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
2433
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
2434
|
+
}
|
|
2435
|
+
if (atExplicitKey) {
|
|
2436
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2437
|
+
keyTag = keyNode = valueNode = null;
|
|
2438
|
+
}
|
|
2439
|
+
detected = true;
|
|
2440
|
+
atExplicitKey = false;
|
|
2441
|
+
allowCompact = false;
|
|
2442
|
+
keyTag = state.tag;
|
|
2443
|
+
keyNode = state.result;
|
|
2444
|
+
} else if (detected) {
|
|
2445
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
2446
|
+
} else {
|
|
2447
|
+
state.tag = _tag;
|
|
2448
|
+
state.anchor = _anchor;
|
|
2449
|
+
return true;
|
|
2450
|
+
}
|
|
2451
|
+
} else if (detected) {
|
|
2452
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2453
|
+
} else {
|
|
2454
|
+
state.tag = _tag;
|
|
2455
|
+
state.anchor = _anchor;
|
|
2456
|
+
return true;
|
|
2457
|
+
}
|
|
2458
|
+
} else {
|
|
2459
|
+
break;
|
|
2460
|
+
}
|
|
2461
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
2462
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
2463
|
+
if (atExplicitKey) {
|
|
2464
|
+
keyNode = state.result;
|
|
2465
|
+
} else {
|
|
2466
|
+
valueNode = state.result;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
if (!atExplicitKey) {
|
|
2470
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
|
2471
|
+
keyTag = keyNode = valueNode = null;
|
|
2472
|
+
}
|
|
2473
|
+
skipSeparationSpace(state, true, -1);
|
|
2474
|
+
ch = state.input.charCodeAt(state.position);
|
|
2475
|
+
}
|
|
2476
|
+
if (state.lineIndent > nodeIndent && ch !== 0) {
|
|
2477
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
2478
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2479
|
+
break;
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
if (atExplicitKey) {
|
|
2483
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2484
|
+
}
|
|
2485
|
+
if (detected) {
|
|
2486
|
+
state.tag = _tag;
|
|
2487
|
+
state.anchor = _anchor;
|
|
2488
|
+
state.kind = "mapping";
|
|
2489
|
+
state.result = _result;
|
|
2490
|
+
}
|
|
2491
|
+
return detected;
|
|
2492
|
+
}
|
|
2493
|
+
function readTagProperty(state) {
|
|
2494
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
2495
|
+
ch = state.input.charCodeAt(state.position);
|
|
2496
|
+
if (ch !== 33) return false;
|
|
2497
|
+
if (state.tag !== null) {
|
|
2498
|
+
throwError(state, "duplication of a tag property");
|
|
2499
|
+
}
|
|
2500
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2501
|
+
if (ch === 60) {
|
|
2502
|
+
isVerbatim = true;
|
|
2503
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2504
|
+
} else if (ch === 33) {
|
|
2505
|
+
isNamed = true;
|
|
2506
|
+
tagHandle = "!!";
|
|
2507
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2508
|
+
} else {
|
|
2509
|
+
tagHandle = "!";
|
|
2510
|
+
}
|
|
2511
|
+
_position = state.position;
|
|
2512
|
+
if (isVerbatim) {
|
|
2513
|
+
do {
|
|
2514
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2515
|
+
} while (ch !== 0 && ch !== 62);
|
|
2516
|
+
if (state.position < state.length) {
|
|
2517
|
+
tagName = state.input.slice(_position, state.position);
|
|
2518
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2519
|
+
} else {
|
|
2520
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
2521
|
+
}
|
|
2522
|
+
} else {
|
|
2523
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2524
|
+
if (ch === 33) {
|
|
2525
|
+
if (!isNamed) {
|
|
2526
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
2527
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
2528
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
2529
|
+
}
|
|
2530
|
+
isNamed = true;
|
|
2531
|
+
_position = state.position + 1;
|
|
2532
|
+
} else {
|
|
2533
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2537
|
+
}
|
|
2538
|
+
tagName = state.input.slice(_position, state.position);
|
|
2539
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
2540
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
2544
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
2545
|
+
}
|
|
2546
|
+
if (isVerbatim) {
|
|
2547
|
+
state.tag = tagName;
|
|
2548
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
2549
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
2550
|
+
} else if (tagHandle === "!") {
|
|
2551
|
+
state.tag = "!" + tagName;
|
|
2552
|
+
} else if (tagHandle === "!!") {
|
|
2553
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
2554
|
+
} else {
|
|
2555
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
2556
|
+
}
|
|
2557
|
+
return true;
|
|
2558
|
+
}
|
|
2559
|
+
function readAnchorProperty(state) {
|
|
2560
|
+
var _position, ch;
|
|
2561
|
+
ch = state.input.charCodeAt(state.position);
|
|
2562
|
+
if (ch !== 38) return false;
|
|
2563
|
+
if (state.anchor !== null) {
|
|
2564
|
+
throwError(state, "duplication of an anchor property");
|
|
2565
|
+
}
|
|
2566
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2567
|
+
_position = state.position;
|
|
2568
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2569
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2570
|
+
}
|
|
2571
|
+
if (state.position === _position) {
|
|
2572
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
2573
|
+
}
|
|
2574
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
2575
|
+
return true;
|
|
2576
|
+
}
|
|
2577
|
+
function readAlias(state) {
|
|
2578
|
+
var _position, alias, ch;
|
|
2579
|
+
ch = state.input.charCodeAt(state.position);
|
|
2580
|
+
if (ch !== 42) return false;
|
|
2581
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2582
|
+
_position = state.position;
|
|
2583
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2584
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2585
|
+
}
|
|
2586
|
+
if (state.position === _position) {
|
|
2587
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
2588
|
+
}
|
|
2589
|
+
alias = state.input.slice(_position, state.position);
|
|
2590
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
2591
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
2592
|
+
}
|
|
2593
|
+
state.result = state.anchorMap[alias];
|
|
2594
|
+
skipSeparationSpace(state, true, -1);
|
|
2595
|
+
return true;
|
|
2596
|
+
}
|
|
2597
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
2598
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
|
|
2599
|
+
if (state.listener !== null) {
|
|
2600
|
+
state.listener("open", state);
|
|
2601
|
+
}
|
|
2602
|
+
state.tag = null;
|
|
2603
|
+
state.anchor = null;
|
|
2604
|
+
state.kind = null;
|
|
2605
|
+
state.result = null;
|
|
2606
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
2607
|
+
if (allowToSeek) {
|
|
2608
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2609
|
+
atNewLine = true;
|
|
2610
|
+
if (state.lineIndent > parentIndent) {
|
|
2611
|
+
indentStatus = 1;
|
|
2612
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2613
|
+
indentStatus = 0;
|
|
2614
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2615
|
+
indentStatus = -1;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
if (indentStatus === 1) {
|
|
2620
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
2621
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2622
|
+
atNewLine = true;
|
|
2623
|
+
allowBlockCollections = allowBlockStyles;
|
|
2624
|
+
if (state.lineIndent > parentIndent) {
|
|
2625
|
+
indentStatus = 1;
|
|
2626
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2627
|
+
indentStatus = 0;
|
|
2628
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2629
|
+
indentStatus = -1;
|
|
2630
|
+
}
|
|
2631
|
+
} else {
|
|
2632
|
+
allowBlockCollections = false;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
if (allowBlockCollections) {
|
|
2637
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
2638
|
+
}
|
|
2639
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
2640
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
2641
|
+
flowIndent = parentIndent;
|
|
2642
|
+
} else {
|
|
2643
|
+
flowIndent = parentIndent + 1;
|
|
2644
|
+
}
|
|
2645
|
+
blockIndent = state.position - state.lineStart;
|
|
2646
|
+
if (indentStatus === 1) {
|
|
2647
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
2648
|
+
hasContent = true;
|
|
2649
|
+
} else {
|
|
2650
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
2651
|
+
hasContent = true;
|
|
2652
|
+
} else if (readAlias(state)) {
|
|
2653
|
+
hasContent = true;
|
|
2654
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
2655
|
+
throwError(state, "alias node should not have any properties");
|
|
2656
|
+
}
|
|
2657
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
2658
|
+
hasContent = true;
|
|
2659
|
+
if (state.tag === null) {
|
|
2660
|
+
state.tag = "?";
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
if (state.anchor !== null) {
|
|
2664
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
} else if (indentStatus === 0) {
|
|
2668
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
if (state.tag !== null && state.tag !== "!") {
|
|
2672
|
+
if (state.tag === "?") {
|
|
2673
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
2674
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
2675
|
+
}
|
|
2676
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
2677
|
+
type = state.implicitTypes[typeIndex];
|
|
2678
|
+
if (type.resolve(state.result)) {
|
|
2679
|
+
state.result = type.construct(state.result);
|
|
2680
|
+
state.tag = type.tag;
|
|
2681
|
+
if (state.anchor !== null) {
|
|
2682
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2683
|
+
}
|
|
2684
|
+
break;
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
} else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
2688
|
+
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
2689
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
2690
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2691
|
+
}
|
|
2692
|
+
if (!type.resolve(state.result)) {
|
|
2693
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
2694
|
+
} else {
|
|
2695
|
+
state.result = type.construct(state.result);
|
|
2696
|
+
if (state.anchor !== null) {
|
|
2697
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
} else {
|
|
2701
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
if (state.listener !== null) {
|
|
2705
|
+
state.listener("close", state);
|
|
2706
|
+
}
|
|
2707
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2708
|
+
}
|
|
2709
|
+
function readDocument(state) {
|
|
2710
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
2711
|
+
state.version = null;
|
|
2712
|
+
state.checkLineBreaks = state.legacy;
|
|
2713
|
+
state.tagMap = {};
|
|
2714
|
+
state.anchorMap = {};
|
|
2715
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2716
|
+
skipSeparationSpace(state, true, -1);
|
|
2717
|
+
ch = state.input.charCodeAt(state.position);
|
|
2718
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
2719
|
+
break;
|
|
2720
|
+
}
|
|
2721
|
+
hasDirectives = true;
|
|
2722
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2723
|
+
_position = state.position;
|
|
2724
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2725
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2726
|
+
}
|
|
2727
|
+
directiveName = state.input.slice(_position, state.position);
|
|
2728
|
+
directiveArgs = [];
|
|
2729
|
+
if (directiveName.length < 1) {
|
|
2730
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
2731
|
+
}
|
|
2732
|
+
while (ch !== 0) {
|
|
2733
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2734
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2735
|
+
}
|
|
2736
|
+
if (ch === 35) {
|
|
2737
|
+
do {
|
|
2738
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2739
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
2740
|
+
break;
|
|
2741
|
+
}
|
|
2742
|
+
if (is_EOL(ch)) break;
|
|
2743
|
+
_position = state.position;
|
|
2744
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2745
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2746
|
+
}
|
|
2747
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2748
|
+
}
|
|
2749
|
+
if (ch !== 0) readLineBreak(state);
|
|
2750
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2751
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2752
|
+
} else {
|
|
2753
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
skipSeparationSpace(state, true, -1);
|
|
2757
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2758
|
+
state.position += 3;
|
|
2759
|
+
skipSeparationSpace(state, true, -1);
|
|
2760
|
+
} else if (hasDirectives) {
|
|
2761
|
+
throwError(state, "directives end mark is expected");
|
|
2762
|
+
}
|
|
2763
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2764
|
+
skipSeparationSpace(state, true, -1);
|
|
2765
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2766
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2767
|
+
}
|
|
2768
|
+
state.documents.push(state.result);
|
|
2769
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2770
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
2771
|
+
state.position += 3;
|
|
2772
|
+
skipSeparationSpace(state, true, -1);
|
|
2773
|
+
}
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2776
|
+
if (state.position < state.length - 1) {
|
|
2777
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
2778
|
+
} else {
|
|
2779
|
+
return;
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
function loadDocuments(input, options2) {
|
|
2783
|
+
input = String(input);
|
|
2784
|
+
options2 = options2 || {};
|
|
2785
|
+
if (input.length !== 0) {
|
|
2786
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2787
|
+
input += "\n";
|
|
2788
|
+
}
|
|
2789
|
+
if (input.charCodeAt(0) === 65279) {
|
|
2790
|
+
input = input.slice(1);
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
var state = new State(input, options2);
|
|
2794
|
+
var nullpos = input.indexOf("\0");
|
|
2795
|
+
if (nullpos !== -1) {
|
|
2796
|
+
state.position = nullpos;
|
|
2797
|
+
throwError(state, "null byte is not allowed in input");
|
|
2798
|
+
}
|
|
2799
|
+
state.input += "\0";
|
|
2800
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
2801
|
+
state.lineIndent += 1;
|
|
2802
|
+
state.position += 1;
|
|
2803
|
+
}
|
|
2804
|
+
while (state.position < state.length - 1) {
|
|
2805
|
+
readDocument(state);
|
|
2806
|
+
}
|
|
2807
|
+
return state.documents;
|
|
2808
|
+
}
|
|
2809
|
+
function loadAll(input, iterator, options2) {
|
|
2810
|
+
if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
|
|
2811
|
+
options2 = iterator;
|
|
2812
|
+
iterator = null;
|
|
2813
|
+
}
|
|
2814
|
+
var documents = loadDocuments(input, options2);
|
|
2815
|
+
if (typeof iterator !== "function") {
|
|
2816
|
+
return documents;
|
|
2817
|
+
}
|
|
2818
|
+
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
2819
|
+
iterator(documents[index]);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
function load(input, options2) {
|
|
2823
|
+
var documents = loadDocuments(input, options2);
|
|
2824
|
+
if (documents.length === 0) {
|
|
2825
|
+
return void 0;
|
|
2826
|
+
} else if (documents.length === 1) {
|
|
2827
|
+
return documents[0];
|
|
2828
|
+
}
|
|
2829
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2830
|
+
}
|
|
2831
|
+
function safeLoadAll(input, iterator, options2) {
|
|
2832
|
+
if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
|
|
2833
|
+
options2 = iterator;
|
|
2834
|
+
iterator = null;
|
|
2835
|
+
}
|
|
2836
|
+
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2837
|
+
}
|
|
2838
|
+
function safeLoad(input, options2) {
|
|
2839
|
+
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2840
|
+
}
|
|
2841
|
+
module2.exports.loadAll = loadAll;
|
|
2842
|
+
module2.exports.load = load;
|
|
2843
|
+
module2.exports.safeLoadAll = safeLoadAll;
|
|
2844
|
+
module2.exports.safeLoad = safeLoad;
|
|
2845
|
+
}
|
|
2846
|
+
});
|
|
2847
|
+
|
|
2848
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/dumper.js
|
|
2849
|
+
var require_dumper = __commonJS({
|
|
2850
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
|
2851
|
+
"use strict";
|
|
2852
|
+
var common = require_common();
|
|
2853
|
+
var YAMLException = require_exception();
|
|
2854
|
+
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
2855
|
+
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
2856
|
+
var _toString = Object.prototype.toString;
|
|
2857
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2858
|
+
var CHAR_TAB = 9;
|
|
2859
|
+
var CHAR_LINE_FEED = 10;
|
|
2860
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
2861
|
+
var CHAR_SPACE = 32;
|
|
2862
|
+
var CHAR_EXCLAMATION = 33;
|
|
2863
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
2864
|
+
var CHAR_SHARP = 35;
|
|
2865
|
+
var CHAR_PERCENT = 37;
|
|
2866
|
+
var CHAR_AMPERSAND = 38;
|
|
2867
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
2868
|
+
var CHAR_ASTERISK = 42;
|
|
2869
|
+
var CHAR_COMMA = 44;
|
|
2870
|
+
var CHAR_MINUS = 45;
|
|
2871
|
+
var CHAR_COLON = 58;
|
|
2872
|
+
var CHAR_EQUALS = 61;
|
|
2873
|
+
var CHAR_GREATER_THAN = 62;
|
|
2874
|
+
var CHAR_QUESTION = 63;
|
|
2875
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
2876
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2877
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2878
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
2879
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2880
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
2881
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2882
|
+
var ESCAPE_SEQUENCES = {};
|
|
2883
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2884
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2885
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2886
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2887
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2888
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2889
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2890
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2891
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2892
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2893
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2894
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2895
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2896
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2897
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2898
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2899
|
+
"y",
|
|
2900
|
+
"Y",
|
|
2901
|
+
"yes",
|
|
2902
|
+
"Yes",
|
|
2903
|
+
"YES",
|
|
2904
|
+
"on",
|
|
2905
|
+
"On",
|
|
2906
|
+
"ON",
|
|
2907
|
+
"n",
|
|
2908
|
+
"N",
|
|
2909
|
+
"no",
|
|
2910
|
+
"No",
|
|
2911
|
+
"NO",
|
|
2912
|
+
"off",
|
|
2913
|
+
"Off",
|
|
2914
|
+
"OFF"
|
|
2915
|
+
];
|
|
2916
|
+
function compileStyleMap(schema, map) {
|
|
2917
|
+
var result, keys, index, length, tag, style, type;
|
|
2918
|
+
if (map === null) return {};
|
|
2919
|
+
result = {};
|
|
2920
|
+
keys = Object.keys(map);
|
|
2921
|
+
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2922
|
+
tag = keys[index];
|
|
2923
|
+
style = String(map[tag]);
|
|
2924
|
+
if (tag.slice(0, 2) === "!!") {
|
|
2925
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2926
|
+
}
|
|
2927
|
+
type = schema.compiledTypeMap["fallback"][tag];
|
|
2928
|
+
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2929
|
+
style = type.styleAliases[style];
|
|
2930
|
+
}
|
|
2931
|
+
result[tag] = style;
|
|
2932
|
+
}
|
|
2933
|
+
return result;
|
|
2934
|
+
}
|
|
2935
|
+
function encodeHex(character) {
|
|
2936
|
+
var string, handle, length;
|
|
2937
|
+
string = character.toString(16).toUpperCase();
|
|
2938
|
+
if (character <= 255) {
|
|
2939
|
+
handle = "x";
|
|
2940
|
+
length = 2;
|
|
2941
|
+
} else if (character <= 65535) {
|
|
2942
|
+
handle = "u";
|
|
2943
|
+
length = 4;
|
|
2944
|
+
} else if (character <= 4294967295) {
|
|
2945
|
+
handle = "U";
|
|
2946
|
+
length = 8;
|
|
2947
|
+
} else {
|
|
2948
|
+
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2949
|
+
}
|
|
2950
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2951
|
+
}
|
|
2952
|
+
function State(options2) {
|
|
2953
|
+
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
2954
|
+
this.indent = Math.max(1, options2["indent"] || 2);
|
|
2955
|
+
this.noArrayIndent = options2["noArrayIndent"] || false;
|
|
2956
|
+
this.skipInvalid = options2["skipInvalid"] || false;
|
|
2957
|
+
this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"];
|
|
2958
|
+
this.styleMap = compileStyleMap(this.schema, options2["styles"] || null);
|
|
2959
|
+
this.sortKeys = options2["sortKeys"] || false;
|
|
2960
|
+
this.lineWidth = options2["lineWidth"] || 80;
|
|
2961
|
+
this.noRefs = options2["noRefs"] || false;
|
|
2962
|
+
this.noCompatMode = options2["noCompatMode"] || false;
|
|
2963
|
+
this.condenseFlow = options2["condenseFlow"] || false;
|
|
2964
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2965
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
2966
|
+
this.tag = null;
|
|
2967
|
+
this.result = "";
|
|
2968
|
+
this.duplicates = [];
|
|
2969
|
+
this.usedDuplicates = null;
|
|
2970
|
+
}
|
|
2971
|
+
function indentString(string, spaces) {
|
|
2972
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
2973
|
+
while (position < length) {
|
|
2974
|
+
next = string.indexOf("\n", position);
|
|
2975
|
+
if (next === -1) {
|
|
2976
|
+
line = string.slice(position);
|
|
2977
|
+
position = length;
|
|
2978
|
+
} else {
|
|
2979
|
+
line = string.slice(position, next + 1);
|
|
2980
|
+
position = next + 1;
|
|
2981
|
+
}
|
|
2982
|
+
if (line.length && line !== "\n") result += ind;
|
|
2983
|
+
result += line;
|
|
2984
|
+
}
|
|
2985
|
+
return result;
|
|
2986
|
+
}
|
|
2987
|
+
function generateNextLine(state, level) {
|
|
2988
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
2989
|
+
}
|
|
2990
|
+
function testImplicitResolving(state, str2) {
|
|
2991
|
+
var index, length, type;
|
|
2992
|
+
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2993
|
+
type = state.implicitTypes[index];
|
|
2994
|
+
if (type.resolve(str2)) {
|
|
2995
|
+
return true;
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
return false;
|
|
2999
|
+
}
|
|
3000
|
+
function isWhitespace(c) {
|
|
3001
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
3002
|
+
}
|
|
3003
|
+
function isPrintable(c) {
|
|
3004
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
|
3005
|
+
}
|
|
3006
|
+
function isNsChar(c) {
|
|
3007
|
+
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
3008
|
+
}
|
|
3009
|
+
function isPlainSafe(c, prev) {
|
|
3010
|
+
return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
|
|
3011
|
+
}
|
|
3012
|
+
function isPlainSafeFirst(c) {
|
|
3013
|
+
return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
3014
|
+
}
|
|
3015
|
+
function needIndentIndicator(string) {
|
|
3016
|
+
var leadingSpaceRe = /^\n* /;
|
|
3017
|
+
return leadingSpaceRe.test(string);
|
|
3018
|
+
}
|
|
3019
|
+
var STYLE_PLAIN = 1;
|
|
3020
|
+
var STYLE_SINGLE = 2;
|
|
3021
|
+
var STYLE_LITERAL = 3;
|
|
3022
|
+
var STYLE_FOLDED = 4;
|
|
3023
|
+
var STYLE_DOUBLE = 5;
|
|
3024
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
3025
|
+
var i;
|
|
3026
|
+
var char, prev_char;
|
|
3027
|
+
var hasLineBreak = false;
|
|
3028
|
+
var hasFoldableLine = false;
|
|
3029
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
3030
|
+
var previousLineBreak = -1;
|
|
3031
|
+
var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
|
|
3032
|
+
if (singleLineOnly) {
|
|
3033
|
+
for (i = 0; i < string.length; i++) {
|
|
3034
|
+
char = string.charCodeAt(i);
|
|
3035
|
+
if (!isPrintable(char)) {
|
|
3036
|
+
return STYLE_DOUBLE;
|
|
3037
|
+
}
|
|
3038
|
+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
3039
|
+
plain = plain && isPlainSafe(char, prev_char);
|
|
3040
|
+
}
|
|
3041
|
+
} else {
|
|
3042
|
+
for (i = 0; i < string.length; i++) {
|
|
3043
|
+
char = string.charCodeAt(i);
|
|
3044
|
+
if (char === CHAR_LINE_FEED) {
|
|
3045
|
+
hasLineBreak = true;
|
|
3046
|
+
if (shouldTrackWidth) {
|
|
3047
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
3048
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
3049
|
+
previousLineBreak = i;
|
|
3050
|
+
}
|
|
3051
|
+
} else if (!isPrintable(char)) {
|
|
3052
|
+
return STYLE_DOUBLE;
|
|
3053
|
+
}
|
|
3054
|
+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
3055
|
+
plain = plain && isPlainSafe(char, prev_char);
|
|
3056
|
+
}
|
|
3057
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
3058
|
+
}
|
|
3059
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
3060
|
+
return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
|
|
3061
|
+
}
|
|
3062
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
3063
|
+
return STYLE_DOUBLE;
|
|
3064
|
+
}
|
|
3065
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
3066
|
+
}
|
|
3067
|
+
function writeScalar(state, string, level, iskey) {
|
|
3068
|
+
state.dump = (function() {
|
|
3069
|
+
if (string.length === 0) {
|
|
3070
|
+
return "''";
|
|
3071
|
+
}
|
|
3072
|
+
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
|
|
3073
|
+
return "'" + string + "'";
|
|
3074
|
+
}
|
|
3075
|
+
var indent = state.indent * Math.max(1, level);
|
|
3076
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
3077
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
3078
|
+
function testAmbiguity(string2) {
|
|
3079
|
+
return testImplicitResolving(state, string2);
|
|
3080
|
+
}
|
|
3081
|
+
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
3082
|
+
case STYLE_PLAIN:
|
|
3083
|
+
return string;
|
|
3084
|
+
case STYLE_SINGLE:
|
|
3085
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
3086
|
+
case STYLE_LITERAL:
|
|
3087
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
3088
|
+
case STYLE_FOLDED:
|
|
3089
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
3090
|
+
case STYLE_DOUBLE:
|
|
3091
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
3092
|
+
default:
|
|
3093
|
+
throw new YAMLException("impossible error: invalid scalar style");
|
|
3094
|
+
}
|
|
3095
|
+
})();
|
|
3096
|
+
}
|
|
3097
|
+
function blockHeader(string, indentPerLevel) {
|
|
3098
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
3099
|
+
var clip = string[string.length - 1] === "\n";
|
|
3100
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
3101
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
3102
|
+
return indentIndicator + chomp + "\n";
|
|
3103
|
+
}
|
|
3104
|
+
function dropEndingNewline(string) {
|
|
3105
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
3106
|
+
}
|
|
3107
|
+
function foldString(string, width) {
|
|
3108
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
3109
|
+
var result = (function() {
|
|
3110
|
+
var nextLF = string.indexOf("\n");
|
|
3111
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
3112
|
+
lineRe.lastIndex = nextLF;
|
|
3113
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
3114
|
+
})();
|
|
3115
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
3116
|
+
var moreIndented;
|
|
3117
|
+
var match;
|
|
3118
|
+
while (match = lineRe.exec(string)) {
|
|
3119
|
+
var prefix = match[1], line = match[2];
|
|
3120
|
+
moreIndented = line[0] === " ";
|
|
3121
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
3122
|
+
prevMoreIndented = moreIndented;
|
|
3123
|
+
}
|
|
3124
|
+
return result;
|
|
3125
|
+
}
|
|
3126
|
+
function foldLine(line, width) {
|
|
3127
|
+
if (line === "" || line[0] === " ") return line;
|
|
3128
|
+
var breakRe = / [^ ]/g;
|
|
3129
|
+
var match;
|
|
3130
|
+
var start = 0, end, curr = 0, next = 0;
|
|
3131
|
+
var result = "";
|
|
3132
|
+
while (match = breakRe.exec(line)) {
|
|
3133
|
+
next = match.index;
|
|
3134
|
+
if (next - start > width) {
|
|
3135
|
+
end = curr > start ? curr : next;
|
|
3136
|
+
result += "\n" + line.slice(start, end);
|
|
3137
|
+
start = end + 1;
|
|
3138
|
+
}
|
|
3139
|
+
curr = next;
|
|
3140
|
+
}
|
|
3141
|
+
result += "\n";
|
|
3142
|
+
if (line.length - start > width && curr > start) {
|
|
3143
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
3144
|
+
} else {
|
|
3145
|
+
result += line.slice(start);
|
|
3146
|
+
}
|
|
3147
|
+
return result.slice(1);
|
|
3148
|
+
}
|
|
3149
|
+
function escapeString(string) {
|
|
3150
|
+
var result = "";
|
|
3151
|
+
var char, nextChar;
|
|
3152
|
+
var escapeSeq;
|
|
3153
|
+
for (var i = 0; i < string.length; i++) {
|
|
3154
|
+
char = string.charCodeAt(i);
|
|
3155
|
+
if (char >= 55296 && char <= 56319) {
|
|
3156
|
+
nextChar = string.charCodeAt(i + 1);
|
|
3157
|
+
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
3158
|
+
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
3159
|
+
i++;
|
|
3160
|
+
continue;
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
3164
|
+
result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
|
|
3165
|
+
}
|
|
3166
|
+
return result;
|
|
3167
|
+
}
|
|
3168
|
+
function writeFlowSequence(state, level, object) {
|
|
3169
|
+
var _result = "", _tag = state.tag, index, length;
|
|
3170
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3171
|
+
if (writeNode(state, level, object[index], false, false)) {
|
|
3172
|
+
if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
|
|
3173
|
+
_result += state.dump;
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
state.tag = _tag;
|
|
3177
|
+
state.dump = "[" + _result + "]";
|
|
3178
|
+
}
|
|
3179
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
3180
|
+
var _result = "", _tag = state.tag, index, length;
|
|
3181
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3182
|
+
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
3183
|
+
if (!compact || index !== 0) {
|
|
3184
|
+
_result += generateNextLine(state, level);
|
|
3185
|
+
}
|
|
3186
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3187
|
+
_result += "-";
|
|
3188
|
+
} else {
|
|
3189
|
+
_result += "- ";
|
|
3190
|
+
}
|
|
3191
|
+
_result += state.dump;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
state.tag = _tag;
|
|
3195
|
+
state.dump = _result || "[]";
|
|
3196
|
+
}
|
|
3197
|
+
function writeFlowMapping(state, level, object) {
|
|
3198
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
3199
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3200
|
+
pairBuffer = "";
|
|
3201
|
+
if (index !== 0) pairBuffer += ", ";
|
|
3202
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
3203
|
+
objectKey = objectKeyList[index];
|
|
3204
|
+
objectValue = object[objectKey];
|
|
3205
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
3206
|
+
continue;
|
|
3207
|
+
}
|
|
3208
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
3209
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
3210
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
3211
|
+
continue;
|
|
3212
|
+
}
|
|
3213
|
+
pairBuffer += state.dump;
|
|
3214
|
+
_result += pairBuffer;
|
|
3215
|
+
}
|
|
3216
|
+
state.tag = _tag;
|
|
3217
|
+
state.dump = "{" + _result + "}";
|
|
3218
|
+
}
|
|
3219
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
3220
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
3221
|
+
if (state.sortKeys === true) {
|
|
3222
|
+
objectKeyList.sort();
|
|
3223
|
+
} else if (typeof state.sortKeys === "function") {
|
|
3224
|
+
objectKeyList.sort(state.sortKeys);
|
|
3225
|
+
} else if (state.sortKeys) {
|
|
3226
|
+
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
3227
|
+
}
|
|
3228
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3229
|
+
pairBuffer = "";
|
|
3230
|
+
if (!compact || index !== 0) {
|
|
3231
|
+
pairBuffer += generateNextLine(state, level);
|
|
3232
|
+
}
|
|
3233
|
+
objectKey = objectKeyList[index];
|
|
3234
|
+
objectValue = object[objectKey];
|
|
3235
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
3236
|
+
continue;
|
|
3237
|
+
}
|
|
3238
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
3239
|
+
if (explicitPair) {
|
|
3240
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3241
|
+
pairBuffer += "?";
|
|
3242
|
+
} else {
|
|
3243
|
+
pairBuffer += "? ";
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
pairBuffer += state.dump;
|
|
3247
|
+
if (explicitPair) {
|
|
3248
|
+
pairBuffer += generateNextLine(state, level);
|
|
3249
|
+
}
|
|
3250
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3251
|
+
continue;
|
|
3252
|
+
}
|
|
3253
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3254
|
+
pairBuffer += ":";
|
|
3255
|
+
} else {
|
|
3256
|
+
pairBuffer += ": ";
|
|
3257
|
+
}
|
|
3258
|
+
pairBuffer += state.dump;
|
|
3259
|
+
_result += pairBuffer;
|
|
3260
|
+
}
|
|
3261
|
+
state.tag = _tag;
|
|
3262
|
+
state.dump = _result || "{}";
|
|
3263
|
+
}
|
|
3264
|
+
function detectType(state, object, explicit) {
|
|
3265
|
+
var _result, typeList, index, length, type, style;
|
|
3266
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
3267
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
3268
|
+
type = typeList[index];
|
|
3269
|
+
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
3270
|
+
state.tag = explicit ? type.tag : "?";
|
|
3271
|
+
if (type.represent) {
|
|
3272
|
+
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
3273
|
+
if (_toString.call(type.represent) === "[object Function]") {
|
|
3274
|
+
_result = type.represent(object, style);
|
|
3275
|
+
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
3276
|
+
_result = type.represent[style](object, style);
|
|
3277
|
+
} else {
|
|
3278
|
+
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3279
|
+
}
|
|
3280
|
+
state.dump = _result;
|
|
3281
|
+
}
|
|
3282
|
+
return true;
|
|
154
3283
|
}
|
|
155
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
156
|
-
throw new Error(`Failed to write ${filePath}: ${message}`);
|
|
157
3284
|
}
|
|
3285
|
+
return false;
|
|
158
3286
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
3287
|
+
function writeNode(state, level, object, block, compact, iskey) {
|
|
3288
|
+
state.tag = null;
|
|
3289
|
+
state.dump = object;
|
|
3290
|
+
if (!detectType(state, object, false)) {
|
|
3291
|
+
detectType(state, object, true);
|
|
3292
|
+
}
|
|
3293
|
+
var type = _toString.call(state.dump);
|
|
3294
|
+
if (block) {
|
|
3295
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3296
|
+
}
|
|
3297
|
+
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
3298
|
+
if (objectOrArray) {
|
|
3299
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
3300
|
+
duplicate = duplicateIndex !== -1;
|
|
3301
|
+
}
|
|
3302
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3303
|
+
compact = false;
|
|
3304
|
+
}
|
|
3305
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3306
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
3307
|
+
} else {
|
|
3308
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3309
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
3310
|
+
}
|
|
3311
|
+
if (type === "[object Object]") {
|
|
3312
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
3313
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
3314
|
+
if (duplicate) {
|
|
3315
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3316
|
+
}
|
|
3317
|
+
} else {
|
|
3318
|
+
writeFlowMapping(state, level, state.dump);
|
|
3319
|
+
if (duplicate) {
|
|
3320
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
} else if (type === "[object Array]") {
|
|
3324
|
+
var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
|
|
3325
|
+
if (block && state.dump.length !== 0) {
|
|
3326
|
+
writeBlockSequence(state, arrayLevel, state.dump, compact);
|
|
3327
|
+
if (duplicate) {
|
|
3328
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3329
|
+
}
|
|
3330
|
+
} else {
|
|
3331
|
+
writeFlowSequence(state, arrayLevel, state.dump);
|
|
3332
|
+
if (duplicate) {
|
|
3333
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
} else if (type === "[object String]") {
|
|
3337
|
+
if (state.tag !== "?") {
|
|
3338
|
+
writeScalar(state, state.dump, level, iskey);
|
|
3339
|
+
}
|
|
3340
|
+
} else {
|
|
3341
|
+
if (state.skipInvalid) return false;
|
|
3342
|
+
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
163
3343
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return fallback;
|
|
3344
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
3345
|
+
state.dump = "!<" + state.tag + "> " + state.dump;
|
|
167
3346
|
}
|
|
168
|
-
return JSON.parse(raw);
|
|
169
|
-
} catch (error) {
|
|
170
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
171
|
-
console.warn(`Warning: Could not read ${filePath}: ${message}. Using defaults.`);
|
|
172
|
-
return fallback;
|
|
173
3347
|
}
|
|
3348
|
+
return true;
|
|
174
3349
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
initialized = false;
|
|
181
|
-
constructor(projectRoot) {
|
|
182
|
-
this.basePath = path.join(projectRoot, SF_DIR);
|
|
3350
|
+
function getDuplicateReferences(object, state) {
|
|
3351
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
3352
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
3353
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
3354
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
183
3355
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
3356
|
+
state.usedDuplicates = new Array(length);
|
|
3357
|
+
}
|
|
3358
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
3359
|
+
var objectKeyList, index, length;
|
|
3360
|
+
if (object !== null && typeof object === "object") {
|
|
3361
|
+
index = objects.indexOf(object);
|
|
3362
|
+
if (index !== -1) {
|
|
3363
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3364
|
+
duplicatesIndexes.push(index);
|
|
3365
|
+
}
|
|
3366
|
+
} else {
|
|
3367
|
+
objects.push(object);
|
|
3368
|
+
if (Array.isArray(object)) {
|
|
3369
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3370
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
3371
|
+
}
|
|
3372
|
+
} else {
|
|
3373
|
+
objectKeyList = Object.keys(object);
|
|
3374
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3375
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
194
3378
|
}
|
|
195
|
-
this.reports = safeReadJSON(path.join(this.basePath, REPORTS_FILE), []);
|
|
196
|
-
this.events = safeReadJSON(path.join(this.basePath, EVENTS_FILE), []);
|
|
197
|
-
this.initialized = true;
|
|
198
3379
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
3380
|
+
}
|
|
3381
|
+
function dump(input, options2) {
|
|
3382
|
+
options2 = options2 || {};
|
|
3383
|
+
var state = new State(options2);
|
|
3384
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
3385
|
+
if (writeNode(state, 0, input, true, true)) return state.dump + "\n";
|
|
3386
|
+
return "";
|
|
3387
|
+
}
|
|
3388
|
+
function safeDump(input, options2) {
|
|
3389
|
+
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
3390
|
+
}
|
|
3391
|
+
module2.exports.dump = dump;
|
|
3392
|
+
module2.exports.safeDump = safeDump;
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
|
|
3396
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml.js
|
|
3397
|
+
var require_js_yaml = __commonJS({
|
|
3398
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
|
3399
|
+
"use strict";
|
|
3400
|
+
var loader = require_loader();
|
|
3401
|
+
var dumper = require_dumper();
|
|
3402
|
+
function deprecated(name) {
|
|
3403
|
+
return function() {
|
|
3404
|
+
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
|
3405
|
+
};
|
|
3406
|
+
}
|
|
3407
|
+
module2.exports.Type = require_type();
|
|
3408
|
+
module2.exports.Schema = require_schema();
|
|
3409
|
+
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
3410
|
+
module2.exports.JSON_SCHEMA = require_json();
|
|
3411
|
+
module2.exports.CORE_SCHEMA = require_core();
|
|
3412
|
+
module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
3413
|
+
module2.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
|
3414
|
+
module2.exports.load = loader.load;
|
|
3415
|
+
module2.exports.loadAll = loader.loadAll;
|
|
3416
|
+
module2.exports.safeLoad = loader.safeLoad;
|
|
3417
|
+
module2.exports.safeLoadAll = loader.safeLoadAll;
|
|
3418
|
+
module2.exports.dump = dumper.dump;
|
|
3419
|
+
module2.exports.safeDump = dumper.safeDump;
|
|
3420
|
+
module2.exports.YAMLException = require_exception();
|
|
3421
|
+
module2.exports.MINIMAL_SCHEMA = require_failsafe();
|
|
3422
|
+
module2.exports.SAFE_SCHEMA = require_default_safe();
|
|
3423
|
+
module2.exports.DEFAULT_SCHEMA = require_default_full();
|
|
3424
|
+
module2.exports.scan = deprecated("scan");
|
|
3425
|
+
module2.exports.parse = deprecated("parse");
|
|
3426
|
+
module2.exports.compose = deprecated("compose");
|
|
3427
|
+
module2.exports.addConstructor = deprecated("addConstructor");
|
|
3428
|
+
}
|
|
3429
|
+
});
|
|
3430
|
+
|
|
3431
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/index.js
|
|
3432
|
+
var require_js_yaml2 = __commonJS({
|
|
3433
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/index.js"(exports2, module2) {
|
|
3434
|
+
"use strict";
|
|
3435
|
+
var yaml2 = require_js_yaml();
|
|
3436
|
+
module2.exports = yaml2;
|
|
3437
|
+
}
|
|
3438
|
+
});
|
|
3439
|
+
|
|
3440
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js
|
|
3441
|
+
var require_engines = __commonJS({
|
|
3442
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
3443
|
+
"use strict";
|
|
3444
|
+
var yaml = require_js_yaml2();
|
|
3445
|
+
var engines = exports = module.exports;
|
|
3446
|
+
engines.yaml = {
|
|
3447
|
+
parse: yaml.safeLoad.bind(yaml),
|
|
3448
|
+
stringify: yaml.safeDump.bind(yaml)
|
|
3449
|
+
};
|
|
3450
|
+
engines.json = {
|
|
3451
|
+
parse: JSON.parse.bind(JSON),
|
|
3452
|
+
stringify: function(obj, options2) {
|
|
3453
|
+
const opts = Object.assign({ replacer: null, space: 2 }, options2);
|
|
3454
|
+
return JSON.stringify(obj, opts.replacer, opts.space);
|
|
204
3455
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
3456
|
+
};
|
|
3457
|
+
engines.javascript = {
|
|
3458
|
+
parse: function parse(str, options, wrap) {
|
|
3459
|
+
try {
|
|
3460
|
+
if (wrap !== false) {
|
|
3461
|
+
str = "(function() {\nreturn " + str.trim() + ";\n}());";
|
|
3462
|
+
}
|
|
3463
|
+
return eval(str) || {};
|
|
3464
|
+
} catch (err) {
|
|
3465
|
+
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
|
3466
|
+
return parse(str, options, false);
|
|
3467
|
+
}
|
|
3468
|
+
throw new SyntaxError(err);
|
|
3469
|
+
}
|
|
3470
|
+
},
|
|
3471
|
+
stringify: function() {
|
|
3472
|
+
throw new Error("stringifying JavaScript is not supported");
|
|
208
3473
|
}
|
|
209
|
-
|
|
210
|
-
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
});
|
|
3477
|
+
|
|
3478
|
+
// ../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js
|
|
3479
|
+
var require_strip_bom_string = __commonJS({
|
|
3480
|
+
"../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
3481
|
+
"use strict";
|
|
3482
|
+
module2.exports = function(str2) {
|
|
3483
|
+
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
|
3484
|
+
return str2.slice(1);
|
|
211
3485
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
3486
|
+
return str2;
|
|
3487
|
+
};
|
|
3488
|
+
}
|
|
3489
|
+
});
|
|
3490
|
+
|
|
3491
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js
|
|
3492
|
+
var require_utils = __commonJS({
|
|
3493
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
3494
|
+
"use strict";
|
|
3495
|
+
var stripBom = require_strip_bom_string();
|
|
3496
|
+
var typeOf = require_kind_of();
|
|
3497
|
+
exports2.define = function(obj, key, val) {
|
|
3498
|
+
Reflect.defineProperty(obj, key, {
|
|
3499
|
+
enumerable: false,
|
|
3500
|
+
configurable: true,
|
|
3501
|
+
writable: true,
|
|
3502
|
+
value: val
|
|
3503
|
+
});
|
|
3504
|
+
};
|
|
3505
|
+
exports2.isBuffer = function(val) {
|
|
3506
|
+
return typeOf(val) === "buffer";
|
|
3507
|
+
};
|
|
3508
|
+
exports2.isObject = function(val) {
|
|
3509
|
+
return typeOf(val) === "object";
|
|
3510
|
+
};
|
|
3511
|
+
exports2.toBuffer = function(input) {
|
|
3512
|
+
return typeof input === "string" ? Buffer.from(input) : input;
|
|
3513
|
+
};
|
|
3514
|
+
exports2.toString = function(input) {
|
|
3515
|
+
if (exports2.isBuffer(input)) return stripBom(String(input));
|
|
3516
|
+
if (typeof input !== "string") {
|
|
3517
|
+
throw new TypeError("expected input to be a string or buffer");
|
|
215
3518
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
3519
|
+
return stripBom(input);
|
|
3520
|
+
};
|
|
3521
|
+
exports2.arrayify = function(val) {
|
|
3522
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
3523
|
+
};
|
|
3524
|
+
exports2.startsWith = function(str2, substr, len) {
|
|
3525
|
+
if (typeof len !== "number") len = substr.length;
|
|
3526
|
+
return str2.slice(0, len) === substr;
|
|
3527
|
+
};
|
|
3528
|
+
}
|
|
3529
|
+
});
|
|
3530
|
+
|
|
3531
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js
|
|
3532
|
+
var require_defaults = __commonJS({
|
|
3533
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
3534
|
+
"use strict";
|
|
3535
|
+
var engines2 = require_engines();
|
|
3536
|
+
var utils = require_utils();
|
|
3537
|
+
module2.exports = function(options2) {
|
|
3538
|
+
const opts = Object.assign({}, options2);
|
|
3539
|
+
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---");
|
|
3540
|
+
if (opts.delimiters.length === 1) {
|
|
3541
|
+
opts.delimiters.push(opts.delimiters[0]);
|
|
3542
|
+
}
|
|
3543
|
+
opts.language = (opts.language || opts.lang || "yaml").toLowerCase();
|
|
3544
|
+
opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines);
|
|
3545
|
+
return opts;
|
|
3546
|
+
};
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3549
|
+
|
|
3550
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js
|
|
3551
|
+
var require_engine = __commonJS({
|
|
3552
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
3553
|
+
"use strict";
|
|
3554
|
+
module2.exports = function(name, options2) {
|
|
3555
|
+
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
3556
|
+
if (typeof engine === "undefined") {
|
|
3557
|
+
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
220
3558
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.ensureInitialized();
|
|
224
|
-
agent.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
225
|
-
this.agents.set(agent.id, agent);
|
|
226
|
-
this.persistAgents();
|
|
3559
|
+
if (typeof engine === "function") {
|
|
3560
|
+
engine = { parse: engine };
|
|
227
3561
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
3562
|
+
return engine;
|
|
3563
|
+
};
|
|
3564
|
+
function aliase(name) {
|
|
3565
|
+
switch (name.toLowerCase()) {
|
|
3566
|
+
case "js":
|
|
3567
|
+
case "javascript":
|
|
3568
|
+
return "javascript";
|
|
3569
|
+
case "coffee":
|
|
3570
|
+
case "coffeescript":
|
|
3571
|
+
case "cson":
|
|
3572
|
+
return "coffee";
|
|
3573
|
+
case "yaml":
|
|
3574
|
+
case "yml":
|
|
3575
|
+
return "yaml";
|
|
3576
|
+
default: {
|
|
3577
|
+
return name;
|
|
3578
|
+
}
|
|
231
3579
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
});
|
|
3583
|
+
|
|
3584
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js
|
|
3585
|
+
var require_stringify = __commonJS({
|
|
3586
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
3587
|
+
"use strict";
|
|
3588
|
+
var typeOf = require_kind_of();
|
|
3589
|
+
var getEngine = require_engine();
|
|
3590
|
+
var defaults = require_defaults();
|
|
3591
|
+
module2.exports = function(file, data, options2) {
|
|
3592
|
+
if (data == null && options2 == null) {
|
|
3593
|
+
switch (typeOf(file)) {
|
|
3594
|
+
case "object":
|
|
3595
|
+
data = file.data;
|
|
3596
|
+
options2 = {};
|
|
3597
|
+
break;
|
|
3598
|
+
case "string":
|
|
3599
|
+
return file;
|
|
3600
|
+
default: {
|
|
3601
|
+
throw new TypeError("expected file to be a string or object");
|
|
237
3602
|
}
|
|
238
3603
|
}
|
|
239
|
-
return null;
|
|
240
3604
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
if (options?.status) {
|
|
248
|
-
agents = agents.filter((a) => a.governance.status === options.status);
|
|
249
|
-
}
|
|
250
|
-
if (options?.risk_level) {
|
|
251
|
-
agents = agents.filter((a) => a.governance.risk_level === options.risk_level);
|
|
252
|
-
}
|
|
253
|
-
if (options?.owner) {
|
|
254
|
-
agents = agents.filter((a) => a.owner === options.owner);
|
|
255
|
-
}
|
|
256
|
-
if (options?.team) {
|
|
257
|
-
agents = agents.filter((a) => a.team === options.team);
|
|
258
|
-
}
|
|
259
|
-
const offset = options?.offset ?? 0;
|
|
260
|
-
const limit = options?.limit ?? 100;
|
|
261
|
-
return agents.slice(offset, offset + limit);
|
|
3605
|
+
const str2 = file.content;
|
|
3606
|
+
const opts = defaults(options2);
|
|
3607
|
+
if (data == null) {
|
|
3608
|
+
if (!opts.data) return file;
|
|
3609
|
+
data = opts.data;
|
|
262
3610
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
this.agents.delete(id);
|
|
269
|
-
this.persistAgents();
|
|
3611
|
+
const language = file.language || opts.language;
|
|
3612
|
+
const engine = getEngine(language, opts);
|
|
3613
|
+
if (typeof engine.stringify !== "function") {
|
|
3614
|
+
throw new TypeError('expected "' + language + '.stringify" to be a function');
|
|
270
3615
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
3616
|
+
data = Object.assign({}, file.data, data);
|
|
3617
|
+
const open = opts.delimiters[0];
|
|
3618
|
+
const close = opts.delimiters[1];
|
|
3619
|
+
const matter = engine.stringify(data, options2).trim();
|
|
3620
|
+
let buf = "";
|
|
3621
|
+
if (matter !== "{}") {
|
|
3622
|
+
buf = newline(open) + newline(matter) + newline(close);
|
|
274
3623
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.reports.push(report);
|
|
279
|
-
if (this.reports.length > MAX_REPORTS) {
|
|
280
|
-
this.reports = this.reports.slice(-MAX_REPORTS);
|
|
3624
|
+
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
|
3625
|
+
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
|
3626
|
+
buf += newline(file.excerpt) + newline(close);
|
|
281
3627
|
}
|
|
282
|
-
this.persistReports();
|
|
283
3628
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
3629
|
+
return buf + newline(str2);
|
|
3630
|
+
};
|
|
3631
|
+
function newline(str2) {
|
|
3632
|
+
return str2.slice(-1) !== "\n" ? str2 + "\n" : str2;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
});
|
|
3636
|
+
|
|
3637
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js
|
|
3638
|
+
var require_excerpt = __commonJS({
|
|
3639
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js"(exports2, module2) {
|
|
3640
|
+
"use strict";
|
|
3641
|
+
var defaults = require_defaults();
|
|
3642
|
+
module2.exports = function(file, options2) {
|
|
3643
|
+
const opts = defaults(options2);
|
|
3644
|
+
if (file.data == null) {
|
|
3645
|
+
file.data = {};
|
|
289
3646
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const latest = await this.getLatestScanReport();
|
|
293
|
-
if (!latest)
|
|
294
|
-
return [];
|
|
295
|
-
if (agentId) {
|
|
296
|
-
return latest.findings.filter((f) => f.agent_id === agentId);
|
|
297
|
-
}
|
|
298
|
-
return latest.findings;
|
|
3647
|
+
if (typeof opts.excerpt === "function") {
|
|
3648
|
+
return opts.excerpt(file, opts);
|
|
299
3649
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
this.events.push(...events);
|
|
304
|
-
if (this.events.length > MAX_EVENTS) {
|
|
305
|
-
this.events = this.events.slice(-MAX_EVENTS);
|
|
306
|
-
}
|
|
3650
|
+
const sep = file.data.excerpt_separator || opts.excerpt_separator;
|
|
3651
|
+
if (sep == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
3652
|
+
return file;
|
|
307
3653
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
3654
|
+
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0];
|
|
3655
|
+
const idx = file.content.indexOf(delimiter);
|
|
3656
|
+
if (idx !== -1) {
|
|
3657
|
+
file.excerpt = file.content.slice(0, idx);
|
|
311
3658
|
}
|
|
3659
|
+
return file;
|
|
312
3660
|
};
|
|
313
|
-
exports2.LocalRegistry = LocalRegistry;
|
|
314
3661
|
}
|
|
315
3662
|
});
|
|
316
3663
|
|
|
317
|
-
//
|
|
318
|
-
var
|
|
319
|
-
"
|
|
3664
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js
|
|
3665
|
+
var require_to_file = __commonJS({
|
|
3666
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js"(exports2, module2) {
|
|
320
3667
|
"use strict";
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
3668
|
+
var typeOf = require_kind_of();
|
|
3669
|
+
var stringify = require_stringify();
|
|
3670
|
+
var utils = require_utils();
|
|
3671
|
+
module2.exports = function(file) {
|
|
3672
|
+
if (typeOf(file) !== "object") {
|
|
3673
|
+
file = { content: file };
|
|
3674
|
+
}
|
|
3675
|
+
if (typeOf(file.data) !== "object") {
|
|
3676
|
+
file.data = {};
|
|
3677
|
+
}
|
|
3678
|
+
if (file.contents && file.content == null) {
|
|
3679
|
+
file.content = file.contents;
|
|
3680
|
+
}
|
|
3681
|
+
utils.define(file, "orig", utils.toBuffer(file.content));
|
|
3682
|
+
utils.define(file, "language", file.language || "");
|
|
3683
|
+
utils.define(file, "matter", file.matter || "");
|
|
3684
|
+
utils.define(file, "stringify", function(data, options2) {
|
|
3685
|
+
if (options2 && options2.language) {
|
|
3686
|
+
file.language = options2.language;
|
|
3687
|
+
}
|
|
3688
|
+
return stringify(file, data, options2);
|
|
3689
|
+
});
|
|
3690
|
+
file.content = utils.toString(file.content);
|
|
3691
|
+
file.isEmpty = false;
|
|
3692
|
+
file.excerpt = "";
|
|
3693
|
+
return file;
|
|
3694
|
+
};
|
|
3695
|
+
}
|
|
3696
|
+
});
|
|
3697
|
+
|
|
3698
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js
|
|
3699
|
+
var require_parse = __commonJS({
|
|
3700
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
|
3701
|
+
"use strict";
|
|
3702
|
+
var getEngine = require_engine();
|
|
3703
|
+
var defaults = require_defaults();
|
|
3704
|
+
module2.exports = function(language, str2, options2) {
|
|
3705
|
+
const opts = defaults(options2);
|
|
3706
|
+
const engine = getEngine(language, opts);
|
|
3707
|
+
if (typeof engine.parse !== "function") {
|
|
3708
|
+
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
3709
|
+
}
|
|
3710
|
+
return engine.parse(str2, opts);
|
|
3711
|
+
};
|
|
3712
|
+
}
|
|
3713
|
+
});
|
|
3714
|
+
|
|
3715
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
|
|
3716
|
+
var require_gray_matter = __commonJS({
|
|
3717
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
3718
|
+
"use strict";
|
|
3719
|
+
var fs = require("fs");
|
|
3720
|
+
var sections = require_section_matter();
|
|
3721
|
+
var defaults = require_defaults();
|
|
3722
|
+
var stringify = require_stringify();
|
|
3723
|
+
var excerpt = require_excerpt();
|
|
3724
|
+
var engines2 = require_engines();
|
|
3725
|
+
var toFile = require_to_file();
|
|
3726
|
+
var parse2 = require_parse();
|
|
3727
|
+
var utils = require_utils();
|
|
3728
|
+
function matter(input, options2) {
|
|
3729
|
+
if (input === "") {
|
|
3730
|
+
return { data: {}, content: input, excerpt: "", orig: input };
|
|
3731
|
+
}
|
|
3732
|
+
let file = toFile(input);
|
|
3733
|
+
const cached = matter.cache[file.content];
|
|
3734
|
+
if (!options2) {
|
|
3735
|
+
if (cached) {
|
|
3736
|
+
file = Object.assign({}, cached);
|
|
3737
|
+
file.orig = cached.orig;
|
|
3738
|
+
return file;
|
|
3739
|
+
}
|
|
3740
|
+
matter.cache[file.content] = file;
|
|
3741
|
+
}
|
|
3742
|
+
return parseMatter(file, options2);
|
|
3743
|
+
}
|
|
3744
|
+
function parseMatter(file, options2) {
|
|
3745
|
+
const opts = defaults(options2);
|
|
3746
|
+
const open = opts.delimiters[0];
|
|
3747
|
+
const close = "\n" + opts.delimiters[1];
|
|
3748
|
+
let str2 = file.content;
|
|
3749
|
+
if (opts.language) {
|
|
3750
|
+
file.language = opts.language;
|
|
3751
|
+
}
|
|
3752
|
+
const openLen = open.length;
|
|
3753
|
+
if (!utils.startsWith(str2, open, openLen)) {
|
|
3754
|
+
excerpt(file, opts);
|
|
3755
|
+
return file;
|
|
3756
|
+
}
|
|
3757
|
+
if (str2.charAt(openLen) === open.slice(-1)) {
|
|
3758
|
+
return file;
|
|
3759
|
+
}
|
|
3760
|
+
str2 = str2.slice(openLen);
|
|
3761
|
+
const len = str2.length;
|
|
3762
|
+
const language = matter.language(str2, opts);
|
|
3763
|
+
if (language.name) {
|
|
3764
|
+
file.language = language.name;
|
|
3765
|
+
str2 = str2.slice(language.raw.length);
|
|
3766
|
+
}
|
|
3767
|
+
let closeIndex = str2.indexOf(close);
|
|
3768
|
+
if (closeIndex === -1) {
|
|
3769
|
+
closeIndex = len;
|
|
3770
|
+
}
|
|
3771
|
+
file.matter = str2.slice(0, closeIndex);
|
|
3772
|
+
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
|
3773
|
+
if (block === "") {
|
|
3774
|
+
file.isEmpty = true;
|
|
3775
|
+
file.empty = file.content;
|
|
3776
|
+
file.data = {};
|
|
3777
|
+
} else {
|
|
3778
|
+
file.data = parse2(file.language, file.matter, opts);
|
|
328
3779
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
3780
|
+
if (closeIndex === len) {
|
|
3781
|
+
file.content = "";
|
|
3782
|
+
} else {
|
|
3783
|
+
file.content = str2.slice(closeIndex + close.length);
|
|
3784
|
+
if (file.content[0] === "\r") {
|
|
3785
|
+
file.content = file.content.slice(1);
|
|
3786
|
+
}
|
|
3787
|
+
if (file.content[0] === "\n") {
|
|
3788
|
+
file.content = file.content.slice(1);
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
excerpt(file, opts);
|
|
3792
|
+
if (opts.sections === true || typeof opts.section === "function") {
|
|
3793
|
+
sections(file, opts.section);
|
|
3794
|
+
}
|
|
3795
|
+
return file;
|
|
3796
|
+
}
|
|
3797
|
+
matter.engines = engines2;
|
|
3798
|
+
matter.stringify = function(file, data, options2) {
|
|
3799
|
+
if (typeof file === "string") file = matter(file, options2);
|
|
3800
|
+
return stringify(file, data, options2);
|
|
336
3801
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
return
|
|
345
|
-
}
|
|
3802
|
+
matter.read = function(filepath, options2) {
|
|
3803
|
+
const str2 = fs.readFileSync(filepath, "utf8");
|
|
3804
|
+
const file = matter(str2, options2);
|
|
3805
|
+
file.path = filepath;
|
|
3806
|
+
return file;
|
|
3807
|
+
};
|
|
3808
|
+
matter.test = function(str2, options2) {
|
|
3809
|
+
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
|
3810
|
+
};
|
|
3811
|
+
matter.language = function(str2, options2) {
|
|
3812
|
+
const opts = defaults(options2);
|
|
3813
|
+
const open = opts.delimiters[0];
|
|
3814
|
+
if (matter.test(str2)) {
|
|
3815
|
+
str2 = str2.slice(open.length);
|
|
3816
|
+
}
|
|
3817
|
+
const language = str2.slice(0, str2.search(/\r?\n/));
|
|
3818
|
+
return {
|
|
3819
|
+
raw: language,
|
|
3820
|
+
name: language ? language.trim() : ""
|
|
3821
|
+
};
|
|
3822
|
+
};
|
|
3823
|
+
matter.cache = {};
|
|
3824
|
+
matter.clearCache = function() {
|
|
3825
|
+
matter.cache = {};
|
|
3826
|
+
};
|
|
3827
|
+
module2.exports = matter;
|
|
346
3828
|
}
|
|
347
3829
|
});
|
|
348
3830
|
|
|
349
|
-
//
|
|
3831
|
+
// ../parsers/dist/claude-code.js
|
|
350
3832
|
var require_claude_code = __commonJS({
|
|
351
|
-
"
|
|
3833
|
+
"../parsers/dist/claude-code.js"(exports2) {
|
|
352
3834
|
"use strict";
|
|
353
3835
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
354
3836
|
if (k2 === void 0) k2 = k;
|
|
@@ -394,7 +3876,7 @@ var require_claude_code = __commonJS({
|
|
|
394
3876
|
exports2.ClaudeCodeParser = void 0;
|
|
395
3877
|
var fs = __importStar2(require("fs"));
|
|
396
3878
|
var path = __importStar2(require("path"));
|
|
397
|
-
var gray_matter_1 = __importDefault(
|
|
3879
|
+
var gray_matter_1 = __importDefault(require_gray_matter());
|
|
398
3880
|
var core_1 = require_dist();
|
|
399
3881
|
function safeReadFile(filePath) {
|
|
400
3882
|
try {
|
|
@@ -624,9 +4106,9 @@ var require_claude_code = __commonJS({
|
|
|
624
4106
|
}
|
|
625
4107
|
});
|
|
626
4108
|
|
|
627
|
-
//
|
|
4109
|
+
// ../parsers/dist/cursor.js
|
|
628
4110
|
var require_cursor = __commonJS({
|
|
629
|
-
"
|
|
4111
|
+
"../parsers/dist/cursor.js"(exports2) {
|
|
630
4112
|
"use strict";
|
|
631
4113
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
632
4114
|
if (k2 === void 0) k2 = k;
|
|
@@ -672,7 +4154,7 @@ var require_cursor = __commonJS({
|
|
|
672
4154
|
exports2.CursorParser = void 0;
|
|
673
4155
|
var fs = __importStar2(require("fs"));
|
|
674
4156
|
var path = __importStar2(require("path"));
|
|
675
|
-
var gray_matter_1 = __importDefault(
|
|
4157
|
+
var gray_matter_1 = __importDefault(require_gray_matter());
|
|
676
4158
|
var core_1 = require_dist();
|
|
677
4159
|
function safeReadFile(filePath) {
|
|
678
4160
|
try {
|
|
@@ -785,9 +4267,9 @@ var require_cursor = __commonJS({
|
|
|
785
4267
|
}
|
|
786
4268
|
});
|
|
787
4269
|
|
|
788
|
-
//
|
|
4270
|
+
// ../parsers/dist/codex.js
|
|
789
4271
|
var require_codex = __commonJS({
|
|
790
|
-
"
|
|
4272
|
+
"../parsers/dist/codex.js"(exports2) {
|
|
791
4273
|
"use strict";
|
|
792
4274
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
793
4275
|
if (k2 === void 0) k2 = k;
|
|
@@ -833,7 +4315,7 @@ var require_codex = __commonJS({
|
|
|
833
4315
|
exports2.CodexParser = void 0;
|
|
834
4316
|
var fs = __importStar2(require("fs"));
|
|
835
4317
|
var path = __importStar2(require("path"));
|
|
836
|
-
var gray_matter_1 = __importDefault(
|
|
4318
|
+
var gray_matter_1 = __importDefault(require_gray_matter());
|
|
837
4319
|
var core_1 = require_dist();
|
|
838
4320
|
function safeReadFile(filePath) {
|
|
839
4321
|
try {
|
|
@@ -959,9 +4441,9 @@ var require_codex = __commonJS({
|
|
|
959
4441
|
}
|
|
960
4442
|
});
|
|
961
4443
|
|
|
962
|
-
//
|
|
4444
|
+
// ../parsers/dist/langchain.js
|
|
963
4445
|
var require_langchain = __commonJS({
|
|
964
|
-
"
|
|
4446
|
+
"../parsers/dist/langchain.js"(exports2) {
|
|
965
4447
|
"use strict";
|
|
966
4448
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
967
4449
|
if (k2 === void 0) k2 = k;
|
|
@@ -1164,9 +4646,9 @@ var require_langchain = __commonJS({
|
|
|
1164
4646
|
}
|
|
1165
4647
|
});
|
|
1166
4648
|
|
|
1167
|
-
//
|
|
4649
|
+
// ../parsers/dist/crewai.js
|
|
1168
4650
|
var require_crewai = __commonJS({
|
|
1169
|
-
"
|
|
4651
|
+
"../parsers/dist/crewai.js"(exports2) {
|
|
1170
4652
|
"use strict";
|
|
1171
4653
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1172
4654
|
if (k2 === void 0) k2 = k;
|
|
@@ -1398,9 +4880,9 @@ var require_crewai = __commonJS({
|
|
|
1398
4880
|
}
|
|
1399
4881
|
});
|
|
1400
4882
|
|
|
1401
|
-
//
|
|
4883
|
+
// ../parsers/dist/kiro.js
|
|
1402
4884
|
var require_kiro = __commonJS({
|
|
1403
|
-
"
|
|
4885
|
+
"../parsers/dist/kiro.js"(exports2) {
|
|
1404
4886
|
"use strict";
|
|
1405
4887
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1406
4888
|
if (k2 === void 0) k2 = k;
|
|
@@ -1446,7 +4928,7 @@ var require_kiro = __commonJS({
|
|
|
1446
4928
|
exports2.KiroParser = void 0;
|
|
1447
4929
|
var fs = __importStar2(require("fs"));
|
|
1448
4930
|
var path = __importStar2(require("path"));
|
|
1449
|
-
var gray_matter_1 = __importDefault(
|
|
4931
|
+
var gray_matter_1 = __importDefault(require_gray_matter());
|
|
1450
4932
|
var core_1 = require_dist();
|
|
1451
4933
|
function safeReadFile(filePath) {
|
|
1452
4934
|
try {
|
|
@@ -1527,9 +5009,9 @@ var require_kiro = __commonJS({
|
|
|
1527
5009
|
}
|
|
1528
5010
|
});
|
|
1529
5011
|
|
|
1530
|
-
//
|
|
5012
|
+
// ../parsers/dist/auto-detect.js
|
|
1531
5013
|
var require_auto_detect = __commonJS({
|
|
1532
|
-
"
|
|
5014
|
+
"../parsers/dist/auto-detect.js"(exports2) {
|
|
1533
5015
|
"use strict";
|
|
1534
5016
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1535
5017
|
exports2.detectFrameworks = detectFrameworks;
|
|
@@ -1583,9 +5065,9 @@ var require_auto_detect = __commonJS({
|
|
|
1583
5065
|
}
|
|
1584
5066
|
});
|
|
1585
5067
|
|
|
1586
|
-
//
|
|
5068
|
+
// ../parsers/dist/index.js
|
|
1587
5069
|
var require_dist2 = __commonJS({
|
|
1588
|
-
"
|
|
5070
|
+
"../parsers/dist/index.js"(exports2) {
|
|
1589
5071
|
"use strict";
|
|
1590
5072
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1591
5073
|
exports2.parseAll = exports2.detectFrameworks = exports2.KiroParser = exports2.CrewAIParser = exports2.LangChainParser = exports2.CodexParser = exports2.CursorParser = exports2.ClaudeCodeParser = void 0;
|
|
@@ -1623,9 +5105,9 @@ var require_dist2 = __commonJS({
|
|
|
1623
5105
|
}
|
|
1624
5106
|
});
|
|
1625
5107
|
|
|
1626
|
-
//
|
|
5108
|
+
// ../scanner/dist/rules/interface.js
|
|
1627
5109
|
var require_interface = __commonJS({
|
|
1628
|
-
"
|
|
5110
|
+
"../scanner/dist/rules/interface.js"(exports2) {
|
|
1629
5111
|
"use strict";
|
|
1630
5112
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1631
5113
|
exports2.createEnterpriseFinding = createEnterpriseFinding;
|
|
@@ -1699,9 +5181,9 @@ var require_interface = __commonJS({
|
|
|
1699
5181
|
}
|
|
1700
5182
|
});
|
|
1701
5183
|
|
|
1702
|
-
//
|
|
5184
|
+
// ../scanner/dist/rules/prompt-injection.js
|
|
1703
5185
|
var require_prompt_injection = __commonJS({
|
|
1704
|
-
"
|
|
5186
|
+
"../scanner/dist/rules/prompt-injection.js"(exports2) {
|
|
1705
5187
|
"use strict";
|
|
1706
5188
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1707
5189
|
exports2.PROMPT_INJECTION_RULES = exports2.longContextWithoutSummarization = exports2.noOutputValidation = exports2.sensitiveDataInPrompts = exports2.noSystemPrompt = void 0;
|
|
@@ -1856,9 +5338,9 @@ var require_prompt_injection = __commonJS({
|
|
|
1856
5338
|
}
|
|
1857
5339
|
});
|
|
1858
5340
|
|
|
1859
|
-
//
|
|
5341
|
+
// ../scanner/dist/rules/access-control.js
|
|
1860
5342
|
var require_access_control = __commonJS({
|
|
1861
|
-
"
|
|
5343
|
+
"../scanner/dist/rules/access-control.js"(exports2) {
|
|
1862
5344
|
"use strict";
|
|
1863
5345
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1864
5346
|
exports2.ACCESS_CONTROL_RULES = exports2.noOwner = exports2.privilegeEscalation = exports2.noHumanInTheLoop = exports2.excessivePermissions = exports2.hardcodedCredentials = void 0;
|
|
@@ -2063,9 +5545,9 @@ var require_access_control = __commonJS({
|
|
|
2063
5545
|
}
|
|
2064
5546
|
});
|
|
2065
5547
|
|
|
2066
|
-
//
|
|
5548
|
+
// ../scanner/dist/rules/supply-chain.js
|
|
2067
5549
|
var require_supply_chain = __commonJS({
|
|
2068
|
-
"
|
|
5550
|
+
"../scanner/dist/rules/supply-chain.js"(exports2) {
|
|
2069
5551
|
"use strict";
|
|
2070
5552
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2071
5553
|
exports2.SUPPLY_CHAIN_RULES = exports2.langchainPassthrough = exports2.configInPublicRepo = exports2.frameworkCVE = exports2.mcpNoAuth = exports2.toolDescriptionPoisoning = exports2.mcpNoIntegrity = void 0;
|
|
@@ -2328,9 +5810,9 @@ var require_supply_chain = __commonJS({
|
|
|
2328
5810
|
}
|
|
2329
5811
|
});
|
|
2330
5812
|
|
|
2331
|
-
//
|
|
5813
|
+
// ../scanner/dist/rules/data-governance.js
|
|
2332
5814
|
var require_data_governance = __commonJS({
|
|
2333
|
-
"
|
|
5815
|
+
"../scanner/dist/rules/data-governance.js"(exports2) {
|
|
2334
5816
|
"use strict";
|
|
2335
5817
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2336
5818
|
exports2.DATA_GOVERNANCE_RULES = exports2.unrestrrictedFileWrite = exports2.crossEnvironmentAccess = exports2.noDataClassification = void 0;
|
|
@@ -2434,9 +5916,9 @@ var require_data_governance = __commonJS({
|
|
|
2434
5916
|
}
|
|
2435
5917
|
});
|
|
2436
5918
|
|
|
2437
|
-
//
|
|
5919
|
+
// ../scanner/dist/rules/cost-governance.js
|
|
2438
5920
|
var require_cost_governance = __commonJS({
|
|
2439
|
-
"
|
|
5921
|
+
"../scanner/dist/rules/cost-governance.js"(exports2) {
|
|
2440
5922
|
"use strict";
|
|
2441
5923
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2442
5924
|
exports2.COST_GOVERNANCE_RULES = exports2.noCostAttribution = exports2.expensiveModelForSimpleTasks = exports2.noTimeout = exports2.noIterationLimit = exports2.noTokenBudget = void 0;
|
|
@@ -2580,9 +6062,9 @@ var require_cost_governance = __commonJS({
|
|
|
2580
6062
|
}
|
|
2581
6063
|
});
|
|
2582
6064
|
|
|
2583
|
-
//
|
|
6065
|
+
// ../scanner/dist/rules/framework-config.js
|
|
2584
6066
|
var require_framework_config = __commonJS({
|
|
2585
|
-
"
|
|
6067
|
+
"../scanner/dist/rules/framework-config.js"(exports2) {
|
|
2586
6068
|
"use strict";
|
|
2587
6069
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2588
6070
|
exports2.FRAMEWORK_CONFIG_RULES = exports2.cursorAlwaysApplyBroadGlob = exports2.codexFullAutoMode = exports2.noDescription = exports2.unrestrictedDelegation = exports2.unsafeDeserialization = exports2.gitHookBypass = exports2.wildcardBashPermissions = exports2.dangerouslySkipPermissions = void 0;
|
|
@@ -2920,9 +6402,9 @@ var require_framework_config = __commonJS({
|
|
|
2920
6402
|
}
|
|
2921
6403
|
});
|
|
2922
6404
|
|
|
2923
|
-
//
|
|
6405
|
+
// ../scanner/dist/rules/multi-agent.js
|
|
2924
6406
|
var require_multi_agent = __commonJS({
|
|
2925
|
-
"
|
|
6407
|
+
"../scanner/dist/rules/multi-agent.js"(exports2) {
|
|
2926
6408
|
"use strict";
|
|
2927
6409
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2928
6410
|
exports2.MULTI_AGENT_RULES = exports2.multiFrameworkConfigDrift = exports2.crewaiHierarchicalNoLimits = exports2.noOutputValidationBetweenAgents = exports2.privilegeEscalationViaDelegate = exports2.noDelegationDepthLimit = void 0;
|
|
@@ -3143,9 +6625,9 @@ var require_multi_agent = __commonJS({
|
|
|
3143
6625
|
}
|
|
3144
6626
|
});
|
|
3145
6627
|
|
|
3146
|
-
//
|
|
6628
|
+
// ../scanner/dist/rules/audit-logging.js
|
|
3147
6629
|
var require_audit_logging = __commonJS({
|
|
3148
|
-
"
|
|
6630
|
+
"../scanner/dist/rules/audit-logging.js"(exports2) {
|
|
3149
6631
|
"use strict";
|
|
3150
6632
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3151
6633
|
exports2.AUDIT_LOGGING_RULES = exports2.sensitiveDataInLogs = exports2.noSIEMIntegration = exports2.noAuditLogging = void 0;
|
|
@@ -3242,9 +6724,9 @@ var require_audit_logging = __commonJS({
|
|
|
3242
6724
|
}
|
|
3243
6725
|
});
|
|
3244
6726
|
|
|
3245
|
-
//
|
|
6727
|
+
// ../scanner/dist/rules/compliance-docs.js
|
|
3246
6728
|
var require_compliance_docs = __commonJS({
|
|
3247
|
-
"
|
|
6729
|
+
"../scanner/dist/rules/compliance-docs.js"(exports2) {
|
|
3248
6730
|
"use strict";
|
|
3249
6731
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3250
6732
|
if (k2 === void 0) k2 = k;
|
|
@@ -3438,9 +6920,9 @@ var require_compliance_docs = __commonJS({
|
|
|
3438
6920
|
}
|
|
3439
6921
|
});
|
|
3440
6922
|
|
|
3441
|
-
//
|
|
6923
|
+
// ../scanner/dist/rules/network-security.js
|
|
3442
6924
|
var require_network_security = __commonJS({
|
|
3443
|
-
"
|
|
6925
|
+
"../scanner/dist/rules/network-security.js"(exports2) {
|
|
3444
6926
|
"use strict";
|
|
3445
6927
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3446
6928
|
exports2.NETWORK_SECURITY_RULES = exports2.unencryptedMCPTransport = exports2.noSandboxing = exports2.unrestrictedNetworkAccess = void 0;
|
|
@@ -3545,9 +7027,9 @@ var require_network_security = __commonJS({
|
|
|
3545
7027
|
}
|
|
3546
7028
|
});
|
|
3547
7029
|
|
|
3548
|
-
//
|
|
7030
|
+
// ../scanner/dist/rules/index.js
|
|
3549
7031
|
var require_rules = __commonJS({
|
|
3550
|
-
"
|
|
7032
|
+
"../scanner/dist/rules/index.js"(exports2) {
|
|
3551
7033
|
"use strict";
|
|
3552
7034
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3553
7035
|
exports2.createEnterpriseFinding = exports2.BUILT_IN_RULES = void 0;
|
|
@@ -3629,9 +7111,9 @@ var require_rules = __commonJS({
|
|
|
3629
7111
|
}
|
|
3630
7112
|
});
|
|
3631
7113
|
|
|
3632
|
-
//
|
|
3633
|
-
var
|
|
3634
|
-
"
|
|
7114
|
+
// ../scanner/dist/engine.js
|
|
7115
|
+
var require_engine2 = __commonJS({
|
|
7116
|
+
"../scanner/dist/engine.js"(exports2) {
|
|
3635
7117
|
"use strict";
|
|
3636
7118
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3637
7119
|
if (k2 === void 0) k2 = k;
|
|
@@ -3683,9 +7165,9 @@ var require_engine = __commonJS({
|
|
|
3683
7165
|
"low",
|
|
3684
7166
|
"info"
|
|
3685
7167
|
];
|
|
3686
|
-
async function scan(
|
|
7168
|
+
async function scan(options2) {
|
|
3687
7169
|
const startTime = Date.now();
|
|
3688
|
-
const rootDir = path.resolve(
|
|
7170
|
+
const rootDir = path.resolve(options2.rootDir);
|
|
3689
7171
|
const fs = await Promise.resolve().then(() => __importStar2(require("fs")));
|
|
3690
7172
|
if (!fs.existsSync(rootDir)) {
|
|
3691
7173
|
throw new Error(`Directory not found: ${rootDir}`);
|
|
@@ -3701,17 +7183,17 @@ var require_engine = __commonJS({
|
|
|
3701
7183
|
root_dir: rootDir
|
|
3702
7184
|
};
|
|
3703
7185
|
let rules = [...index_1.BUILT_IN_RULES];
|
|
3704
|
-
if (
|
|
3705
|
-
const requestedIds = new Set(
|
|
7186
|
+
if (options2.rules && options2.rules.length > 0) {
|
|
7187
|
+
const requestedIds = new Set(options2.rules);
|
|
3706
7188
|
rules = rules.filter((r) => requestedIds.has(r.id));
|
|
3707
7189
|
if (rules.length === 0) {
|
|
3708
|
-
parseResult.warnings.push(`No matching rules found for IDs: ${
|
|
7190
|
+
parseResult.warnings.push(`No matching rules found for IDs: ${options2.rules.join(", ")}. Available rule IDs: ${index_1.BUILT_IN_RULES.map((r) => r.id).join(", ")}`);
|
|
3709
7191
|
}
|
|
3710
7192
|
}
|
|
3711
|
-
if (
|
|
3712
|
-
const minIdx = SEVERITY_ORDER.indexOf(
|
|
7193
|
+
if (options2.minSeverity) {
|
|
7194
|
+
const minIdx = SEVERITY_ORDER.indexOf(options2.minSeverity);
|
|
3713
7195
|
if (minIdx === -1) {
|
|
3714
|
-
parseResult.warnings.push(`Invalid severity: "${
|
|
7196
|
+
parseResult.warnings.push(`Invalid severity: "${options2.minSeverity}". Valid values: ${SEVERITY_ORDER.join(", ")}`);
|
|
3715
7197
|
} else {
|
|
3716
7198
|
rules = rules.filter((r) => {
|
|
3717
7199
|
const ruleIdx = SEVERITY_ORDER.indexOf(r.severity);
|
|
@@ -3741,7 +7223,7 @@ var require_engine = __commonJS({
|
|
|
3741
7223
|
});
|
|
3742
7224
|
const durationMs = Date.now() - startTime;
|
|
3743
7225
|
const report = (0, core_1.createScanReport)(rootDir, allFindings, parseResult.frameworks, parseResult.agents.length, durationMs);
|
|
3744
|
-
if (
|
|
7226
|
+
if (options2.updateRegistry !== false) {
|
|
3745
7227
|
try {
|
|
3746
7228
|
const registry2 = new core_1.LocalRegistry(rootDir);
|
|
3747
7229
|
await registry2.initialize();
|
|
@@ -3783,9 +7265,9 @@ var require_engine = __commonJS({
|
|
|
3783
7265
|
}
|
|
3784
7266
|
});
|
|
3785
7267
|
|
|
3786
|
-
//
|
|
7268
|
+
// ../scanner/dist/reporter.js
|
|
3787
7269
|
var require_reporter = __commonJS({
|
|
3788
|
-
"
|
|
7270
|
+
"../scanner/dist/reporter.js"(exports2) {
|
|
3789
7271
|
"use strict";
|
|
3790
7272
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3791
7273
|
exports2.formatTerminal = formatTerminal;
|
|
@@ -4018,9 +7500,9 @@ Recommendation: ${finding.recommendation}`
|
|
|
4018
7500
|
}
|
|
4019
7501
|
});
|
|
4020
7502
|
|
|
4021
|
-
//
|
|
7503
|
+
// ../scanner/dist/suppression.js
|
|
4022
7504
|
var require_suppression = __commonJS({
|
|
4023
|
-
"
|
|
7505
|
+
"../scanner/dist/suppression.js"(exports2) {
|
|
4024
7506
|
"use strict";
|
|
4025
7507
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4026
7508
|
if (k2 === void 0) k2 = k;
|
|
@@ -4181,7 +7663,7 @@ var require_suppression = __commonJS({
|
|
|
4181
7663
|
}
|
|
4182
7664
|
return policy;
|
|
4183
7665
|
}
|
|
4184
|
-
function applySuppressions(findings, configFiles, rootDir,
|
|
7666
|
+
function applySuppressions(findings, configFiles, rootDir, options2) {
|
|
4185
7667
|
const result = {
|
|
4186
7668
|
active: [],
|
|
4187
7669
|
suppressed: [],
|
|
@@ -4313,13 +7795,13 @@ var require_suppression = __commonJS({
|
|
|
4313
7795
|
}
|
|
4314
7796
|
});
|
|
4315
7797
|
|
|
4316
|
-
//
|
|
7798
|
+
// ../scanner/dist/index.js
|
|
4317
7799
|
var require_dist3 = __commonJS({
|
|
4318
|
-
"
|
|
7800
|
+
"../scanner/dist/index.js"(exports2) {
|
|
4319
7801
|
"use strict";
|
|
4320
7802
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4321
7803
|
exports2.PRESETS = exports2.loadPolicyFile = exports2.parseInlineSuppressions = exports2.applySuppressions = exports2.getRulesByCategory = exports2.getRuleById = exports2.BUILT_IN_RULES = exports2.formatSARIF = exports2.formatMarkdown = exports2.formatJSON = exports2.formatTerminal = exports2.scan = void 0;
|
|
4322
|
-
var engine_1 =
|
|
7804
|
+
var engine_1 = require_engine2();
|
|
4323
7805
|
Object.defineProperty(exports2, "scan", { enumerable: true, get: function() {
|
|
4324
7806
|
return engine_1.scan;
|
|
4325
7807
|
} });
|
|
@@ -4362,9 +7844,9 @@ var require_dist3 = __commonJS({
|
|
|
4362
7844
|
}
|
|
4363
7845
|
});
|
|
4364
7846
|
|
|
4365
|
-
//
|
|
7847
|
+
// dist/commands/scan.js
|
|
4366
7848
|
var require_scan = __commonJS({
|
|
4367
|
-
"
|
|
7849
|
+
"dist/commands/scan.js"(exports2) {
|
|
4368
7850
|
"use strict";
|
|
4369
7851
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4370
7852
|
if (k2 === void 0) k2 = k;
|
|
@@ -4411,7 +7893,7 @@ var require_scan = __commonJS({
|
|
|
4411
7893
|
var VALID_FORMATS = ["terminal", "json", "md", "sarif"];
|
|
4412
7894
|
var VALID_SEVERITIES = ["critical", "high", "medium", "low", "info"];
|
|
4413
7895
|
var VALID_PRESETS = ["strict", "standard", "monitor"];
|
|
4414
|
-
async function scanCommand(targetPath,
|
|
7896
|
+
async function scanCommand(targetPath, options2) {
|
|
4415
7897
|
const rootDir = path.resolve(targetPath);
|
|
4416
7898
|
if (!fs.existsSync(rootDir)) {
|
|
4417
7899
|
console.error(`
|
|
@@ -4425,32 +7907,32 @@ var require_scan = __commonJS({
|
|
|
4425
7907
|
`);
|
|
4426
7908
|
process.exit(2);
|
|
4427
7909
|
}
|
|
4428
|
-
const format =
|
|
7910
|
+
const format = options2.format;
|
|
4429
7911
|
if (!VALID_FORMATS.includes(format)) {
|
|
4430
7912
|
console.error(`
|
|
4431
|
-
\x1B[31mError:\x1B[0m Invalid format "${
|
|
7913
|
+
\x1B[31mError:\x1B[0m Invalid format "${options2.format}". Valid formats: ${VALID_FORMATS.join(", ")}
|
|
4432
7914
|
`);
|
|
4433
7915
|
process.exit(2);
|
|
4434
7916
|
}
|
|
4435
|
-
if (
|
|
7917
|
+
if (options2.minSeverity && !VALID_SEVERITIES.includes(options2.minSeverity)) {
|
|
4436
7918
|
console.error(`
|
|
4437
|
-
\x1B[31mError:\x1B[0m Invalid severity "${
|
|
7919
|
+
\x1B[31mError:\x1B[0m Invalid severity "${options2.minSeverity}". Valid values: ${VALID_SEVERITIES.join(", ")}
|
|
4438
7920
|
`);
|
|
4439
7921
|
process.exit(2);
|
|
4440
7922
|
}
|
|
4441
|
-
const preset =
|
|
7923
|
+
const preset = options2.preset ?? "standard";
|
|
4442
7924
|
if (!VALID_PRESETS.includes(preset)) {
|
|
4443
7925
|
console.error(`
|
|
4444
|
-
\x1B[31mError:\x1B[0m Invalid preset "${
|
|
7926
|
+
\x1B[31mError:\x1B[0m Invalid preset "${options2.preset}". Valid presets: ${VALID_PRESETS.join(", ")}
|
|
4445
7927
|
`);
|
|
4446
7928
|
process.exit(2);
|
|
4447
7929
|
}
|
|
4448
7930
|
try {
|
|
4449
7931
|
const result = await (0, scanner_1.scan)({
|
|
4450
7932
|
rootDir,
|
|
4451
|
-
minSeverity:
|
|
4452
|
-
rules:
|
|
4453
|
-
updateRegistry:
|
|
7933
|
+
minSeverity: options2.minSeverity,
|
|
7934
|
+
rules: options2.rules?.split(",").map((r) => r.trim()),
|
|
7935
|
+
updateRegistry: options2.registry
|
|
4454
7936
|
});
|
|
4455
7937
|
if (result.frameworks.length === 0 && format === "terminal") {
|
|
4456
7938
|
console.log(`
|
|
@@ -4473,9 +7955,9 @@ var require_scan = __commonJS({
|
|
|
4473
7955
|
return;
|
|
4474
7956
|
}
|
|
4475
7957
|
const { policy, warnings: policyWarnings } = (0, scanner_1.loadPolicyFile)(rootDir);
|
|
4476
|
-
const effectivePreset =
|
|
7958
|
+
const effectivePreset = options2.preset ? preset : policy?.preset ?? "standard";
|
|
4477
7959
|
const suppressionResult = (0, scanner_1.applySuppressions)(result.report.findings, [], rootDir);
|
|
4478
|
-
if (!
|
|
7960
|
+
if (!options2.showSuppressed) {
|
|
4479
7961
|
result.report.findings = suppressionResult.active;
|
|
4480
7962
|
result.report.summary = {
|
|
4481
7963
|
critical: result.report.findings.filter((f) => f.severity === "critical").length,
|
|
@@ -4502,7 +7984,7 @@ var require_scan = __commonJS({
|
|
|
4502
7984
|
break;
|
|
4503
7985
|
}
|
|
4504
7986
|
if (format === "terminal" && suppressionResult.suppressed.length > 0) {
|
|
4505
|
-
if (
|
|
7987
|
+
if (options2.showSuppressed) {
|
|
4506
7988
|
console.log(` \x1B[33mSuppressed findings (${suppressionResult.suppressed.length}):\x1B[0m`);
|
|
4507
7989
|
for (const { finding, suppression } of suppressionResult.suppressed) {
|
|
4508
7990
|
console.log(` \x1B[2m${finding.rule_id}\x1B[0m ${finding.title}`);
|
|
@@ -4580,9 +8062,9 @@ var require_scan = __commonJS({
|
|
|
4580
8062
|
}
|
|
4581
8063
|
});
|
|
4582
8064
|
|
|
4583
|
-
//
|
|
8065
|
+
// dist/commands/init.js
|
|
4584
8066
|
var require_init = __commonJS({
|
|
4585
|
-
"
|
|
8067
|
+
"dist/commands/init.js"(exports2) {
|
|
4586
8068
|
"use strict";
|
|
4587
8069
|
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4588
8070
|
if (k2 === void 0) k2 = k;
|
|
@@ -4706,7 +8188,7 @@ registry:
|
|
|
4706
8188
|
}
|
|
4707
8189
|
});
|
|
4708
8190
|
|
|
4709
|
-
//
|
|
8191
|
+
// dist/index.js
|
|
4710
8192
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4711
8193
|
if (k2 === void 0) k2 = k;
|
|
4712
8194
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -4753,16 +8235,16 @@ program.name("sentinelflow").description("The vendor-neutral governance layer fo
|
|
|
4753
8235
|
program.command("scan").description("Scan for AI agents and governance issues").argument("[path]", "Project directory to scan", ".").option("-f, --format <format>", "Output format: terminal, json, md, sarif", "terminal").option("--min-severity <severity>", "Minimum severity: critical, high, medium, low, info").option("--rules <rules>", "Comma-separated rule IDs to run").option("--preset <preset>", "Scan preset: strict, standard, monitor", "standard").option("--show-suppressed", "Show suppressed findings for audit review").option("--no-registry", "Skip updating the local registry").action(scan_1.scanCommand);
|
|
4754
8236
|
program.command("init").description("Initialize SentinelFlow in the current project").argument("[path]", "Project directory", ".").action(init_1.initCommand);
|
|
4755
8237
|
var registry = program.command("registry").description("Manage the agent registry");
|
|
4756
|
-
registry.command("list").description("List all registered agents").option("--framework <framework>", "Filter by framework").option("--status <status>", "Filter by governance status").option("--json", "Output as JSON").action(async (
|
|
8238
|
+
registry.command("list").description("List all registered agents").option("--framework <framework>", "Filter by framework").option("--status <status>", "Filter by governance status").option("--json", "Output as JSON").action(async (options2) => {
|
|
4757
8239
|
const path = await Promise.resolve().then(() => __importStar(require("path")));
|
|
4758
8240
|
const { LocalRegistry } = await Promise.resolve().then(() => __importStar(require_dist()));
|
|
4759
8241
|
const reg = new LocalRegistry(process.cwd());
|
|
4760
8242
|
await reg.initialize();
|
|
4761
8243
|
const agents = await reg.listAgents({
|
|
4762
|
-
framework:
|
|
4763
|
-
status:
|
|
8244
|
+
framework: options2.framework,
|
|
8245
|
+
status: options2.status
|
|
4764
8246
|
});
|
|
4765
|
-
if (
|
|
8247
|
+
if (options2.json) {
|
|
4766
8248
|
console.log(JSON.stringify(agents, null, 2));
|
|
4767
8249
|
} else {
|
|
4768
8250
|
if (agents.length === 0) {
|
|
@@ -4782,3 +8264,21 @@ registry.command("list").description("List all registered agents").option("--fra
|
|
|
4782
8264
|
await reg.close();
|
|
4783
8265
|
});
|
|
4784
8266
|
program.parse();
|
|
8267
|
+
/*! Bundled license information:
|
|
8268
|
+
|
|
8269
|
+
is-extendable/index.js:
|
|
8270
|
+
(*!
|
|
8271
|
+
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
8272
|
+
*
|
|
8273
|
+
* Copyright (c) 2015, Jon Schlinkert.
|
|
8274
|
+
* Licensed under the MIT License.
|
|
8275
|
+
*)
|
|
8276
|
+
|
|
8277
|
+
strip-bom-string/index.js:
|
|
8278
|
+
(*!
|
|
8279
|
+
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
8280
|
+
*
|
|
8281
|
+
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
8282
|
+
* Released under the MIT License.
|
|
8283
|
+
*)
|
|
8284
|
+
*/
|