@kubb/agent 4.33.5 → 4.35.0
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +409 -4248
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +3 -1
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +3 -1
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@stoplight/ordered-object-literal/package.json +53 -0
- package/.output/server/node_modules/@stoplight/ordered-object-literal/src/index.cjs +221 -0
- package/.output/server/node_modules/@stoplight/types/dist/index.js +129 -0
- package/.output/server/node_modules/@stoplight/types/package.json +81 -0
- package/.output/server/node_modules/@stoplight/yaml/buildJsonPath.js +41 -0
- package/.output/server/node_modules/@stoplight/yaml/dereferenceAnchor.js +38 -0
- package/.output/server/node_modules/@stoplight/yaml/getJsonPathForPosition.js +98 -0
- package/.output/server/node_modules/@stoplight/yaml/getLocationForJsonPath.js +145 -0
- package/.output/server/node_modules/@stoplight/yaml/index.js +16 -0
- package/.output/server/node_modules/@stoplight/yaml/lineForPosition.js +31 -0
- package/.output/server/node_modules/@stoplight/yaml/package.json +33 -0
- package/.output/server/node_modules/@stoplight/yaml/parse.js +5 -0
- package/.output/server/node_modules/@stoplight/yaml/parseWithPointers.js +456 -0
- package/.output/server/node_modules/@stoplight/yaml/safeStringify.js +5 -0
- package/.output/server/node_modules/@stoplight/yaml/trapAccess.js +11 -0
- package/.output/server/node_modules/@stoplight/yaml/types.js +6 -0
- package/.output/server/node_modules/@stoplight/yaml/utils.js +4 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/common.js +45 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/dumper.js +710 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/exception.js +35 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/index.js +22 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/loader.js +1414 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/mark.js +58 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/scalarInference.js +90 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/core.js +8 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_full.js +14 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_safe.js +19 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/failsafe.js +10 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/json.js +14 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema.js +77 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/binary.js +92 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/bool.js +32 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/float.js +94 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/int.js +159 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/regexp.js +64 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/undefined.js +22 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/map.js +7 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/merge.js +10 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/null.js +30 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/omap.js +46 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/pairs.js +55 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/seq.js +7 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/set.js +22 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/str.js +7 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/timestamp.js +70 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type.js +53 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/yamlAST.js +81 -0
- package/.output/server/node_modules/@stoplight/yaml-ast-parser/package.json +38 -0
- package/.output/server/node_modules/fflate/esm/index.mjs +2679 -0
- package/.output/server/node_modules/fflate/package.json +127 -0
- package/.output/server/node_modules/tinyexec/dist/{main.js → main.mjs} +158 -149
- package/.output/server/node_modules/tinyexec/package.json +15 -14
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +8 -2
- package/package.json +18 -18
|
@@ -14,23 +14,25 @@ import process$1, { version as version$2 } from 'node:process';
|
|
|
14
14
|
import { Logtail } from '@logtail/node';
|
|
15
15
|
import { consola } from 'consola';
|
|
16
16
|
import { styleText } from 'node:util';
|
|
17
|
-
import mod
|
|
17
|
+
import mod from 'node:module';
|
|
18
18
|
import { access, rm, readFile as readFile$1, mkdir, writeFile as writeFile$1 } from 'node:fs/promises';
|
|
19
19
|
import { createFabric, createReactFabric, App, File, Function as Function$1, Const, FunctionParams, Type as Type$1, useApp } from '@kubb/react-fabric';
|
|
20
20
|
import { typescriptParser } from '@kubb/react-fabric/parsers';
|
|
21
21
|
import { fsPlugin } from '@kubb/react-fabric/plugins';
|
|
22
22
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
23
|
+
import { deflateSync } from 'fflate';
|
|
24
|
+
import { x } from 'tinyexec';
|
|
23
25
|
import os$1 from 'node:os';
|
|
24
26
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
25
27
|
import * as pkg from 'empathic/package';
|
|
26
28
|
import { coerce, satisfies } from 'semver';
|
|
27
29
|
import { sortBy, isFunction, mergeDeep, isPlainObject as isPlainObject$1, uniqueWith, isDeepEqual, isNumber, difference } from 'remeda';
|
|
28
|
-
import { x } from 'tinyexec';
|
|
29
30
|
import { createJiti } from 'jiti';
|
|
30
31
|
import jsonpointer from 'jsonpointer';
|
|
31
32
|
import BaseOas from 'oas';
|
|
32
33
|
import { matchesMimeType } from 'oas/utils';
|
|
33
34
|
import { bundle, loadConfig as loadConfig$1 } from '@redocly/openapi-core';
|
|
35
|
+
import yaml from '@stoplight/yaml';
|
|
34
36
|
import { isRef } from 'oas/types';
|
|
35
37
|
import OASNormalize from 'oas-normalize';
|
|
36
38
|
import swagger2openapi from 'swagger2openapi';
|
|
@@ -4648,7 +4650,7 @@ async function disconnect({ sessionId, token, studioUrl }) {
|
|
|
4648
4650
|
}
|
|
4649
4651
|
}
|
|
4650
4652
|
|
|
4651
|
-
var version = "4.
|
|
4653
|
+
var version = "4.35.0";
|
|
4652
4654
|
|
|
4653
4655
|
function isCommandMessage(msg) {
|
|
4654
4656
|
return msg.type === "command";
|
|
@@ -4681,11 +4683,108 @@ async function getLatestStudioConfigFromStorage({ sessionId }) {
|
|
|
4681
4683
|
return existing[existing.length - 1].config;
|
|
4682
4684
|
}
|
|
4683
4685
|
|
|
4684
|
-
|
|
4686
|
+
const visitorDepths = {
|
|
4687
|
+
deep: "deep"
|
|
4688
|
+
};
|
|
4689
|
+
function createLimit(concurrency) {
|
|
4690
|
+
let active = 0;
|
|
4691
|
+
const queue = [];
|
|
4692
|
+
function next() {
|
|
4693
|
+
if (active < concurrency && queue.length > 0) {
|
|
4694
|
+
active++;
|
|
4695
|
+
queue.shift()();
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
return function limit(fn) {
|
|
4699
|
+
return new Promise((resolve, reject) => {
|
|
4700
|
+
queue.push(() => {
|
|
4701
|
+
Promise.resolve(fn()).then(resolve, reject).finally(() => {
|
|
4702
|
+
active--;
|
|
4703
|
+
next();
|
|
4704
|
+
});
|
|
4705
|
+
});
|
|
4706
|
+
next();
|
|
4707
|
+
});
|
|
4708
|
+
};
|
|
4709
|
+
}
|
|
4710
|
+
function getChildren(node, recurse) {
|
|
4711
|
+
switch (node.kind) {
|
|
4712
|
+
case "Root":
|
|
4713
|
+
return [...node.schemas, ...node.operations];
|
|
4714
|
+
case "Operation":
|
|
4715
|
+
return [
|
|
4716
|
+
...node.parameters,
|
|
4717
|
+
...node.requestBody ? [node.requestBody] : [],
|
|
4718
|
+
...node.responses
|
|
4719
|
+
];
|
|
4720
|
+
case "Schema": {
|
|
4721
|
+
const children = [];
|
|
4722
|
+
if (!recurse) return [];
|
|
4723
|
+
if ("properties" in node && node.properties) children.push(...node.properties);
|
|
4724
|
+
if ("items" in node && node.items) children.push(...node.items);
|
|
4725
|
+
if ("members" in node && node.members) children.push(...node.members);
|
|
4726
|
+
return children;
|
|
4727
|
+
}
|
|
4728
|
+
case "Property":
|
|
4729
|
+
return [node.schema];
|
|
4730
|
+
case "Parameter":
|
|
4731
|
+
return [node.schema];
|
|
4732
|
+
case "Response":
|
|
4733
|
+
return node.schema ? [node.schema] : [];
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
async function walk(node, visitor, options = {}) {
|
|
4737
|
+
var _a, _b;
|
|
4738
|
+
return _walk(node, visitor, ((_a = options.depth) != null ? _a : visitorDepths.deep) === visitorDepths.deep, createLimit((_b = options.concurrency) != null ? _b : 30));
|
|
4739
|
+
}
|
|
4740
|
+
async function _walk(node, visitor, recurse, limit) {
|
|
4741
|
+
switch (node.kind) {
|
|
4742
|
+
case "Root":
|
|
4743
|
+
await limit(() => {
|
|
4744
|
+
var _a;
|
|
4745
|
+
return (_a = visitor.root) == null ? void 0 : _a.call(visitor, node);
|
|
4746
|
+
});
|
|
4747
|
+
break;
|
|
4748
|
+
case "Operation":
|
|
4749
|
+
await limit(() => {
|
|
4750
|
+
var _a;
|
|
4751
|
+
return (_a = visitor.operation) == null ? void 0 : _a.call(visitor, node);
|
|
4752
|
+
});
|
|
4753
|
+
break;
|
|
4754
|
+
case "Schema":
|
|
4755
|
+
await limit(() => {
|
|
4756
|
+
var _a;
|
|
4757
|
+
return (_a = visitor.schema) == null ? void 0 : _a.call(visitor, node);
|
|
4758
|
+
});
|
|
4759
|
+
break;
|
|
4760
|
+
case "Property":
|
|
4761
|
+
await limit(() => {
|
|
4762
|
+
var _a;
|
|
4763
|
+
return (_a = visitor.property) == null ? void 0 : _a.call(visitor, node);
|
|
4764
|
+
});
|
|
4765
|
+
break;
|
|
4766
|
+
case "Parameter":
|
|
4767
|
+
await limit(() => {
|
|
4768
|
+
var _a;
|
|
4769
|
+
return (_a = visitor.parameter) == null ? void 0 : _a.call(visitor, node);
|
|
4770
|
+
});
|
|
4771
|
+
break;
|
|
4772
|
+
case "Response":
|
|
4773
|
+
await limit(() => {
|
|
4774
|
+
var _a;
|
|
4775
|
+
return (_a = visitor.response) == null ? void 0 : _a.call(visitor, node);
|
|
4776
|
+
});
|
|
4777
|
+
break;
|
|
4778
|
+
}
|
|
4779
|
+
const children = getChildren(node, recurse);
|
|
4780
|
+
await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit)));
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
var __defProp$h = Object.defineProperty;
|
|
4685
4784
|
var __typeError$c = (msg) => {
|
|
4686
4785
|
throw TypeError(msg);
|
|
4687
4786
|
};
|
|
4688
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
4787
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4689
4788
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4690
4789
|
var __accessCheck$c = (obj, member, msg) => member.has(obj) || __typeError$c("Cannot " + msg);
|
|
4691
4790
|
var __privateGet$c = (obj, member, getter) => (__accessCheck$c(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -4700,7 +4799,7 @@ var __privateWrapper$1 = (obj, member, setter, getter) => ({
|
|
|
4700
4799
|
return __privateGet$c(obj, member, getter);
|
|
4701
4800
|
}
|
|
4702
4801
|
});
|
|
4703
|
-
var _emitter, _a$c, _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _b$2, _head$1, _tail$1, _size$1, _c, _options2$1, _d, _plugins, _usedPluginNames, _promiseManager, _PluginManager_instances, getSortedPlugins_fn, emitProcessingEnd_fn, execute_fn, executeSync_fn, parse_fn, _e, _f, _cache, _cwd, _PackageManager_instances, match_fn, _items, _FunctionParams_static, _g, orderItems_fn, addParams_fn, _cachedLeaves, _h;
|
|
4802
|
+
var _emitter, _a$c, _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _b$2, _head$1, _tail$1, _size$1, _c, _options2$1, _d, _studioIsOpen, _plugins, _usedPluginNames, _promiseManager, _PluginManager_instances, getSortedPlugins_fn, emitProcessingEnd_fn, execute_fn, executeSync_fn, parse_fn, _e, _f, _cache, _cwd, _PackageManager_instances, match_fn, _items, _FunctionParams_static, _g, orderItems_fn, addParams_fn, _cachedLeaves, _h;
|
|
4704
4803
|
var ValidationPluginError = class extends Error {
|
|
4705
4804
|
};
|
|
4706
4805
|
function toError(value) {
|
|
@@ -5058,6 +5157,7 @@ eachParam_fn$a = function(fn) {
|
|
|
5058
5157
|
function isInputPath(config) {
|
|
5059
5158
|
return typeof (config == null ? void 0 : config.input) === "object" && config.input !== null && "path" in config.input;
|
|
5060
5159
|
}
|
|
5160
|
+
const DEFAULT_STUDIO_URL = "https://studio.kubb.dev";
|
|
5061
5161
|
const BARREL_FILENAME = "index.ts";
|
|
5062
5162
|
const DEFAULT_BANNER = "simple";
|
|
5063
5163
|
const DEFAULT_EXTENSION = { ".ts": ".ts" };
|
|
@@ -5108,6 +5208,30 @@ const formatters = {
|
|
|
5108
5208
|
errorMessage: "Oxfmt not found"
|
|
5109
5209
|
}
|
|
5110
5210
|
};
|
|
5211
|
+
function encodeAst(root) {
|
|
5212
|
+
const compressed = deflateSync(new TextEncoder().encode(JSON.stringify(root)));
|
|
5213
|
+
return Buffer.from(compressed).toString("base64url");
|
|
5214
|
+
}
|
|
5215
|
+
function getStudioUrl(root, studioUrl, options = {}) {
|
|
5216
|
+
return `${studioUrl.replace(/\/$/, "")}${options.ast ? "/ast" : ""}?root=${encodeAst(root)}`;
|
|
5217
|
+
}
|
|
5218
|
+
async function openInStudio(root, studioUrl, options = {}) {
|
|
5219
|
+
const url = getStudioUrl(root, studioUrl, options);
|
|
5220
|
+
const cmd = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open";
|
|
5221
|
+
const args = process.platform === "win32" ? [
|
|
5222
|
+
"/c",
|
|
5223
|
+
"start",
|
|
5224
|
+
"",
|
|
5225
|
+
url
|
|
5226
|
+
] : [url];
|
|
5227
|
+
try {
|
|
5228
|
+
await x(cmd, args);
|
|
5229
|
+
} catch {
|
|
5230
|
+
console.log(`
|
|
5231
|
+
${url}
|
|
5232
|
+
`);
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5111
5235
|
var Node$1 = class Node {
|
|
5112
5236
|
constructor(value) {
|
|
5113
5237
|
__publicField$b(this, "value");
|
|
@@ -5279,6 +5403,12 @@ var PluginManager = (_e = class {
|
|
|
5279
5403
|
__privateAdd$c(this, _PluginManager_instances);
|
|
5280
5404
|
__publicField$b(this, "config");
|
|
5281
5405
|
__publicField$b(this, "options");
|
|
5406
|
+
/**
|
|
5407
|
+
* The universal `@kubb/ast` `RootNode` produced by the adapter, set by
|
|
5408
|
+
* the build pipeline after the adapter's `parse()` resolves.
|
|
5409
|
+
*/
|
|
5410
|
+
__publicField$b(this, "rootNode");
|
|
5411
|
+
__privateAdd$c(this, _studioIsOpen, false);
|
|
5282
5412
|
__privateAdd$c(this, _plugins, /* @__PURE__ */ new Set());
|
|
5283
5413
|
__privateAdd$c(this, _usedPluginNames, {});
|
|
5284
5414
|
__privateAdd$c(this, _promiseManager);
|
|
@@ -5333,6 +5463,7 @@ var PluginManager = (_e = class {
|
|
|
5333
5463
|
}
|
|
5334
5464
|
getContext(plugin) {
|
|
5335
5465
|
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5466
|
+
const pluginManager = this;
|
|
5336
5467
|
const baseContext = {
|
|
5337
5468
|
fabric: this.options.fabric,
|
|
5338
5469
|
config: this.config,
|
|
@@ -5345,6 +5476,18 @@ var PluginManager = (_e = class {
|
|
|
5345
5476
|
},
|
|
5346
5477
|
upsertFile: async (...files) => {
|
|
5347
5478
|
await this.options.fabric.upsertFile(...files);
|
|
5479
|
+
},
|
|
5480
|
+
get rootNode() {
|
|
5481
|
+
return pluginManager.rootNode;
|
|
5482
|
+
},
|
|
5483
|
+
openInStudio(options) {
|
|
5484
|
+
var _a2, _b2;
|
|
5485
|
+
if (typeof pluginManager.config.devtools !== "object") throw new Error("Devtools must be an object");
|
|
5486
|
+
if (!pluginManager.rootNode) throw new Error("RootNode is not defined, make sure you have set the parser in kubb.config.ts");
|
|
5487
|
+
if (__privateGet$c(pluginManager, _studioIsOpen)) return;
|
|
5488
|
+
__privateSet$c(pluginManager, _studioIsOpen, true);
|
|
5489
|
+
const studioUrl = (_b2 = (_a2 = pluginManager.config.devtools) == null ? void 0 : _a2.studioUrl) != null ? _b2 : "https://studio.kubb.dev";
|
|
5490
|
+
return openInStudio(pluginManager.rootNode, studioUrl, options);
|
|
5348
5491
|
}
|
|
5349
5492
|
};
|
|
5350
5493
|
const mergedExtras = {};
|
|
@@ -5552,7 +5695,7 @@ var PluginManager = (_e = class {
|
|
|
5552
5695
|
}
|
|
5553
5696
|
return pluginByPluginName;
|
|
5554
5697
|
}
|
|
5555
|
-
}, _plugins = new WeakMap(), _usedPluginNames = new WeakMap(), _promiseManager = new WeakMap(), _PluginManager_instances = new WeakSet(), getSortedPlugins_fn = function(hookName) {
|
|
5698
|
+
}, _studioIsOpen = new WeakMap(), _plugins = new WeakMap(), _usedPluginNames = new WeakMap(), _promiseManager = new WeakMap(), _PluginManager_instances = new WeakSet(), getSortedPlugins_fn = function(hookName) {
|
|
5556
5699
|
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5557
5700
|
if (hookName) return plugins.filter((plugin) => hookName in plugin);
|
|
5558
5701
|
return plugins.map((plugin) => {
|
|
@@ -5662,7 +5805,7 @@ executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
|
5662
5805
|
key: [plugin.name, usedPluginNames[plugin.name]].filter(Boolean)
|
|
5663
5806
|
};
|
|
5664
5807
|
}, _e);
|
|
5665
|
-
var version$1 = "4.
|
|
5808
|
+
var version$1 = "4.35.0";
|
|
5666
5809
|
function getDiagnosticInfo() {
|
|
5667
5810
|
return {
|
|
5668
5811
|
nodeVersion: version$2,
|
|
@@ -5718,6 +5861,10 @@ async function setup(options) {
|
|
|
5718
5861
|
defaultBanner: DEFAULT_BANNER,
|
|
5719
5862
|
...userConfig.output
|
|
5720
5863
|
},
|
|
5864
|
+
devtools: userConfig.devtools ? {
|
|
5865
|
+
studioUrl: DEFAULT_STUDIO_URL,
|
|
5866
|
+
...typeof userConfig.devtools === "boolean" ? {} : userConfig.devtools
|
|
5867
|
+
} : void 0,
|
|
5721
5868
|
plugins: userConfig.plugins
|
|
5722
5869
|
};
|
|
5723
5870
|
if (definedConfig.output.clean) {
|
|
@@ -5764,14 +5911,31 @@ async function setup(options) {
|
|
|
5764
5911
|
` \u2022 Barrel type: ${definedConfig.output.barrelType || "none"}`
|
|
5765
5912
|
]
|
|
5766
5913
|
});
|
|
5914
|
+
const pluginManager = new PluginManager(definedConfig, {
|
|
5915
|
+
fabric,
|
|
5916
|
+
events,
|
|
5917
|
+
concurrency: 15
|
|
5918
|
+
});
|
|
5919
|
+
if (definedConfig.adapter) {
|
|
5920
|
+
const source = inputToAdapterSource(definedConfig);
|
|
5921
|
+
await events.emit("debug", {
|
|
5922
|
+
date: /* @__PURE__ */ new Date(),
|
|
5923
|
+
logs: [`Running adapter: ${definedConfig.adapter.name}`]
|
|
5924
|
+
});
|
|
5925
|
+
pluginManager.rootNode = await definedConfig.adapter.parse(source);
|
|
5926
|
+
await events.emit("debug", {
|
|
5927
|
+
date: /* @__PURE__ */ new Date(),
|
|
5928
|
+
logs: [
|
|
5929
|
+
`\u2713 Adapter '${definedConfig.adapter.name}' resolved RootNode`,
|
|
5930
|
+
` \u2022 Schemas: ${pluginManager.rootNode.schemas.length}`,
|
|
5931
|
+
` \u2022 Operations: ${pluginManager.rootNode.operations.length}`
|
|
5932
|
+
]
|
|
5933
|
+
});
|
|
5934
|
+
}
|
|
5767
5935
|
return {
|
|
5768
5936
|
events,
|
|
5769
5937
|
fabric,
|
|
5770
|
-
pluginManager
|
|
5771
|
-
fabric,
|
|
5772
|
-
events,
|
|
5773
|
-
concurrency: 15
|
|
5774
|
-
}),
|
|
5938
|
+
pluginManager,
|
|
5775
5939
|
sources
|
|
5776
5940
|
};
|
|
5777
5941
|
}
|
|
@@ -5912,6 +6076,20 @@ function buildBarrelExports({ barrelFiles, rootDir, existingExports, config, plu
|
|
|
5912
6076
|
});
|
|
5913
6077
|
});
|
|
5914
6078
|
}
|
|
6079
|
+
function inputToAdapterSource(config) {
|
|
6080
|
+
if (Array.isArray(config.input)) return {
|
|
6081
|
+
type: "paths",
|
|
6082
|
+
paths: config.input.map((i) => resolve(config.root, i.path))
|
|
6083
|
+
};
|
|
6084
|
+
if ("data" in config.input) return {
|
|
6085
|
+
type: "data",
|
|
6086
|
+
data: config.input.data
|
|
6087
|
+
};
|
|
6088
|
+
return {
|
|
6089
|
+
type: "path",
|
|
6090
|
+
path: resolve(config.root, config.input.path)
|
|
6091
|
+
};
|
|
6092
|
+
}
|
|
5915
6093
|
function definePlugin(build2) {
|
|
5916
6094
|
return (options) => build2(options != null ? options : {});
|
|
5917
6095
|
}
|
|
@@ -6487,8 +6665,8 @@ async function loadConfig(resolvedConfigPath) {
|
|
|
6487
6665
|
return configs[0];
|
|
6488
6666
|
}
|
|
6489
6667
|
|
|
6490
|
-
var __defProp$
|
|
6491
|
-
var __name$5 = (target, value) => __defProp$
|
|
6668
|
+
var __defProp$g = Object.defineProperty;
|
|
6669
|
+
var __name$5 = (target, value) => __defProp$g(target, "name", {
|
|
6492
6670
|
value,
|
|
6493
6671
|
configurable: true
|
|
6494
6672
|
});
|
|
@@ -6622,40 +6800,6 @@ function isKeyword(meta, keyword) {
|
|
|
6622
6800
|
return meta.keyword === keyword;
|
|
6623
6801
|
}
|
|
6624
6802
|
|
|
6625
|
-
var __create = Object.create;
|
|
6626
|
-
var __defProp$g = Object.defineProperty;
|
|
6627
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6628
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6629
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6630
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6631
|
-
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
6632
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
6633
|
-
var __exportAll = (all, no_symbols) => {
|
|
6634
|
-
let target = {};
|
|
6635
|
-
for (var name in all) __defProp$g(target, name, {
|
|
6636
|
-
get: all[name],
|
|
6637
|
-
enumerable: true
|
|
6638
|
-
});
|
|
6639
|
-
__defProp$g(target, Symbol.toStringTag, { value: "Module" });
|
|
6640
|
-
return target;
|
|
6641
|
-
};
|
|
6642
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6643
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
6644
|
-
key = keys[i];
|
|
6645
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp$g(to, key, {
|
|
6646
|
-
get: ((k) => from[k]).bind(null, key),
|
|
6647
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
6648
|
-
});
|
|
6649
|
-
}
|
|
6650
|
-
return to;
|
|
6651
|
-
};
|
|
6652
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(__defProp$g(target, "default", {
|
|
6653
|
-
value: mod,
|
|
6654
|
-
enumerable: true
|
|
6655
|
-
}) , mod));
|
|
6656
|
-
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp$g({}, "__esModule", { value: true }), mod);
|
|
6657
|
-
var __require = /* @__PURE__ */ createRequire(globalThis._importMeta_.url);
|
|
6658
|
-
|
|
6659
6803
|
var __defProp$f = Object.defineProperty;
|
|
6660
6804
|
var __typeError$b = (msg) => {
|
|
6661
6805
|
throw TypeError(msg);
|
|
@@ -6668,6 +6812,15 @@ var __privateAdd$b = (obj, member, value) => member.has(obj) ? __typeError$b("Ca
|
|
|
6668
6812
|
var __privateSet$b = (obj, member, value, setter) => (__accessCheck$b(obj, member, "write to private field"), member.set(obj, value), value);
|
|
6669
6813
|
var __privateMethod$b = (obj, member, method) => (__accessCheck$b(obj, member, "access private method"), method);
|
|
6670
6814
|
var _options$b, _URLPath_instances$9, transformParam_fn$9, eachParam_fn$9, _a$b, _options2, _Oas_instances, setDiscriminator_fn, applyDiscriminatorInheritance_fn, getResponseBodyFactory_fn, _b$1;
|
|
6815
|
+
const STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
|
|
6816
|
+
"properties",
|
|
6817
|
+
"items",
|
|
6818
|
+
"additionalProperties",
|
|
6819
|
+
"oneOf",
|
|
6820
|
+
"anyOf",
|
|
6821
|
+
"allOf",
|
|
6822
|
+
"not"
|
|
6823
|
+
]);
|
|
6671
6824
|
function toCamelOrPascal$c(text, pascal) {
|
|
6672
6825
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
6673
6826
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
@@ -6793,4142 +6946,11 @@ eachParam_fn$9 = function(fn) {
|
|
|
6793
6946
|
fn(raw, __privateMethod$b(this, _URLPath_instances$9, transformParam_fn$9).call(this, raw));
|
|
6794
6947
|
}
|
|
6795
6948
|
}, _a$b);
|
|
6796
|
-
var tslib_es6_exports = /* @__PURE__ */ __exportAll({
|
|
6797
|
-
__addDisposableResource: () => __addDisposableResource,
|
|
6798
|
-
__assign: () => __assign,
|
|
6799
|
-
__asyncDelegator: () => __asyncDelegator,
|
|
6800
|
-
__asyncGenerator: () => __asyncGenerator,
|
|
6801
|
-
__asyncValues: () => __asyncValues,
|
|
6802
|
-
__await: () => __await,
|
|
6803
|
-
__awaiter: () => __awaiter,
|
|
6804
|
-
__classPrivateFieldGet: () => __classPrivateFieldGet,
|
|
6805
|
-
__classPrivateFieldIn: () => __classPrivateFieldIn,
|
|
6806
|
-
__classPrivateFieldSet: () => __classPrivateFieldSet,
|
|
6807
|
-
__createBinding: () => __createBinding,
|
|
6808
|
-
__decorate: () => __decorate,
|
|
6809
|
-
__disposeResources: () => __disposeResources,
|
|
6810
|
-
__esDecorate: () => __esDecorate,
|
|
6811
|
-
__exportStar: () => __exportStar,
|
|
6812
|
-
__extends: () => __extends,
|
|
6813
|
-
__generator: () => __generator,
|
|
6814
|
-
__importDefault: () => __importDefault,
|
|
6815
|
-
__importStar: () => __importStar,
|
|
6816
|
-
__makeTemplateObject: () => __makeTemplateObject,
|
|
6817
|
-
__metadata: () => __metadata,
|
|
6818
|
-
__param: () => __param,
|
|
6819
|
-
__propKey: () => __propKey,
|
|
6820
|
-
__read: () => __read,
|
|
6821
|
-
__rest: () => __rest,
|
|
6822
|
-
__rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
|
|
6823
|
-
__runInitializers: () => __runInitializers,
|
|
6824
|
-
__setFunctionName: () => __setFunctionName,
|
|
6825
|
-
__spread: () => __spread,
|
|
6826
|
-
__spreadArray: () => __spreadArray,
|
|
6827
|
-
__spreadArrays: () => __spreadArrays,
|
|
6828
|
-
__values: () => __values,
|
|
6829
|
-
default: () => tslib_es6_default
|
|
6830
|
-
});
|
|
6831
|
-
function __extends(d, b) {
|
|
6832
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
6833
|
-
extendStatics(d, b);
|
|
6834
|
-
function __() {
|
|
6835
|
-
this.constructor = d;
|
|
6836
|
-
}
|
|
6837
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6838
|
-
}
|
|
6839
|
-
function __rest(s, e) {
|
|
6840
|
-
var t = {};
|
|
6841
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6842
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
6843
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6844
|
-
}
|
|
6845
|
-
return t;
|
|
6846
|
-
}
|
|
6847
|
-
function __decorate(decorators, target, key, desc) {
|
|
6848
|
-
var c = arguments.length;
|
|
6849
|
-
var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
6850
|
-
var d;
|
|
6851
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6852
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6853
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6854
|
-
}
|
|
6855
|
-
function __param(paramIndex, decorator) {
|
|
6856
|
-
return function(target, key) {
|
|
6857
|
-
decorator(target, key, paramIndex);
|
|
6858
|
-
};
|
|
6859
|
-
}
|
|
6860
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
6861
|
-
function accept(f) {
|
|
6862
|
-
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
6863
|
-
return f;
|
|
6864
|
-
}
|
|
6865
|
-
var kind = contextIn.kind;
|
|
6866
|
-
var key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
6867
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6868
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6869
|
-
var _;
|
|
6870
|
-
var done = false;
|
|
6871
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6872
|
-
var context = {};
|
|
6873
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
6874
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
6875
|
-
context.addInitializer = function(f) {
|
|
6876
|
-
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
6877
|
-
extraInitializers.push(accept(f || null));
|
|
6878
|
-
};
|
|
6879
|
-
var result = (0, decorators[i])(kind === "accessor" ? {
|
|
6880
|
-
get: descriptor.get,
|
|
6881
|
-
set: descriptor.set
|
|
6882
|
-
} : descriptor[key], context);
|
|
6883
|
-
if (kind === "accessor") {
|
|
6884
|
-
if (result === void 0) continue;
|
|
6885
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
6886
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
6887
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
6888
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
6889
|
-
} else if (_ = accept(result)) if (kind === "field") initializers.unshift(_);
|
|
6890
|
-
else descriptor[key] = _;
|
|
6891
|
-
}
|
|
6892
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
6893
|
-
done = true;
|
|
6894
|
-
}
|
|
6895
|
-
function __runInitializers(thisArg, initializers, value) {
|
|
6896
|
-
var useValue = arguments.length > 2;
|
|
6897
|
-
for (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
6898
|
-
return useValue ? value : void 0;
|
|
6899
|
-
}
|
|
6900
|
-
function __propKey(x) {
|
|
6901
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
6902
|
-
}
|
|
6903
|
-
function __setFunctionName(f, name, prefix) {
|
|
6904
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
6905
|
-
return Object.defineProperty(f, "name", {
|
|
6906
|
-
configurable: true,
|
|
6907
|
-
value: prefix ? "".concat(prefix, " ", name) : name
|
|
6908
|
-
});
|
|
6909
|
-
}
|
|
6910
|
-
function __metadata(metadataKey, metadataValue) {
|
|
6911
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
6912
|
-
}
|
|
6913
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
6914
|
-
function adopt(value) {
|
|
6915
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
6916
|
-
resolve(value);
|
|
6917
|
-
});
|
|
6918
|
-
}
|
|
6919
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
6920
|
-
function fulfilled(value) {
|
|
6921
|
-
try {
|
|
6922
|
-
step(generator.next(value));
|
|
6923
|
-
} catch (e) {
|
|
6924
|
-
reject(e);
|
|
6925
|
-
}
|
|
6926
|
-
}
|
|
6927
|
-
function rejected(value) {
|
|
6928
|
-
try {
|
|
6929
|
-
step(generator["throw"](value));
|
|
6930
|
-
} catch (e) {
|
|
6931
|
-
reject(e);
|
|
6932
|
-
}
|
|
6933
|
-
}
|
|
6934
|
-
function step(result) {
|
|
6935
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
6936
|
-
}
|
|
6937
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6938
|
-
});
|
|
6939
|
-
}
|
|
6940
|
-
function __generator(thisArg, body) {
|
|
6941
|
-
var _ = {
|
|
6942
|
-
label: 0,
|
|
6943
|
-
sent: function() {
|
|
6944
|
-
if (t[0] & 1) throw t[1];
|
|
6945
|
-
return t[1];
|
|
6946
|
-
},
|
|
6947
|
-
trys: [],
|
|
6948
|
-
ops: []
|
|
6949
|
-
};
|
|
6950
|
-
var f;
|
|
6951
|
-
var y;
|
|
6952
|
-
var t;
|
|
6953
|
-
var g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
6954
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
6955
|
-
return this;
|
|
6956
|
-
}), g;
|
|
6957
|
-
function verb(n) {
|
|
6958
|
-
return function(v) {
|
|
6959
|
-
return step([n, v]);
|
|
6960
|
-
};
|
|
6961
|
-
}
|
|
6962
|
-
function step(op) {
|
|
6963
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
6964
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
6965
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6966
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6967
|
-
switch (op[0]) {
|
|
6968
|
-
case 0:
|
|
6969
|
-
case 1:
|
|
6970
|
-
t = op;
|
|
6971
|
-
break;
|
|
6972
|
-
case 4:
|
|
6973
|
-
_.label++;
|
|
6974
|
-
return {
|
|
6975
|
-
value: op[1],
|
|
6976
|
-
done: false
|
|
6977
|
-
};
|
|
6978
|
-
case 5:
|
|
6979
|
-
_.label++;
|
|
6980
|
-
y = op[1];
|
|
6981
|
-
op = [0];
|
|
6982
|
-
continue;
|
|
6983
|
-
case 7:
|
|
6984
|
-
op = _.ops.pop();
|
|
6985
|
-
_.trys.pop();
|
|
6986
|
-
continue;
|
|
6987
|
-
default:
|
|
6988
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
6989
|
-
_ = 0;
|
|
6990
|
-
continue;
|
|
6991
|
-
}
|
|
6992
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
6993
|
-
_.label = op[1];
|
|
6994
|
-
break;
|
|
6995
|
-
}
|
|
6996
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
6997
|
-
_.label = t[1];
|
|
6998
|
-
t = op;
|
|
6999
|
-
break;
|
|
7000
|
-
}
|
|
7001
|
-
if (t && _.label < t[2]) {
|
|
7002
|
-
_.label = t[2];
|
|
7003
|
-
_.ops.push(op);
|
|
7004
|
-
break;
|
|
7005
|
-
}
|
|
7006
|
-
if (t[2]) _.ops.pop();
|
|
7007
|
-
_.trys.pop();
|
|
7008
|
-
continue;
|
|
7009
|
-
}
|
|
7010
|
-
op = body.call(thisArg, _);
|
|
7011
|
-
} catch (e) {
|
|
7012
|
-
op = [6, e];
|
|
7013
|
-
y = 0;
|
|
7014
|
-
} finally {
|
|
7015
|
-
f = t = 0;
|
|
7016
|
-
}
|
|
7017
|
-
if (op[0] & 5) throw op[1];
|
|
7018
|
-
return {
|
|
7019
|
-
value: op[0] ? op[1] : void 0,
|
|
7020
|
-
done: true
|
|
7021
|
-
};
|
|
7022
|
-
}
|
|
7023
|
-
}
|
|
7024
|
-
function __exportStar(m, o) {
|
|
7025
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
7026
|
-
}
|
|
7027
|
-
function __values(o) {
|
|
7028
|
-
var s = typeof Symbol === "function" && Symbol.iterator;
|
|
7029
|
-
var m = s && o[s];
|
|
7030
|
-
var i = 0;
|
|
7031
|
-
if (m) return m.call(o);
|
|
7032
|
-
if (o && typeof o.length === "number") return { next: function() {
|
|
7033
|
-
if (o && i >= o.length) o = void 0;
|
|
7034
|
-
return {
|
|
7035
|
-
value: o && o[i++],
|
|
7036
|
-
done: !o
|
|
7037
|
-
};
|
|
7038
|
-
} };
|
|
7039
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
7040
|
-
}
|
|
7041
|
-
function __read(o, n) {
|
|
7042
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7043
|
-
if (!m) return o;
|
|
7044
|
-
var i = m.call(o);
|
|
7045
|
-
var r;
|
|
7046
|
-
var ar = [];
|
|
7047
|
-
var e;
|
|
7048
|
-
try {
|
|
7049
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7050
|
-
} catch (error) {
|
|
7051
|
-
e = { error };
|
|
7052
|
-
} finally {
|
|
7053
|
-
try {
|
|
7054
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
7055
|
-
} finally {
|
|
7056
|
-
if (e) throw e.error;
|
|
7057
|
-
}
|
|
7058
|
-
}
|
|
7059
|
-
return ar;
|
|
7060
|
-
}
|
|
7061
|
-
function __spread() {
|
|
7062
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
7063
|
-
return ar;
|
|
7064
|
-
}
|
|
7065
|
-
function __spreadArrays() {
|
|
7066
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
7067
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
7068
|
-
return r;
|
|
7069
|
-
}
|
|
7070
|
-
function __spreadArray(to, from, pack) {
|
|
7071
|
-
if (pack || arguments.length === 2) {
|
|
7072
|
-
for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
|
|
7073
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
7074
|
-
ar[i] = from[i];
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
7078
|
-
}
|
|
7079
|
-
function __await(v) {
|
|
7080
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
7081
|
-
}
|
|
7082
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
7083
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
7084
|
-
var g = generator.apply(thisArg, _arguments || []);
|
|
7085
|
-
var i;
|
|
7086
|
-
var q = [];
|
|
7087
|
-
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
7088
|
-
return this;
|
|
7089
|
-
}, i;
|
|
7090
|
-
function awaitReturn(f) {
|
|
7091
|
-
return function(v) {
|
|
7092
|
-
return Promise.resolve(v).then(f, reject);
|
|
7093
|
-
};
|
|
7094
|
-
}
|
|
7095
|
-
function verb(n, f) {
|
|
7096
|
-
if (g[n]) {
|
|
7097
|
-
i[n] = function(v) {
|
|
7098
|
-
return new Promise(function(a, b) {
|
|
7099
|
-
q.push([
|
|
7100
|
-
n,
|
|
7101
|
-
v,
|
|
7102
|
-
a,
|
|
7103
|
-
b
|
|
7104
|
-
]) > 1 || resume(n, v);
|
|
7105
|
-
});
|
|
7106
|
-
};
|
|
7107
|
-
if (f) i[n] = f(i[n]);
|
|
7108
|
-
}
|
|
7109
|
-
}
|
|
7110
|
-
function resume(n, v) {
|
|
7111
|
-
try {
|
|
7112
|
-
step(g[n](v));
|
|
7113
|
-
} catch (e) {
|
|
7114
|
-
settle(q[0][3], e);
|
|
7115
|
-
}
|
|
7116
|
-
}
|
|
7117
|
-
function step(r) {
|
|
7118
|
-
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
7119
|
-
}
|
|
7120
|
-
function fulfill(value) {
|
|
7121
|
-
resume("next", value);
|
|
7122
|
-
}
|
|
7123
|
-
function reject(value) {
|
|
7124
|
-
resume("throw", value);
|
|
7125
|
-
}
|
|
7126
|
-
function settle(f, v) {
|
|
7127
|
-
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
7128
|
-
}
|
|
7129
|
-
}
|
|
7130
|
-
function __asyncDelegator(o) {
|
|
7131
|
-
var i;
|
|
7132
|
-
var p;
|
|
7133
|
-
return i = {}, verb("next"), verb("throw", function(e) {
|
|
7134
|
-
throw e;
|
|
7135
|
-
}), verb("return"), i[Symbol.iterator] = function() {
|
|
7136
|
-
return this;
|
|
7137
|
-
}, i;
|
|
7138
|
-
function verb(n, f) {
|
|
7139
|
-
i[n] = o[n] ? function(v) {
|
|
7140
|
-
return (p = !p) ? {
|
|
7141
|
-
value: __await(o[n](v)),
|
|
7142
|
-
done: false
|
|
7143
|
-
} : f ? f(v) : v;
|
|
7144
|
-
} : f;
|
|
7145
|
-
}
|
|
7146
|
-
}
|
|
7147
|
-
function __asyncValues(o) {
|
|
7148
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
7149
|
-
var m = o[Symbol.asyncIterator];
|
|
7150
|
-
var i;
|
|
7151
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
7152
|
-
return this;
|
|
7153
|
-
}, i);
|
|
7154
|
-
function verb(n) {
|
|
7155
|
-
i[n] = o[n] && function(v) {
|
|
7156
|
-
return new Promise(function(resolve, reject) {
|
|
7157
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
7158
|
-
});
|
|
7159
|
-
};
|
|
7160
|
-
}
|
|
7161
|
-
function settle(resolve, reject, d, v) {
|
|
7162
|
-
Promise.resolve(v).then(function(v2) {
|
|
7163
|
-
resolve({
|
|
7164
|
-
value: v2,
|
|
7165
|
-
done: d
|
|
7166
|
-
});
|
|
7167
|
-
}, reject);
|
|
7168
|
-
}
|
|
7169
|
-
}
|
|
7170
|
-
function __makeTemplateObject(cooked, raw) {
|
|
7171
|
-
if (Object.defineProperty) Object.defineProperty(cooked, "raw", { value: raw });
|
|
7172
|
-
else cooked.raw = raw;
|
|
7173
|
-
return cooked;
|
|
7174
|
-
}
|
|
7175
|
-
function __importStar(mod) {
|
|
7176
|
-
if (mod && mod.__esModule) return mod;
|
|
7177
|
-
var result = {};
|
|
7178
|
-
if (mod != null) {
|
|
7179
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
7180
|
-
}
|
|
7181
|
-
__setModuleDefault(result, mod);
|
|
7182
|
-
return result;
|
|
7183
|
-
}
|
|
7184
|
-
function __importDefault(mod) {
|
|
7185
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
7186
|
-
}
|
|
7187
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
7188
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7189
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
7190
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7191
|
-
}
|
|
7192
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
7193
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7194
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7195
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
7196
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
7197
|
-
}
|
|
7198
|
-
function __classPrivateFieldIn(state, receiver) {
|
|
7199
|
-
if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
7200
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
7201
|
-
}
|
|
7202
|
-
function __addDisposableResource(env, value, async) {
|
|
7203
|
-
if (value !== null && value !== void 0) {
|
|
7204
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
7205
|
-
var dispose;
|
|
7206
|
-
var inner;
|
|
7207
|
-
if (async) {
|
|
7208
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7209
|
-
dispose = value[Symbol.asyncDispose];
|
|
7210
|
-
}
|
|
7211
|
-
if (dispose === void 0) {
|
|
7212
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
7213
|
-
dispose = value[Symbol.dispose];
|
|
7214
|
-
if (async) inner = dispose;
|
|
7215
|
-
}
|
|
7216
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
7217
|
-
if (inner) dispose = function() {
|
|
7218
|
-
try {
|
|
7219
|
-
inner.call(this);
|
|
7220
|
-
} catch (e) {
|
|
7221
|
-
return Promise.reject(e);
|
|
7222
|
-
}
|
|
7223
|
-
};
|
|
7224
|
-
env.stack.push({
|
|
7225
|
-
value,
|
|
7226
|
-
dispose,
|
|
7227
|
-
async
|
|
7228
|
-
});
|
|
7229
|
-
} else if (async) env.stack.push({ async: true });
|
|
7230
|
-
return value;
|
|
7231
|
-
}
|
|
7232
|
-
function __disposeResources(env) {
|
|
7233
|
-
function fail(e) {
|
|
7234
|
-
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
7235
|
-
env.hasError = true;
|
|
7236
|
-
}
|
|
7237
|
-
var r;
|
|
7238
|
-
var s = 0;
|
|
7239
|
-
function next() {
|
|
7240
|
-
while (r = env.stack.pop()) try {
|
|
7241
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
7242
|
-
if (r.dispose) {
|
|
7243
|
-
var result = r.dispose.call(r.value);
|
|
7244
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
7245
|
-
fail(e);
|
|
7246
|
-
return next();
|
|
7247
|
-
});
|
|
7248
|
-
} else s |= 1;
|
|
7249
|
-
} catch (e) {
|
|
7250
|
-
fail(e);
|
|
7251
|
-
}
|
|
7252
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
7253
|
-
if (env.hasError) throw env.error;
|
|
7254
|
-
}
|
|
7255
|
-
return next();
|
|
7256
|
-
}
|
|
7257
|
-
function __rewriteRelativeImportExtension(path2, preserveJsx) {
|
|
7258
|
-
if (typeof path2 === "string" && /^\.\.?\//.test(path2)) return path2.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
7259
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
7260
|
-
});
|
|
7261
|
-
return path2;
|
|
7262
|
-
}
|
|
7263
|
-
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
7264
|
-
var init_tslib_es6 = __esmMin((() => {
|
|
7265
|
-
extendStatics = function(d, b) {
|
|
7266
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
7267
|
-
d2.__proto__ = b2;
|
|
7268
|
-
} || function(d2, b2) {
|
|
7269
|
-
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
|
|
7270
|
-
};
|
|
7271
|
-
return extendStatics(d, b);
|
|
7272
|
-
};
|
|
7273
|
-
__assign = function() {
|
|
7274
|
-
__assign = Object.assign || function __assign2(t) {
|
|
7275
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7276
|
-
s = arguments[i];
|
|
7277
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7278
|
-
}
|
|
7279
|
-
return t;
|
|
7280
|
-
};
|
|
7281
|
-
return __assign.apply(this, arguments);
|
|
7282
|
-
};
|
|
7283
|
-
__createBinding = Object.create ? (function(o, m, k, k2) {
|
|
7284
|
-
if (k2 === void 0) k2 = k;
|
|
7285
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7286
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
7287
|
-
enumerable: true,
|
|
7288
|
-
get: function() {
|
|
7289
|
-
return m[k];
|
|
7290
|
-
}
|
|
7291
|
-
};
|
|
7292
|
-
Object.defineProperty(o, k2, desc);
|
|
7293
|
-
}) : (function(o, m, k, k2) {
|
|
7294
|
-
if (k2 === void 0) k2 = k;
|
|
7295
|
-
o[k2] = m[k];
|
|
7296
|
-
});
|
|
7297
|
-
__setModuleDefault = Object.create ? (function(o, v) {
|
|
7298
|
-
Object.defineProperty(o, "default", {
|
|
7299
|
-
enumerable: true,
|
|
7300
|
-
value: v
|
|
7301
|
-
});
|
|
7302
|
-
}) : function(o, v) {
|
|
7303
|
-
o["default"] = v;
|
|
7304
|
-
};
|
|
7305
|
-
ownKeys = function(o) {
|
|
7306
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
7307
|
-
var ar = [];
|
|
7308
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
7309
|
-
return ar;
|
|
7310
|
-
};
|
|
7311
|
-
return ownKeys(o);
|
|
7312
|
-
};
|
|
7313
|
-
_SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
7314
|
-
var e = new Error(message);
|
|
7315
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
7316
|
-
};
|
|
7317
|
-
tslib_es6_default = {
|
|
7318
|
-
__extends,
|
|
7319
|
-
__assign,
|
|
7320
|
-
__rest,
|
|
7321
|
-
__decorate,
|
|
7322
|
-
__param,
|
|
7323
|
-
__esDecorate,
|
|
7324
|
-
__runInitializers,
|
|
7325
|
-
__propKey,
|
|
7326
|
-
__setFunctionName,
|
|
7327
|
-
__metadata,
|
|
7328
|
-
__awaiter,
|
|
7329
|
-
__generator,
|
|
7330
|
-
__createBinding,
|
|
7331
|
-
__exportStar,
|
|
7332
|
-
__values,
|
|
7333
|
-
__read,
|
|
7334
|
-
__spread,
|
|
7335
|
-
__spreadArrays,
|
|
7336
|
-
__spreadArray,
|
|
7337
|
-
__await,
|
|
7338
|
-
__asyncGenerator,
|
|
7339
|
-
__asyncDelegator,
|
|
7340
|
-
__asyncValues,
|
|
7341
|
-
__makeTemplateObject,
|
|
7342
|
-
__importStar,
|
|
7343
|
-
__importDefault,
|
|
7344
|
-
__classPrivateFieldGet,
|
|
7345
|
-
__classPrivateFieldSet,
|
|
7346
|
-
__classPrivateFieldIn,
|
|
7347
|
-
__addDisposableResource,
|
|
7348
|
-
__disposeResources,
|
|
7349
|
-
__rewriteRelativeImportExtension
|
|
7350
|
-
};
|
|
7351
|
-
}));
|
|
7352
|
-
var require_yamlAST = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
7353
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7354
|
-
var Kind;
|
|
7355
|
-
(function(Kind2) {
|
|
7356
|
-
Kind2[Kind2["SCALAR"] = 0] = "SCALAR";
|
|
7357
|
-
Kind2[Kind2["MAPPING"] = 1] = "MAPPING";
|
|
7358
|
-
Kind2[Kind2["MAP"] = 2] = "MAP";
|
|
7359
|
-
Kind2[Kind2["SEQ"] = 3] = "SEQ";
|
|
7360
|
-
Kind2[Kind2["ANCHOR_REF"] = 4] = "ANCHOR_REF";
|
|
7361
|
-
Kind2[Kind2["INCLUDE_REF"] = 5] = "INCLUDE_REF";
|
|
7362
|
-
})(Kind = exports$1.Kind || (exports$1.Kind = {}));
|
|
7363
|
-
function newMapping(key, value) {
|
|
7364
|
-
var end = value ? value.endPosition : key.endPosition + 1;
|
|
7365
|
-
return {
|
|
7366
|
-
key,
|
|
7367
|
-
value,
|
|
7368
|
-
startPosition: key.startPosition,
|
|
7369
|
-
endPosition: end,
|
|
7370
|
-
kind: Kind.MAPPING,
|
|
7371
|
-
parent: null,
|
|
7372
|
-
errors: []
|
|
7373
|
-
};
|
|
7374
|
-
}
|
|
7375
|
-
exports$1.newMapping = newMapping;
|
|
7376
|
-
function newAnchorRef(key, start, end, value) {
|
|
7377
|
-
return {
|
|
7378
|
-
errors: [],
|
|
7379
|
-
referencesAnchor: key,
|
|
7380
|
-
value,
|
|
7381
|
-
startPosition: start,
|
|
7382
|
-
endPosition: end,
|
|
7383
|
-
kind: Kind.ANCHOR_REF,
|
|
7384
|
-
parent: null
|
|
7385
|
-
};
|
|
7386
|
-
}
|
|
7387
|
-
exports$1.newAnchorRef = newAnchorRef;
|
|
7388
|
-
function newScalar(v = "") {
|
|
7389
|
-
const result = {
|
|
7390
|
-
errors: [],
|
|
7391
|
-
startPosition: -1,
|
|
7392
|
-
endPosition: -1,
|
|
7393
|
-
value: "" + v,
|
|
7394
|
-
kind: Kind.SCALAR,
|
|
7395
|
-
parent: null,
|
|
7396
|
-
doubleQuoted: false,
|
|
7397
|
-
rawValue: "" + v
|
|
7398
|
-
};
|
|
7399
|
-
if (typeof v !== "string") result.valueObject = v;
|
|
7400
|
-
return result;
|
|
7401
|
-
}
|
|
7402
|
-
exports$1.newScalar = newScalar;
|
|
7403
|
-
function newItems() {
|
|
7404
|
-
return {
|
|
7405
|
-
errors: [],
|
|
7406
|
-
startPosition: -1,
|
|
7407
|
-
endPosition: -1,
|
|
7408
|
-
items: [],
|
|
7409
|
-
kind: Kind.SEQ,
|
|
7410
|
-
parent: null
|
|
7411
|
-
};
|
|
7412
|
-
}
|
|
7413
|
-
exports$1.newItems = newItems;
|
|
7414
|
-
function newSeq() {
|
|
7415
|
-
return newItems();
|
|
7416
|
-
}
|
|
7417
|
-
exports$1.newSeq = newSeq;
|
|
7418
|
-
function newMap(mappings) {
|
|
7419
|
-
return {
|
|
7420
|
-
errors: [],
|
|
7421
|
-
startPosition: -1,
|
|
7422
|
-
endPosition: -1,
|
|
7423
|
-
mappings: mappings ? mappings : [],
|
|
7424
|
-
kind: Kind.MAP,
|
|
7425
|
-
parent: null
|
|
7426
|
-
};
|
|
7427
|
-
}
|
|
7428
|
-
exports$1.newMap = newMap;
|
|
7429
|
-
}));
|
|
7430
|
-
var require_common = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
7431
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7432
|
-
function isNothing(subject) {
|
|
7433
|
-
return typeof subject === "undefined" || null === subject;
|
|
7434
|
-
}
|
|
7435
|
-
exports$1.isNothing = isNothing;
|
|
7436
|
-
function isObject(subject) {
|
|
7437
|
-
return typeof subject === "object" && null !== subject;
|
|
7438
|
-
}
|
|
7439
|
-
exports$1.isObject = isObject;
|
|
7440
|
-
function toArray(sequence) {
|
|
7441
|
-
if (Array.isArray(sequence)) return sequence;
|
|
7442
|
-
else if (isNothing(sequence)) return [];
|
|
7443
|
-
return [sequence];
|
|
7444
|
-
}
|
|
7445
|
-
exports$1.toArray = toArray;
|
|
7446
|
-
function extend(target, source) {
|
|
7447
|
-
var index;
|
|
7448
|
-
var length;
|
|
7449
|
-
var key;
|
|
7450
|
-
var sourceKeys;
|
|
7451
|
-
if (source) {
|
|
7452
|
-
sourceKeys = Object.keys(source);
|
|
7453
|
-
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
7454
|
-
key = sourceKeys[index];
|
|
7455
|
-
target[key] = source[key];
|
|
7456
|
-
}
|
|
7457
|
-
}
|
|
7458
|
-
return target;
|
|
7459
|
-
}
|
|
7460
|
-
exports$1.extend = extend;
|
|
7461
|
-
function repeat(string, count) {
|
|
7462
|
-
var result = "";
|
|
7463
|
-
var cycle;
|
|
7464
|
-
for (cycle = 0; cycle < count; cycle += 1) result += string;
|
|
7465
|
-
return result;
|
|
7466
|
-
}
|
|
7467
|
-
exports$1.repeat = repeat;
|
|
7468
|
-
function isNegativeZero(number) {
|
|
7469
|
-
return 0 === number && Number.NEGATIVE_INFINITY === 1 / number;
|
|
7470
|
-
}
|
|
7471
|
-
exports$1.isNegativeZero = isNegativeZero;
|
|
7472
|
-
}));
|
|
7473
|
-
var require_exception = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7474
|
-
var YAMLException = class YAMLException2 {
|
|
7475
|
-
constructor(reason, mark = null, isWarning = false) {
|
|
7476
|
-
this.name = "YAMLException";
|
|
7477
|
-
this.reason = reason;
|
|
7478
|
-
this.mark = mark;
|
|
7479
|
-
this.message = this.toString(false);
|
|
7480
|
-
this.isWarning = isWarning;
|
|
7481
|
-
}
|
|
7482
|
-
static isInstance(instance) {
|
|
7483
|
-
if (instance != null && instance.getClassIdentifier && typeof instance.getClassIdentifier == "function") {
|
|
7484
|
-
for (let currentIdentifier of instance.getClassIdentifier()) if (currentIdentifier == YAMLException2.CLASS_IDENTIFIER) return true;
|
|
7485
|
-
}
|
|
7486
|
-
return false;
|
|
7487
|
-
}
|
|
7488
|
-
getClassIdentifier() {
|
|
7489
|
-
return [].concat(YAMLException2.CLASS_IDENTIFIER);
|
|
7490
|
-
}
|
|
7491
|
-
toString(compact = false) {
|
|
7492
|
-
var result = "JS-YAML: " + (this.reason || "(unknown reason)");
|
|
7493
|
-
if (!compact && this.mark) result += " " + this.mark.toString();
|
|
7494
|
-
return result;
|
|
7495
|
-
}
|
|
7496
|
-
};
|
|
7497
|
-
YAMLException.CLASS_IDENTIFIER = "yaml-ast-parser.YAMLException";
|
|
7498
|
-
module.exports = YAMLException;
|
|
7499
|
-
}));
|
|
7500
|
-
var require_mark = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7501
|
-
const common = require_common();
|
|
7502
|
-
var Mark = class {
|
|
7503
|
-
constructor(name, buffer, position, line, column) {
|
|
7504
|
-
this.name = name;
|
|
7505
|
-
this.buffer = buffer;
|
|
7506
|
-
this.position = position;
|
|
7507
|
-
this.line = line;
|
|
7508
|
-
this.column = column;
|
|
7509
|
-
}
|
|
7510
|
-
getSnippet(indent = 0, maxLength = 75) {
|
|
7511
|
-
var head;
|
|
7512
|
-
var start;
|
|
7513
|
-
var tail;
|
|
7514
|
-
var end;
|
|
7515
|
-
var snippet;
|
|
7516
|
-
if (!this.buffer) return null;
|
|
7517
|
-
indent = indent || 4;
|
|
7518
|
-
maxLength = maxLength || 75;
|
|
7519
|
-
head = "";
|
|
7520
|
-
start = this.position;
|
|
7521
|
-
while (start > 0 && -1 === "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1))) {
|
|
7522
|
-
start -= 1;
|
|
7523
|
-
if (this.position - start > maxLength / 2 - 1) {
|
|
7524
|
-
head = " ... ";
|
|
7525
|
-
start += 5;
|
|
7526
|
-
break;
|
|
7527
|
-
}
|
|
7528
|
-
}
|
|
7529
|
-
tail = "";
|
|
7530
|
-
end = this.position;
|
|
7531
|
-
while (end < this.buffer.length && -1 === "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end))) {
|
|
7532
|
-
end += 1;
|
|
7533
|
-
if (end - this.position > maxLength / 2 - 1) {
|
|
7534
|
-
tail = " ... ";
|
|
7535
|
-
end -= 5;
|
|
7536
|
-
break;
|
|
7537
|
-
}
|
|
7538
|
-
}
|
|
7539
|
-
snippet = this.buffer.slice(start, end);
|
|
7540
|
-
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
7541
|
-
}
|
|
7542
|
-
toString(compact = true) {
|
|
7543
|
-
var snippet;
|
|
7544
|
-
var where = "";
|
|
7545
|
-
if (this.name) where += 'in "' + this.name + '" ';
|
|
7546
|
-
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
|
7547
|
-
if (!compact) {
|
|
7548
|
-
snippet = this.getSnippet();
|
|
7549
|
-
if (snippet) where += ":\n" + snippet;
|
|
7550
|
-
}
|
|
7551
|
-
return where;
|
|
7552
|
-
}
|
|
7553
|
-
};
|
|
7554
|
-
module.exports = Mark;
|
|
7555
|
-
}));
|
|
7556
|
-
var require_type = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
7557
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7558
|
-
const YAMLException = require_exception();
|
|
7559
|
-
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
7560
|
-
"kind",
|
|
7561
|
-
"resolve",
|
|
7562
|
-
"construct",
|
|
7563
|
-
"instanceOf",
|
|
7564
|
-
"predicate",
|
|
7565
|
-
"represent",
|
|
7566
|
-
"defaultStyle",
|
|
7567
|
-
"styleAliases"
|
|
7568
|
-
];
|
|
7569
|
-
var YAML_NODE_KINDS = [
|
|
7570
|
-
"scalar",
|
|
7571
|
-
"sequence",
|
|
7572
|
-
"mapping"
|
|
7573
|
-
];
|
|
7574
|
-
function compileStyleAliases(map) {
|
|
7575
|
-
var result = {};
|
|
7576
|
-
if (null !== map) Object.keys(map).forEach(function(style) {
|
|
7577
|
-
map[style].forEach(function(alias) {
|
|
7578
|
-
result[String(alias)] = style;
|
|
7579
|
-
});
|
|
7580
|
-
});
|
|
7581
|
-
return result;
|
|
7582
|
-
}
|
|
7583
|
-
var Type = class {
|
|
7584
|
-
constructor(tag, options) {
|
|
7585
|
-
options = options || {};
|
|
7586
|
-
Object.keys(options).forEach(function(name) {
|
|
7587
|
-
if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
7588
|
-
});
|
|
7589
|
-
this.tag = tag;
|
|
7590
|
-
this.kind = options["kind"] || null;
|
|
7591
|
-
this.resolve = options["resolve"] || function() {
|
|
7592
|
-
return true;
|
|
7593
|
-
};
|
|
7594
|
-
this.construct = options["construct"] || function(data) {
|
|
7595
|
-
return data;
|
|
7596
|
-
};
|
|
7597
|
-
this.instanceOf = options["instanceOf"] || null;
|
|
7598
|
-
this.predicate = options["predicate"] || null;
|
|
7599
|
-
this.represent = options["represent"] || null;
|
|
7600
|
-
this.defaultStyle = options["defaultStyle"] || null;
|
|
7601
|
-
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
7602
|
-
if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
7603
|
-
}
|
|
7604
|
-
};
|
|
7605
|
-
exports$1.Type = Type;
|
|
7606
|
-
}));
|
|
7607
|
-
var require_schema = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
7608
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7609
|
-
const common = require_common();
|
|
7610
|
-
const YAMLException = require_exception();
|
|
7611
|
-
const type_1 = require_type();
|
|
7612
|
-
function compileList(schema, name, result) {
|
|
7613
|
-
var exclude = [];
|
|
7614
|
-
schema.include.forEach(function(includedSchema) {
|
|
7615
|
-
result = compileList(includedSchema, name, result);
|
|
7616
|
-
});
|
|
7617
|
-
schema[name].forEach(function(currentType) {
|
|
7618
|
-
result.forEach(function(previousType, previousIndex) {
|
|
7619
|
-
if (previousType.tag === currentType.tag) exclude.push(previousIndex);
|
|
7620
|
-
});
|
|
7621
|
-
result.push(currentType);
|
|
7622
|
-
});
|
|
7623
|
-
return result.filter(function(type, index) {
|
|
7624
|
-
return -1 === exclude.indexOf(index);
|
|
7625
|
-
});
|
|
7626
|
-
}
|
|
7627
|
-
function compileMap() {
|
|
7628
|
-
var result = {};
|
|
7629
|
-
var index;
|
|
7630
|
-
var length;
|
|
7631
|
-
function collectType(type) {
|
|
7632
|
-
result[type.tag] = type;
|
|
7633
|
-
}
|
|
7634
|
-
for (index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
|
|
7635
|
-
return result;
|
|
7636
|
-
}
|
|
7637
|
-
var Schema = class {
|
|
7638
|
-
constructor(definition) {
|
|
7639
|
-
this.include = definition.include || [];
|
|
7640
|
-
this.implicit = definition.implicit || [];
|
|
7641
|
-
this.explicit = definition.explicit || [];
|
|
7642
|
-
this.implicit.forEach(function(type) {
|
|
7643
|
-
if (type.loadKind && "scalar" !== type.loadKind) throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
7644
|
-
});
|
|
7645
|
-
this.compiledImplicit = compileList(this, "implicit", []);
|
|
7646
|
-
this.compiledExplicit = compileList(this, "explicit", []);
|
|
7647
|
-
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
7648
|
-
}
|
|
7649
|
-
};
|
|
7650
|
-
exports$1.Schema = Schema;
|
|
7651
|
-
Schema.DEFAULT = null;
|
|
7652
|
-
Schema.create = function createSchema() {
|
|
7653
|
-
var schemas;
|
|
7654
|
-
var types;
|
|
7655
|
-
switch (arguments.length) {
|
|
7656
|
-
case 1:
|
|
7657
|
-
schemas = Schema.DEFAULT;
|
|
7658
|
-
types = arguments[0];
|
|
7659
|
-
break;
|
|
7660
|
-
case 2:
|
|
7661
|
-
schemas = arguments[0];
|
|
7662
|
-
types = arguments[1];
|
|
7663
|
-
break;
|
|
7664
|
-
default:
|
|
7665
|
-
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
7666
|
-
}
|
|
7667
|
-
schemas = common.toArray(schemas);
|
|
7668
|
-
types = common.toArray(types);
|
|
7669
|
-
if (!schemas.every(function(schema) {
|
|
7670
|
-
return schema instanceof Schema;
|
|
7671
|
-
})) throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
7672
|
-
if (!types.every(function(type) {
|
|
7673
|
-
return type instanceof type_1.Type;
|
|
7674
|
-
})) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
7675
|
-
return new Schema({
|
|
7676
|
-
include: schemas,
|
|
7677
|
-
explicit: types
|
|
7678
|
-
});
|
|
7679
|
-
};
|
|
7680
|
-
}));
|
|
7681
|
-
var require_str = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7682
|
-
module.exports = new (require_type()).Type("tag:yaml.org,2002:str", {
|
|
7683
|
-
kind: "scalar",
|
|
7684
|
-
construct: function(data) {
|
|
7685
|
-
return null !== data ? data : "";
|
|
7686
|
-
}
|
|
7687
|
-
});
|
|
7688
|
-
}));
|
|
7689
|
-
var require_seq = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7690
|
-
module.exports = new (require_type()).Type("tag:yaml.org,2002:seq", {
|
|
7691
|
-
kind: "sequence",
|
|
7692
|
-
construct: function(data) {
|
|
7693
|
-
return null !== data ? data : [];
|
|
7694
|
-
}
|
|
7695
|
-
});
|
|
7696
|
-
}));
|
|
7697
|
-
var require_map = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7698
|
-
module.exports = new (require_type()).Type("tag:yaml.org,2002:map", {
|
|
7699
|
-
kind: "mapping",
|
|
7700
|
-
construct: function(data) {
|
|
7701
|
-
return null !== data ? data : {};
|
|
7702
|
-
}
|
|
7703
|
-
});
|
|
7704
|
-
}));
|
|
7705
|
-
var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7706
|
-
module.exports = new (require_schema()).Schema({ explicit: [
|
|
7707
|
-
require_str(),
|
|
7708
|
-
require_seq(),
|
|
7709
|
-
require_map()
|
|
7710
|
-
] });
|
|
7711
|
-
}));
|
|
7712
|
-
var require_null = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7713
|
-
const type_1 = require_type();
|
|
7714
|
-
function resolveYamlNull(data) {
|
|
7715
|
-
if (null === data) return true;
|
|
7716
|
-
var max = data.length;
|
|
7717
|
-
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
7718
|
-
}
|
|
7719
|
-
function constructYamlNull() {
|
|
7720
|
-
return null;
|
|
7721
|
-
}
|
|
7722
|
-
function isNull(object) {
|
|
7723
|
-
return null === object;
|
|
7724
|
-
}
|
|
7725
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:null", {
|
|
7726
|
-
kind: "scalar",
|
|
7727
|
-
resolve: resolveYamlNull,
|
|
7728
|
-
construct: constructYamlNull,
|
|
7729
|
-
predicate: isNull,
|
|
7730
|
-
represent: {
|
|
7731
|
-
canonical: function() {
|
|
7732
|
-
return "~";
|
|
7733
|
-
},
|
|
7734
|
-
lowercase: function() {
|
|
7735
|
-
return "null";
|
|
7736
|
-
},
|
|
7737
|
-
uppercase: function() {
|
|
7738
|
-
return "NULL";
|
|
7739
|
-
},
|
|
7740
|
-
camelcase: function() {
|
|
7741
|
-
return "Null";
|
|
7742
|
-
}
|
|
7743
|
-
},
|
|
7744
|
-
defaultStyle: "lowercase"
|
|
7745
|
-
});
|
|
7746
|
-
}));
|
|
7747
|
-
var require_bool = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7748
|
-
const type_1 = require_type();
|
|
7749
|
-
function resolveYamlBoolean(data) {
|
|
7750
|
-
if (null === data) return false;
|
|
7751
|
-
var max = data.length;
|
|
7752
|
-
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
7753
|
-
}
|
|
7754
|
-
function constructYamlBoolean(data) {
|
|
7755
|
-
return data === "true" || data === "True" || data === "TRUE";
|
|
7756
|
-
}
|
|
7757
|
-
function isBoolean(object) {
|
|
7758
|
-
return "[object Boolean]" === Object.prototype.toString.call(object);
|
|
7759
|
-
}
|
|
7760
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:bool", {
|
|
7761
|
-
kind: "scalar",
|
|
7762
|
-
resolve: resolveYamlBoolean,
|
|
7763
|
-
construct: constructYamlBoolean,
|
|
7764
|
-
predicate: isBoolean,
|
|
7765
|
-
represent: {
|
|
7766
|
-
lowercase: function(object) {
|
|
7767
|
-
return object ? "true" : "false";
|
|
7768
|
-
},
|
|
7769
|
-
uppercase: function(object) {
|
|
7770
|
-
return object ? "TRUE" : "FALSE";
|
|
7771
|
-
},
|
|
7772
|
-
camelcase: function(object) {
|
|
7773
|
-
return object ? "True" : "False";
|
|
7774
|
-
}
|
|
7775
|
-
},
|
|
7776
|
-
defaultStyle: "lowercase"
|
|
7777
|
-
});
|
|
7778
|
-
}));
|
|
7779
|
-
var require_int = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7780
|
-
const common = require_common();
|
|
7781
|
-
const type_1 = require_type();
|
|
7782
|
-
function isHexCode(c) {
|
|
7783
|
-
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
7784
|
-
}
|
|
7785
|
-
function isOctCode(c) {
|
|
7786
|
-
return 48 <= c && c <= 55;
|
|
7787
|
-
}
|
|
7788
|
-
function isDecCode(c) {
|
|
7789
|
-
return 48 <= c && c <= 57;
|
|
7790
|
-
}
|
|
7791
|
-
function resolveYamlInteger(data) {
|
|
7792
|
-
if (null === data) return false;
|
|
7793
|
-
var max = data.length;
|
|
7794
|
-
var index = 0;
|
|
7795
|
-
var hasDigits = false;
|
|
7796
|
-
var ch;
|
|
7797
|
-
if (!max) return false;
|
|
7798
|
-
ch = data[index];
|
|
7799
|
-
if (ch === "-" || ch === "+") ch = data[++index];
|
|
7800
|
-
if (ch === "0") {
|
|
7801
|
-
if (index + 1 === max) return true;
|
|
7802
|
-
ch = data[++index];
|
|
7803
|
-
if (ch === "b") {
|
|
7804
|
-
index++;
|
|
7805
|
-
for (; index < max; index++) {
|
|
7806
|
-
ch = data[index];
|
|
7807
|
-
if (ch === "_") continue;
|
|
7808
|
-
if (ch !== "0" && ch !== "1") return false;
|
|
7809
|
-
hasDigits = true;
|
|
7810
|
-
}
|
|
7811
|
-
return hasDigits;
|
|
7812
|
-
}
|
|
7813
|
-
if (ch === "x") {
|
|
7814
|
-
index++;
|
|
7815
|
-
for (; index < max; index++) {
|
|
7816
|
-
ch = data[index];
|
|
7817
|
-
if (ch === "_") continue;
|
|
7818
|
-
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
7819
|
-
hasDigits = true;
|
|
7820
|
-
}
|
|
7821
|
-
return hasDigits;
|
|
7822
|
-
}
|
|
7823
|
-
for (; index < max; index++) {
|
|
7824
|
-
ch = data[index];
|
|
7825
|
-
if (ch === "_") continue;
|
|
7826
|
-
if (!isOctCode(data.charCodeAt(index))) {
|
|
7827
|
-
hasDigits = false;
|
|
7828
|
-
break;
|
|
7829
|
-
}
|
|
7830
|
-
hasDigits = true;
|
|
7831
|
-
}
|
|
7832
|
-
if (hasDigits) return hasDigits;
|
|
7833
|
-
}
|
|
7834
|
-
for (; index < max; index++) {
|
|
7835
|
-
ch = data[index];
|
|
7836
|
-
if (ch === "_") continue;
|
|
7837
|
-
if (ch === ":") break;
|
|
7838
|
-
if (!isDecCode(data.charCodeAt(index))) return false;
|
|
7839
|
-
hasDigits = true;
|
|
7840
|
-
}
|
|
7841
|
-
if (!hasDigits) return false;
|
|
7842
|
-
if (ch !== ":") return true;
|
|
7843
|
-
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
7844
|
-
}
|
|
7845
|
-
function constructYamlInteger(data) {
|
|
7846
|
-
var value = data;
|
|
7847
|
-
var sign = 1;
|
|
7848
|
-
var ch;
|
|
7849
|
-
var base;
|
|
7850
|
-
var digits = [];
|
|
7851
|
-
if (value.indexOf("_") !== -1) value = value.replace(/_/g, "");
|
|
7852
|
-
ch = value[0];
|
|
7853
|
-
if (ch === "-" || ch === "+") {
|
|
7854
|
-
if (ch === "-") sign = -1;
|
|
7855
|
-
value = value.slice(1);
|
|
7856
|
-
ch = value[0];
|
|
7857
|
-
}
|
|
7858
|
-
if ("0" === value) return 0;
|
|
7859
|
-
if (ch === "0") {
|
|
7860
|
-
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
7861
|
-
if (value[1] === "x") return sign * parseInt(value, 16);
|
|
7862
|
-
return sign * parseInt(value, 8);
|
|
7863
|
-
}
|
|
7864
|
-
if (value.indexOf(":") !== -1) {
|
|
7865
|
-
value.split(":").forEach(function(v) {
|
|
7866
|
-
digits.unshift(parseInt(v, 10));
|
|
7867
|
-
});
|
|
7868
|
-
value = 0;
|
|
7869
|
-
base = 1;
|
|
7870
|
-
digits.forEach(function(d) {
|
|
7871
|
-
value += d * base;
|
|
7872
|
-
base *= 60;
|
|
7873
|
-
});
|
|
7874
|
-
return sign * value;
|
|
7875
|
-
}
|
|
7876
|
-
return sign * parseInt(value, 10);
|
|
7877
|
-
}
|
|
7878
|
-
function isInteger(object) {
|
|
7879
|
-
const type = Object.prototype.toString.call(object);
|
|
7880
|
-
return "[object Number]" === type && 0 === object % 1 && !common.isNegativeZero(object) || "[object BigInt]" === type;
|
|
7881
|
-
}
|
|
7882
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:int", {
|
|
7883
|
-
kind: "scalar",
|
|
7884
|
-
resolve: resolveYamlInteger,
|
|
7885
|
-
construct: constructYamlInteger,
|
|
7886
|
-
predicate: isInteger,
|
|
7887
|
-
represent: {
|
|
7888
|
-
binary: function(object) {
|
|
7889
|
-
return "0b" + object.toString(2);
|
|
7890
|
-
},
|
|
7891
|
-
octal: function(object) {
|
|
7892
|
-
return "0" + object.toString(8);
|
|
7893
|
-
},
|
|
7894
|
-
decimal: function(object) {
|
|
7895
|
-
return object.toString(10);
|
|
7896
|
-
},
|
|
7897
|
-
hexadecimal: function(object) {
|
|
7898
|
-
return "0x" + object.toString(16).toUpperCase();
|
|
7899
|
-
}
|
|
7900
|
-
},
|
|
7901
|
-
defaultStyle: "decimal",
|
|
7902
|
-
styleAliases: {
|
|
7903
|
-
binary: [2, "bin"],
|
|
7904
|
-
octal: [8, "oct"],
|
|
7905
|
-
decimal: [10, "dec"],
|
|
7906
|
-
hexadecimal: [16, "hex"]
|
|
7907
|
-
}
|
|
7908
|
-
});
|
|
7909
|
-
}));
|
|
7910
|
-
var require_float = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7911
|
-
const common = require_common();
|
|
7912
|
-
const type_1 = require_type();
|
|
7913
|
-
var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
7914
|
-
function resolveYamlFloat(data) {
|
|
7915
|
-
if (null === data) return false;
|
|
7916
|
-
if (!YAML_FLOAT_PATTERN.test(data)) return false;
|
|
7917
|
-
return true;
|
|
7918
|
-
}
|
|
7919
|
-
function constructYamlFloat(data) {
|
|
7920
|
-
var value = data.replace(/_/g, "").toLowerCase();
|
|
7921
|
-
var sign = "-" === value[0] ? -1 : 1;
|
|
7922
|
-
var base;
|
|
7923
|
-
var digits = [];
|
|
7924
|
-
if (0 <= "+-".indexOf(value[0])) value = value.slice(1);
|
|
7925
|
-
if (".inf" === value) return 1 === sign ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
7926
|
-
else if (".nan" === value) return NaN;
|
|
7927
|
-
else if (0 <= value.indexOf(":")) {
|
|
7928
|
-
value.split(":").forEach(function(v) {
|
|
7929
|
-
digits.unshift(parseFloat(v, 10));
|
|
7930
|
-
});
|
|
7931
|
-
value = 0;
|
|
7932
|
-
base = 1;
|
|
7933
|
-
digits.forEach(function(d) {
|
|
7934
|
-
value += d * base;
|
|
7935
|
-
base *= 60;
|
|
7936
|
-
});
|
|
7937
|
-
return sign * value;
|
|
7938
|
-
}
|
|
7939
|
-
return sign * parseFloat(value, 10);
|
|
7940
|
-
}
|
|
7941
|
-
function representYamlFloat(object, style) {
|
|
7942
|
-
if (isNaN(object)) switch (style) {
|
|
7943
|
-
case "lowercase":
|
|
7944
|
-
return ".nan";
|
|
7945
|
-
case "uppercase":
|
|
7946
|
-
return ".NAN";
|
|
7947
|
-
case "camelcase":
|
|
7948
|
-
return ".NaN";
|
|
7949
|
-
}
|
|
7950
|
-
else if (Number.POSITIVE_INFINITY === object) switch (style) {
|
|
7951
|
-
case "lowercase":
|
|
7952
|
-
return ".inf";
|
|
7953
|
-
case "uppercase":
|
|
7954
|
-
return ".INF";
|
|
7955
|
-
case "camelcase":
|
|
7956
|
-
return ".Inf";
|
|
7957
|
-
}
|
|
7958
|
-
else if (Number.NEGATIVE_INFINITY === object) switch (style) {
|
|
7959
|
-
case "lowercase":
|
|
7960
|
-
return "-.inf";
|
|
7961
|
-
case "uppercase":
|
|
7962
|
-
return "-.INF";
|
|
7963
|
-
case "camelcase":
|
|
7964
|
-
return "-.Inf";
|
|
7965
|
-
}
|
|
7966
|
-
else if (common.isNegativeZero(object)) return "-0.0";
|
|
7967
|
-
return object.toString(10);
|
|
7968
|
-
}
|
|
7969
|
-
function isFloat(object) {
|
|
7970
|
-
return "[object Number]" === Object.prototype.toString.call(object) && (0 !== object % 1 || common.isNegativeZero(object));
|
|
7971
|
-
}
|
|
7972
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:float", {
|
|
7973
|
-
kind: "scalar",
|
|
7974
|
-
resolve: resolveYamlFloat,
|
|
7975
|
-
construct: constructYamlFloat,
|
|
7976
|
-
predicate: isFloat,
|
|
7977
|
-
represent: representYamlFloat,
|
|
7978
|
-
defaultStyle: "lowercase"
|
|
7979
|
-
});
|
|
7980
|
-
}));
|
|
7981
|
-
var require_json = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7982
|
-
module.exports = new (require_schema()).Schema({
|
|
7983
|
-
include: [require_failsafe()],
|
|
7984
|
-
implicit: [
|
|
7985
|
-
require_null(),
|
|
7986
|
-
require_bool(),
|
|
7987
|
-
require_int(),
|
|
7988
|
-
require_float()
|
|
7989
|
-
]
|
|
7990
|
-
});
|
|
7991
|
-
}));
|
|
7992
|
-
var require_core = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7993
|
-
module.exports = new (require_schema()).Schema({ include: [require_json()] });
|
|
7994
|
-
}));
|
|
7995
|
-
var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
7996
|
-
const type_1 = require_type();
|
|
7997
|
-
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([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]))?))?)?$");
|
|
7998
|
-
function resolveYamlTimestamp(data) {
|
|
7999
|
-
if (null === data) return false;
|
|
8000
|
-
if (null === YAML_TIMESTAMP_REGEXP.exec(data)) return false;
|
|
8001
|
-
return true;
|
|
8002
|
-
}
|
|
8003
|
-
function constructYamlTimestamp(data) {
|
|
8004
|
-
var match;
|
|
8005
|
-
var year;
|
|
8006
|
-
var month;
|
|
8007
|
-
var day;
|
|
8008
|
-
var hour;
|
|
8009
|
-
var minute;
|
|
8010
|
-
var second;
|
|
8011
|
-
var fraction = 0;
|
|
8012
|
-
var delta = null;
|
|
8013
|
-
var tz_hour;
|
|
8014
|
-
var tz_minute;
|
|
8015
|
-
var date;
|
|
8016
|
-
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
8017
|
-
if (null === match) throw new Error("Date resolve error");
|
|
8018
|
-
year = +match[1];
|
|
8019
|
-
month = +match[2] - 1;
|
|
8020
|
-
day = +match[3];
|
|
8021
|
-
if (!match[4]) return new Date(Date.UTC(year, month, day));
|
|
8022
|
-
hour = +match[4];
|
|
8023
|
-
minute = +match[5];
|
|
8024
|
-
second = +match[6];
|
|
8025
|
-
if (match[7]) {
|
|
8026
|
-
fraction = match[7].slice(0, 3);
|
|
8027
|
-
while (fraction.length < 3) fraction = fraction + "0";
|
|
8028
|
-
fraction = +fraction;
|
|
8029
|
-
}
|
|
8030
|
-
if (match[9]) {
|
|
8031
|
-
tz_hour = +match[10];
|
|
8032
|
-
tz_minute = +(match[11] || 0);
|
|
8033
|
-
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
8034
|
-
if ("-" === match[9]) delta = -delta;
|
|
8035
|
-
}
|
|
8036
|
-
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
8037
|
-
if (delta) date.setTime(date.getTime() - delta);
|
|
8038
|
-
return date;
|
|
8039
|
-
}
|
|
8040
|
-
function representYamlTimestamp(object) {
|
|
8041
|
-
return object.toISOString();
|
|
8042
|
-
}
|
|
8043
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:timestamp", {
|
|
8044
|
-
kind: "scalar",
|
|
8045
|
-
resolve: resolveYamlTimestamp,
|
|
8046
|
-
construct: constructYamlTimestamp,
|
|
8047
|
-
instanceOf: Date,
|
|
8048
|
-
represent: representYamlTimestamp
|
|
8049
|
-
});
|
|
8050
|
-
}));
|
|
8051
|
-
var require_merge = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8052
|
-
const type_1 = require_type();
|
|
8053
|
-
function resolveYamlMerge(data) {
|
|
8054
|
-
return "<<" === data || null === data;
|
|
8055
|
-
}
|
|
8056
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:merge", {
|
|
8057
|
-
kind: "scalar",
|
|
8058
|
-
resolve: resolveYamlMerge
|
|
8059
|
-
});
|
|
8060
|
-
}));
|
|
8061
|
-
var require_binary = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8062
|
-
var NodeBuffer = __require("buffer").Buffer;
|
|
8063
|
-
const type_1 = require_type();
|
|
8064
|
-
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
8065
|
-
function resolveYamlBinary(data) {
|
|
8066
|
-
if (null === data) return false;
|
|
8067
|
-
var code;
|
|
8068
|
-
var idx;
|
|
8069
|
-
var bitlen = 0;
|
|
8070
|
-
var max = data.length;
|
|
8071
|
-
var map = BASE64_MAP;
|
|
8072
|
-
for (idx = 0; idx < max; idx++) {
|
|
8073
|
-
code = map.indexOf(data.charAt(idx));
|
|
8074
|
-
if (code > 64) continue;
|
|
8075
|
-
if (code < 0) return false;
|
|
8076
|
-
bitlen += 6;
|
|
8077
|
-
}
|
|
8078
|
-
return bitlen % 8 === 0;
|
|
8079
|
-
}
|
|
8080
|
-
function constructYamlBinary(data) {
|
|
8081
|
-
var idx;
|
|
8082
|
-
var tailbits;
|
|
8083
|
-
var input = data.replace(/[\r\n=]/g, "");
|
|
8084
|
-
var max = input.length;
|
|
8085
|
-
var map = BASE64_MAP;
|
|
8086
|
-
var bits = 0;
|
|
8087
|
-
var result = [];
|
|
8088
|
-
for (idx = 0; idx < max; idx++) {
|
|
8089
|
-
if (idx % 4 === 0 && idx) {
|
|
8090
|
-
result.push(bits >> 16 & 255);
|
|
8091
|
-
result.push(bits >> 8 & 255);
|
|
8092
|
-
result.push(bits & 255);
|
|
8093
|
-
}
|
|
8094
|
-
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
8095
|
-
}
|
|
8096
|
-
tailbits = max % 4 * 6;
|
|
8097
|
-
if (tailbits === 0) {
|
|
8098
|
-
result.push(bits >> 16 & 255);
|
|
8099
|
-
result.push(bits >> 8 & 255);
|
|
8100
|
-
result.push(bits & 255);
|
|
8101
|
-
} else if (tailbits === 18) {
|
|
8102
|
-
result.push(bits >> 10 & 255);
|
|
8103
|
-
result.push(bits >> 2 & 255);
|
|
8104
|
-
} else if (tailbits === 12) result.push(bits >> 4 & 255);
|
|
8105
|
-
if (NodeBuffer) return new NodeBuffer(result);
|
|
8106
|
-
return result;
|
|
8107
|
-
}
|
|
8108
|
-
function representYamlBinary(object) {
|
|
8109
|
-
var result = "";
|
|
8110
|
-
var bits = 0;
|
|
8111
|
-
var idx;
|
|
8112
|
-
var tail;
|
|
8113
|
-
var max = object.length;
|
|
8114
|
-
var map = BASE64_MAP;
|
|
8115
|
-
for (idx = 0; idx < max; idx++) {
|
|
8116
|
-
if (idx % 3 === 0 && idx) {
|
|
8117
|
-
result += map[bits >> 18 & 63];
|
|
8118
|
-
result += map[bits >> 12 & 63];
|
|
8119
|
-
result += map[bits >> 6 & 63];
|
|
8120
|
-
result += map[bits & 63];
|
|
8121
|
-
}
|
|
8122
|
-
bits = (bits << 8) + object[idx];
|
|
8123
|
-
}
|
|
8124
|
-
tail = max % 3;
|
|
8125
|
-
if (tail === 0) {
|
|
8126
|
-
result += map[bits >> 18 & 63];
|
|
8127
|
-
result += map[bits >> 12 & 63];
|
|
8128
|
-
result += map[bits >> 6 & 63];
|
|
8129
|
-
result += map[bits & 63];
|
|
8130
|
-
} else if (tail === 2) {
|
|
8131
|
-
result += map[bits >> 10 & 63];
|
|
8132
|
-
result += map[bits >> 4 & 63];
|
|
8133
|
-
result += map[bits << 2 & 63];
|
|
8134
|
-
result += map[64];
|
|
8135
|
-
} else if (tail === 1) {
|
|
8136
|
-
result += map[bits >> 2 & 63];
|
|
8137
|
-
result += map[bits << 4 & 63];
|
|
8138
|
-
result += map[64];
|
|
8139
|
-
result += map[64];
|
|
8140
|
-
}
|
|
8141
|
-
return result;
|
|
8142
|
-
}
|
|
8143
|
-
function isBinary(object) {
|
|
8144
|
-
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
8145
|
-
}
|
|
8146
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:binary", {
|
|
8147
|
-
kind: "scalar",
|
|
8148
|
-
resolve: resolveYamlBinary,
|
|
8149
|
-
construct: constructYamlBinary,
|
|
8150
|
-
predicate: isBinary,
|
|
8151
|
-
represent: representYamlBinary
|
|
8152
|
-
});
|
|
8153
|
-
}));
|
|
8154
|
-
var require_omap = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8155
|
-
const type_1 = require_type();
|
|
8156
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
8157
|
-
var _toString = Object.prototype.toString;
|
|
8158
|
-
function resolveYamlOmap(data) {
|
|
8159
|
-
if (null === data) return true;
|
|
8160
|
-
var objectKeys = [];
|
|
8161
|
-
var index;
|
|
8162
|
-
var length;
|
|
8163
|
-
var pair;
|
|
8164
|
-
var pairKey;
|
|
8165
|
-
var pairHasKey;
|
|
8166
|
-
var object = data;
|
|
8167
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
8168
|
-
pair = object[index];
|
|
8169
|
-
pairHasKey = false;
|
|
8170
|
-
if ("[object Object]" !== _toString.call(pair)) return false;
|
|
8171
|
-
for (pairKey in pair) if (_hasOwnProperty.call(pair, pairKey)) if (!pairHasKey) pairHasKey = true;
|
|
8172
|
-
else return false;
|
|
8173
|
-
if (!pairHasKey) return false;
|
|
8174
|
-
if (-1 === objectKeys.indexOf(pairKey)) objectKeys.push(pairKey);
|
|
8175
|
-
else return false;
|
|
8176
|
-
}
|
|
8177
|
-
return true;
|
|
8178
|
-
}
|
|
8179
|
-
function constructYamlOmap(data) {
|
|
8180
|
-
return null !== data ? data : [];
|
|
8181
|
-
}
|
|
8182
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:omap", {
|
|
8183
|
-
kind: "sequence",
|
|
8184
|
-
resolve: resolveYamlOmap,
|
|
8185
|
-
construct: constructYamlOmap
|
|
8186
|
-
});
|
|
8187
|
-
}));
|
|
8188
|
-
var require_pairs = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8189
|
-
const type_1 = require_type();
|
|
8190
|
-
const ast = require_yamlAST();
|
|
8191
|
-
var _toString = Object.prototype.toString;
|
|
8192
|
-
function resolveYamlPairs(data) {
|
|
8193
|
-
if (null === data) return true;
|
|
8194
|
-
if (data.kind != ast.Kind.SEQ) return false;
|
|
8195
|
-
var index;
|
|
8196
|
-
var length;
|
|
8197
|
-
var pair;
|
|
8198
|
-
var object = data.items;
|
|
8199
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
8200
|
-
pair = object[index];
|
|
8201
|
-
if ("[object Object]" !== _toString.call(pair)) return false;
|
|
8202
|
-
if (!Array.isArray(pair.mappings)) return false;
|
|
8203
|
-
if (1 !== pair.mappings.length) return false;
|
|
8204
|
-
}
|
|
8205
|
-
return true;
|
|
8206
|
-
}
|
|
8207
|
-
function constructYamlPairs(data) {
|
|
8208
|
-
if (null === data || !Array.isArray(data.items)) return [];
|
|
8209
|
-
let index;
|
|
8210
|
-
let length;
|
|
8211
|
-
let result;
|
|
8212
|
-
let object = data.items;
|
|
8213
|
-
result = ast.newItems();
|
|
8214
|
-
result.parent = data.parent;
|
|
8215
|
-
result.startPosition = data.startPosition;
|
|
8216
|
-
result.endPosition = data.endPosition;
|
|
8217
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
8218
|
-
let mapping = object[index].mappings[0];
|
|
8219
|
-
let pairSeq = ast.newItems();
|
|
8220
|
-
pairSeq.parent = result;
|
|
8221
|
-
pairSeq.startPosition = mapping.key.startPosition;
|
|
8222
|
-
pairSeq.endPosition = mapping.value.startPosition;
|
|
8223
|
-
mapping.key.parent = pairSeq;
|
|
8224
|
-
mapping.value.parent = pairSeq;
|
|
8225
|
-
pairSeq.items = [mapping.key, mapping.value];
|
|
8226
|
-
result.items.push(pairSeq);
|
|
8227
|
-
}
|
|
8228
|
-
return result;
|
|
8229
|
-
}
|
|
8230
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:pairs", {
|
|
8231
|
-
kind: "sequence",
|
|
8232
|
-
resolve: resolveYamlPairs,
|
|
8233
|
-
construct: constructYamlPairs
|
|
8234
|
-
});
|
|
8235
|
-
}));
|
|
8236
|
-
var require_set = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8237
|
-
const type_1 = require_type();
|
|
8238
|
-
const ast = require_yamlAST();
|
|
8239
|
-
function resolveYamlSet(data) {
|
|
8240
|
-
if (null === data) return true;
|
|
8241
|
-
if (data.kind != ast.Kind.MAP) return false;
|
|
8242
|
-
return true;
|
|
8243
|
-
}
|
|
8244
|
-
function constructYamlSet(data) {
|
|
8245
|
-
return null !== data ? data : {};
|
|
8246
|
-
}
|
|
8247
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:set", {
|
|
8248
|
-
kind: "mapping",
|
|
8249
|
-
resolve: resolveYamlSet,
|
|
8250
|
-
construct: constructYamlSet
|
|
8251
|
-
});
|
|
8252
|
-
}));
|
|
8253
|
-
var require_default_safe = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8254
|
-
module.exports = new (require_schema()).Schema({
|
|
8255
|
-
include: [require_core()],
|
|
8256
|
-
implicit: [require_timestamp(), require_merge()],
|
|
8257
|
-
explicit: [
|
|
8258
|
-
require_binary(),
|
|
8259
|
-
require_omap(),
|
|
8260
|
-
require_pairs(),
|
|
8261
|
-
require_set()
|
|
8262
|
-
]
|
|
8263
|
-
});
|
|
8264
|
-
}));
|
|
8265
|
-
var require_undefined = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8266
|
-
const type_1 = require_type();
|
|
8267
|
-
function resolveJavascriptUndefined() {
|
|
8268
|
-
return true;
|
|
8269
|
-
}
|
|
8270
|
-
function constructJavascriptUndefined() {
|
|
8271
|
-
}
|
|
8272
|
-
function representJavascriptUndefined() {
|
|
8273
|
-
return "";
|
|
8274
|
-
}
|
|
8275
|
-
function isUndefined(object) {
|
|
8276
|
-
return "undefined" === typeof object;
|
|
8277
|
-
}
|
|
8278
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:js/undefined", {
|
|
8279
|
-
kind: "scalar",
|
|
8280
|
-
resolve: resolveJavascriptUndefined,
|
|
8281
|
-
construct: constructJavascriptUndefined,
|
|
8282
|
-
predicate: isUndefined,
|
|
8283
|
-
represent: representJavascriptUndefined
|
|
8284
|
-
});
|
|
8285
|
-
}));
|
|
8286
|
-
var require_regexp = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8287
|
-
const type_1 = require_type();
|
|
8288
|
-
function resolveJavascriptRegExp(data) {
|
|
8289
|
-
if (null === data) return false;
|
|
8290
|
-
if (0 === data.length) return false;
|
|
8291
|
-
var regexp = data;
|
|
8292
|
-
var tail = /\/([gim]*)$/.exec(data);
|
|
8293
|
-
var modifiers = "";
|
|
8294
|
-
if ("/" === regexp[0]) {
|
|
8295
|
-
if (tail) modifiers = tail[1];
|
|
8296
|
-
if (modifiers.length > 3) return false;
|
|
8297
|
-
if (regexp[regexp.length - modifiers.length - 1] !== "/") return false;
|
|
8298
|
-
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
8299
|
-
}
|
|
8300
|
-
try {
|
|
8301
|
-
new RegExp(regexp, modifiers);
|
|
8302
|
-
return true;
|
|
8303
|
-
} catch (error) {
|
|
8304
|
-
return false;
|
|
8305
|
-
}
|
|
8306
|
-
}
|
|
8307
|
-
function constructJavascriptRegExp(data) {
|
|
8308
|
-
var regexp = data;
|
|
8309
|
-
var tail = /\/([gim]*)$/.exec(data);
|
|
8310
|
-
var modifiers = "";
|
|
8311
|
-
if ("/" === regexp[0]) {
|
|
8312
|
-
if (tail) modifiers = tail[1];
|
|
8313
|
-
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
8314
|
-
}
|
|
8315
|
-
return new RegExp(regexp, modifiers);
|
|
8316
|
-
}
|
|
8317
|
-
function representJavascriptRegExp(object) {
|
|
8318
|
-
var result = "/" + object.source + "/";
|
|
8319
|
-
if (object.global) result += "g";
|
|
8320
|
-
if (object.multiline) result += "m";
|
|
8321
|
-
if (object.ignoreCase) result += "i";
|
|
8322
|
-
return result;
|
|
8323
|
-
}
|
|
8324
|
-
function isRegExp(object) {
|
|
8325
|
-
return "[object RegExp]" === Object.prototype.toString.call(object);
|
|
8326
|
-
}
|
|
8327
|
-
module.exports = new type_1.Type("tag:yaml.org,2002:js/regexp", {
|
|
8328
|
-
kind: "scalar",
|
|
8329
|
-
resolve: resolveJavascriptRegExp,
|
|
8330
|
-
construct: constructJavascriptRegExp,
|
|
8331
|
-
predicate: isRegExp,
|
|
8332
|
-
represent: representJavascriptRegExp
|
|
8333
|
-
});
|
|
8334
|
-
}));
|
|
8335
|
-
var require_default_full = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8336
|
-
const schema_1 = require_schema();
|
|
8337
|
-
var schema = new schema_1.Schema({
|
|
8338
|
-
include: [require_default_safe()],
|
|
8339
|
-
explicit: [require_undefined(), require_regexp()]
|
|
8340
|
-
});
|
|
8341
|
-
schema_1.Schema.DEFAULT = schema;
|
|
8342
|
-
module.exports = schema;
|
|
8343
|
-
}));
|
|
8344
|
-
var require_loader = /* @__PURE__ */ __commonJSMin(((exports$1, module) => {
|
|
8345
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8346
|
-
const ast = require_yamlAST();
|
|
8347
|
-
const common = require_common();
|
|
8348
|
-
const YAMLException = require_exception();
|
|
8349
|
-
const Mark = require_mark();
|
|
8350
|
-
const DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
8351
|
-
const DEFAULT_FULL_SCHEMA = require_default_full();
|
|
8352
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
8353
|
-
var CONTEXT_FLOW_IN = 1;
|
|
8354
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
8355
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
8356
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
8357
|
-
var CHOMPING_CLIP = 1;
|
|
8358
|
-
var CHOMPING_STRIP = 2;
|
|
8359
|
-
var CHOMPING_KEEP = 3;
|
|
8360
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
8361
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
8362
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
8363
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
8364
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
8365
|
-
function is_EOL(c) {
|
|
8366
|
-
return c === 10 || c === 13;
|
|
8367
|
-
}
|
|
8368
|
-
function is_WHITE_SPACE(c) {
|
|
8369
|
-
return c === 9 || c === 32;
|
|
8370
|
-
}
|
|
8371
|
-
function is_WS_OR_EOL(c) {
|
|
8372
|
-
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
8373
|
-
}
|
|
8374
|
-
function is_FLOW_INDICATOR(c) {
|
|
8375
|
-
return 44 === c || 91 === c || 93 === c || 123 === c || 125 === c;
|
|
8376
|
-
}
|
|
8377
|
-
function fromHexCode(c) {
|
|
8378
|
-
var lc;
|
|
8379
|
-
if (48 <= c && c <= 57) return c - 48;
|
|
8380
|
-
lc = c | 32;
|
|
8381
|
-
if (97 <= lc && lc <= 102) return lc - 97 + 10;
|
|
8382
|
-
return -1;
|
|
8383
|
-
}
|
|
8384
|
-
function escapedHexLen(c) {
|
|
8385
|
-
if (c === 120) return 2;
|
|
8386
|
-
if (c === 117) return 4;
|
|
8387
|
-
if (c === 85) return 8;
|
|
8388
|
-
return 0;
|
|
8389
|
-
}
|
|
8390
|
-
function fromDecimalCode(c) {
|
|
8391
|
-
if (48 <= c && c <= 57) return c - 48;
|
|
8392
|
-
return -1;
|
|
8393
|
-
}
|
|
8394
|
-
function simpleEscapeSequence(c) {
|
|
8395
|
-
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" : "";
|
|
8396
|
-
}
|
|
8397
|
-
function charFromCodepoint(c) {
|
|
8398
|
-
if (c <= 65535) return String.fromCharCode(c);
|
|
8399
|
-
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
8400
|
-
}
|
|
8401
|
-
var simpleEscapeCheck = new Array(256);
|
|
8402
|
-
var simpleEscapeMap = new Array(256);
|
|
8403
|
-
var customEscapeCheck = new Array(256);
|
|
8404
|
-
var customEscapeMap = new Array(256);
|
|
8405
|
-
for (var i = 0; i < 256; i++) {
|
|
8406
|
-
customEscapeMap[i] = simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
8407
|
-
simpleEscapeCheck[i] = simpleEscapeMap[i] ? 1 : 0;
|
|
8408
|
-
customEscapeCheck[i] = 1;
|
|
8409
|
-
if (!simpleEscapeCheck[i]) customEscapeMap[i] = "\\" + String.fromCharCode(i);
|
|
8410
|
-
}
|
|
8411
|
-
var State = class {
|
|
8412
|
-
constructor(input, options) {
|
|
8413
|
-
this.errorMap = {};
|
|
8414
|
-
this.errors = [];
|
|
8415
|
-
this.lines = [];
|
|
8416
|
-
this.input = input;
|
|
8417
|
-
this.filename = options["filename"] || null;
|
|
8418
|
-
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
8419
|
-
this.onWarning = options["onWarning"] || null;
|
|
8420
|
-
this.legacy = options["legacy"] || false;
|
|
8421
|
-
this.allowAnyEscape = options["allowAnyEscape"] || false;
|
|
8422
|
-
this.ignoreDuplicateKeys = options["ignoreDuplicateKeys"] || false;
|
|
8423
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
8424
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
8425
|
-
this.length = input.length;
|
|
8426
|
-
this.position = 0;
|
|
8427
|
-
this.line = 0;
|
|
8428
|
-
this.lineStart = 0;
|
|
8429
|
-
this.lineIndent = 0;
|
|
8430
|
-
this.documents = [];
|
|
8431
|
-
}
|
|
8432
|
-
};
|
|
8433
|
-
function generateError(state, message, isWarning = false) {
|
|
8434
|
-
return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart), isWarning);
|
|
8435
|
-
}
|
|
8436
|
-
function throwErrorFromPosition(state, position, message, isWarning = false, toLineEnd = false) {
|
|
8437
|
-
var line = positionToLine(state, position);
|
|
8438
|
-
if (!line) return;
|
|
8439
|
-
var hash = message + position;
|
|
8440
|
-
if (state.errorMap[hash]) return;
|
|
8441
|
-
var mark = new Mark(state.filename, state.input, position, line.line, position - line.start);
|
|
8442
|
-
if (toLineEnd) mark.toLineEnd = true;
|
|
8443
|
-
var error = new YAMLException(message, mark, isWarning);
|
|
8444
|
-
state.errors.push(error);
|
|
8445
|
-
}
|
|
8446
|
-
function throwError(state, message) {
|
|
8447
|
-
var error = generateError(state, message);
|
|
8448
|
-
var hash = error.message + error.mark.position;
|
|
8449
|
-
if (state.errorMap[hash]) return;
|
|
8450
|
-
state.errors.push(error);
|
|
8451
|
-
state.errorMap[hash] = 1;
|
|
8452
|
-
var or = state.position;
|
|
8453
|
-
while (true) {
|
|
8454
|
-
if (state.position >= state.input.length - 1) return;
|
|
8455
|
-
var c = state.input.charAt(state.position);
|
|
8456
|
-
if (c == "\n") {
|
|
8457
|
-
state.position--;
|
|
8458
|
-
if (state.position == or) state.position += 1;
|
|
8459
|
-
return;
|
|
8460
|
-
}
|
|
8461
|
-
if (c == "\r") {
|
|
8462
|
-
state.position--;
|
|
8463
|
-
if (state.position == or) state.position += 1;
|
|
8464
|
-
return;
|
|
8465
|
-
}
|
|
8466
|
-
state.position++;
|
|
8467
|
-
}
|
|
8468
|
-
}
|
|
8469
|
-
function throwWarning(state, message) {
|
|
8470
|
-
var error = generateError(state, message);
|
|
8471
|
-
if (state.onWarning) state.onWarning.call(null, error);
|
|
8472
|
-
}
|
|
8473
|
-
var directiveHandlers = {
|
|
8474
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
8475
|
-
var match;
|
|
8476
|
-
var major;
|
|
8477
|
-
var minor;
|
|
8478
|
-
if (null !== state.version) throwError(state, "duplication of %YAML directive");
|
|
8479
|
-
if (1 !== args.length) throwError(state, "YAML directive accepts exactly one argument");
|
|
8480
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
8481
|
-
if (null === match) throwError(state, "ill-formed argument of the YAML directive");
|
|
8482
|
-
major = parseInt(match[1], 10);
|
|
8483
|
-
minor = parseInt(match[2], 10);
|
|
8484
|
-
if (1 !== major) throwError(state, "found incompatible YAML document (version 1.2 is required)");
|
|
8485
|
-
state.version = args[0];
|
|
8486
|
-
state.checkLineBreaks = minor < 2;
|
|
8487
|
-
if (2 !== minor) throwError(state, "found incompatible YAML document (version 1.2 is required)");
|
|
8488
|
-
},
|
|
8489
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
8490
|
-
var handle;
|
|
8491
|
-
var prefix;
|
|
8492
|
-
if (2 !== args.length) throwError(state, "TAG directive accepts exactly two arguments");
|
|
8493
|
-
handle = args[0];
|
|
8494
|
-
prefix = args[1];
|
|
8495
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
8496
|
-
if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
8497
|
-
if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
8498
|
-
state.tagMap[handle] = prefix;
|
|
8499
|
-
}
|
|
8500
|
-
};
|
|
8501
|
-
function captureSegment(state, start, end, checkJson) {
|
|
8502
|
-
var _position;
|
|
8503
|
-
var _length;
|
|
8504
|
-
var _character;
|
|
8505
|
-
var _result;
|
|
8506
|
-
var scalar = state.result;
|
|
8507
|
-
if (scalar.startPosition == -1) scalar.startPosition = start;
|
|
8508
|
-
if (start <= end) {
|
|
8509
|
-
_result = state.input.slice(start, end);
|
|
8510
|
-
if (checkJson) for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
8511
|
-
_character = _result.charCodeAt(_position);
|
|
8512
|
-
if (!(9 === _character || 32 <= _character && _character <= 1114111)) throwError(state, "expected valid JSON character");
|
|
8513
|
-
}
|
|
8514
|
-
else if (PATTERN_NON_PRINTABLE.test(_result)) throwError(state, "the stream contains non-printable characters");
|
|
8515
|
-
scalar.value += _result;
|
|
8516
|
-
scalar.endPosition = end;
|
|
8517
|
-
}
|
|
8518
|
-
}
|
|
8519
|
-
function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
|
|
8520
|
-
if (keyNode == null) return;
|
|
8521
|
-
if (null === _result) _result = {
|
|
8522
|
-
startPosition: keyNode.startPosition,
|
|
8523
|
-
endPosition: valueNode.endPosition,
|
|
8524
|
-
parent: null,
|
|
8525
|
-
errors: [],
|
|
8526
|
-
mappings: [],
|
|
8527
|
-
kind: ast.Kind.MAP
|
|
8528
|
-
};
|
|
8529
|
-
var mapping = ast.newMapping(keyNode, valueNode);
|
|
8530
|
-
mapping.parent = _result;
|
|
8531
|
-
keyNode.parent = mapping;
|
|
8532
|
-
if (valueNode != null) valueNode.parent = mapping;
|
|
8533
|
-
!state.ignoreDuplicateKeys && _result.mappings.forEach((sibling) => {
|
|
8534
|
-
if (sibling.key && sibling.key.value === (mapping.key && mapping.key.value)) {
|
|
8535
|
-
throwErrorFromPosition(state, mapping.key.startPosition, "duplicate key");
|
|
8536
|
-
throwErrorFromPosition(state, sibling.key.startPosition, "duplicate key");
|
|
8537
|
-
}
|
|
8538
|
-
});
|
|
8539
|
-
_result.mappings.push(mapping);
|
|
8540
|
-
_result.endPosition = valueNode ? valueNode.endPosition : keyNode.endPosition + 1;
|
|
8541
|
-
return _result;
|
|
8542
|
-
}
|
|
8543
|
-
function readLineBreak(state) {
|
|
8544
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8545
|
-
if (10 === ch) state.position++;
|
|
8546
|
-
else if (13 === ch) {
|
|
8547
|
-
state.position++;
|
|
8548
|
-
if (10 === state.input.charCodeAt(state.position)) state.position++;
|
|
8549
|
-
} else throwError(state, "a line break is expected");
|
|
8550
|
-
state.line += 1;
|
|
8551
|
-
state.lineStart = state.position;
|
|
8552
|
-
state.lines.push({
|
|
8553
|
-
start: state.lineStart,
|
|
8554
|
-
line: state.line
|
|
8555
|
-
});
|
|
8556
|
-
}
|
|
8557
|
-
function positionToLine(state, position) {
|
|
8558
|
-
var line;
|
|
8559
|
-
for (var i2 = 0; i2 < state.lines.length; i2++) {
|
|
8560
|
-
if (state.lines[i2].start > position) break;
|
|
8561
|
-
line = state.lines[i2];
|
|
8562
|
-
}
|
|
8563
|
-
if (!line) return {
|
|
8564
|
-
start: 0,
|
|
8565
|
-
line: 0
|
|
8566
|
-
};
|
|
8567
|
-
return line;
|
|
8568
|
-
}
|
|
8569
|
-
function readComment(state) {
|
|
8570
|
-
var ch = 0;
|
|
8571
|
-
var _position = state.position;
|
|
8572
|
-
do
|
|
8573
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8574
|
-
while (0 !== ch && !is_EOL(ch));
|
|
8575
|
-
state.comments.push({
|
|
8576
|
-
startPosition: _position,
|
|
8577
|
-
endPosition: state.position,
|
|
8578
|
-
value: state.input.slice(_position + 1, state.position)
|
|
8579
|
-
});
|
|
8580
|
-
}
|
|
8581
|
-
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
8582
|
-
var lineBreaks = 0;
|
|
8583
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8584
|
-
while (0 !== ch) {
|
|
8585
|
-
while (is_WHITE_SPACE(ch)) {
|
|
8586
|
-
if (ch === 9) state.errors.push(generateError(state, "Using tabs can lead to unpredictable results", true));
|
|
8587
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8588
|
-
}
|
|
8589
|
-
if (allowComments && 35 === ch) {
|
|
8590
|
-
readComment(state);
|
|
8591
|
-
ch = state.input.charCodeAt(state.position);
|
|
8592
|
-
}
|
|
8593
|
-
if (is_EOL(ch)) {
|
|
8594
|
-
readLineBreak(state);
|
|
8595
|
-
ch = state.input.charCodeAt(state.position);
|
|
8596
|
-
lineBreaks++;
|
|
8597
|
-
state.lineIndent = 0;
|
|
8598
|
-
while (32 === ch) {
|
|
8599
|
-
state.lineIndent++;
|
|
8600
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8601
|
-
}
|
|
8602
|
-
} else break;
|
|
8603
|
-
}
|
|
8604
|
-
if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
|
|
8605
|
-
return lineBreaks;
|
|
8606
|
-
}
|
|
8607
|
-
function testDocumentSeparator(state) {
|
|
8608
|
-
var _position = state.position;
|
|
8609
|
-
var ch = state.input.charCodeAt(_position);
|
|
8610
|
-
if ((45 === ch || 46 === ch) && state.input.charCodeAt(_position + 1) === ch && state.input.charCodeAt(_position + 2) === ch) {
|
|
8611
|
-
_position += 3;
|
|
8612
|
-
ch = state.input.charCodeAt(_position);
|
|
8613
|
-
if (ch === 0 || is_WS_OR_EOL(ch)) return true;
|
|
8614
|
-
}
|
|
8615
|
-
return false;
|
|
8616
|
-
}
|
|
8617
|
-
function writeFoldedLines(state, scalar, count) {
|
|
8618
|
-
if (1 === count) scalar.value += " ";
|
|
8619
|
-
else if (count > 1) scalar.value += common.repeat("\n", count - 1);
|
|
8620
|
-
}
|
|
8621
|
-
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
8622
|
-
var preceding;
|
|
8623
|
-
var following;
|
|
8624
|
-
var captureStart;
|
|
8625
|
-
var captureEnd;
|
|
8626
|
-
var hasPendingContent;
|
|
8627
|
-
var _line;
|
|
8628
|
-
var _lineStart;
|
|
8629
|
-
var _lineIndent;
|
|
8630
|
-
var _kind = state.kind;
|
|
8631
|
-
var _result = state.result;
|
|
8632
|
-
var ch;
|
|
8633
|
-
var state_result = ast.newScalar();
|
|
8634
|
-
state_result.plainScalar = true;
|
|
8635
|
-
state.result = state_result;
|
|
8636
|
-
ch = state.input.charCodeAt(state.position);
|
|
8637
|
-
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || 35 === ch || 38 === ch || 42 === ch || 33 === ch || 124 === ch || 62 === ch || 39 === ch || 34 === ch || 37 === ch || 64 === ch || 96 === ch) return false;
|
|
8638
|
-
if (63 === ch || 45 === ch) {
|
|
8639
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
8640
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) return false;
|
|
8641
|
-
}
|
|
8642
|
-
state.kind = "scalar";
|
|
8643
|
-
captureStart = captureEnd = state.position;
|
|
8644
|
-
hasPendingContent = false;
|
|
8645
|
-
while (0 !== ch) {
|
|
8646
|
-
if (58 === ch) {
|
|
8647
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
8648
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) break;
|
|
8649
|
-
} else if (35 === ch) {
|
|
8650
|
-
preceding = state.input.charCodeAt(state.position - 1);
|
|
8651
|
-
if (is_WS_OR_EOL(preceding)) break;
|
|
8652
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) break;
|
|
8653
|
-
else if (is_EOL(ch)) {
|
|
8654
|
-
_line = state.line;
|
|
8655
|
-
_lineStart = state.lineStart;
|
|
8656
|
-
_lineIndent = state.lineIndent;
|
|
8657
|
-
skipSeparationSpace(state, false, -1);
|
|
8658
|
-
if (state.lineIndent >= nodeIndent) {
|
|
8659
|
-
hasPendingContent = true;
|
|
8660
|
-
ch = state.input.charCodeAt(state.position);
|
|
8661
|
-
continue;
|
|
8662
|
-
} else {
|
|
8663
|
-
state.position = captureEnd;
|
|
8664
|
-
state.line = _line;
|
|
8665
|
-
state.lineStart = _lineStart;
|
|
8666
|
-
state.lineIndent = _lineIndent;
|
|
8667
|
-
break;
|
|
8668
|
-
}
|
|
8669
|
-
}
|
|
8670
|
-
if (hasPendingContent) {
|
|
8671
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
8672
|
-
writeFoldedLines(state, state_result, state.line - _line);
|
|
8673
|
-
captureStart = captureEnd = state.position;
|
|
8674
|
-
hasPendingContent = false;
|
|
8675
|
-
}
|
|
8676
|
-
if (!is_WHITE_SPACE(ch)) captureEnd = state.position + 1;
|
|
8677
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8678
|
-
if (state.position >= state.input.length) return false;
|
|
8679
|
-
}
|
|
8680
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
8681
|
-
if (state.result.startPosition != -1) {
|
|
8682
|
-
state_result.rawValue = state.input.substring(state_result.startPosition, state_result.endPosition);
|
|
8683
|
-
return true;
|
|
8684
|
-
}
|
|
8685
|
-
state.kind = _kind;
|
|
8686
|
-
state.result = _result;
|
|
8687
|
-
return false;
|
|
8688
|
-
}
|
|
8689
|
-
function readSingleQuotedScalar(state, nodeIndent) {
|
|
8690
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8691
|
-
var captureStart;
|
|
8692
|
-
var captureEnd;
|
|
8693
|
-
if (39 !== ch) return false;
|
|
8694
|
-
var scalar = ast.newScalar();
|
|
8695
|
-
scalar.singleQuoted = true;
|
|
8696
|
-
state.kind = "scalar";
|
|
8697
|
-
state.result = scalar;
|
|
8698
|
-
scalar.startPosition = state.position;
|
|
8699
|
-
state.position++;
|
|
8700
|
-
captureStart = captureEnd = state.position;
|
|
8701
|
-
while (0 !== (ch = state.input.charCodeAt(state.position))) if (39 === ch) {
|
|
8702
|
-
captureSegment(state, captureStart, state.position, true);
|
|
8703
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8704
|
-
scalar.endPosition = state.position;
|
|
8705
|
-
if (39 === ch) {
|
|
8706
|
-
captureStart = captureEnd = state.position;
|
|
8707
|
-
state.position++;
|
|
8708
|
-
} else return true;
|
|
8709
|
-
} else if (is_EOL(ch)) {
|
|
8710
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
8711
|
-
writeFoldedLines(state, scalar, skipSeparationSpace(state, false, nodeIndent));
|
|
8712
|
-
captureStart = captureEnd = state.position;
|
|
8713
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
8714
|
-
else {
|
|
8715
|
-
state.position++;
|
|
8716
|
-
captureEnd = state.position;
|
|
8717
|
-
scalar.endPosition = state.position;
|
|
8718
|
-
}
|
|
8719
|
-
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
8720
|
-
}
|
|
8721
|
-
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
8722
|
-
var captureStart;
|
|
8723
|
-
var captureEnd;
|
|
8724
|
-
var hexLength;
|
|
8725
|
-
var hexResult;
|
|
8726
|
-
var tmp;
|
|
8727
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8728
|
-
if (34 !== ch) return false;
|
|
8729
|
-
state.kind = "scalar";
|
|
8730
|
-
var scalar = ast.newScalar();
|
|
8731
|
-
scalar.doubleQuoted = true;
|
|
8732
|
-
state.result = scalar;
|
|
8733
|
-
scalar.startPosition = state.position;
|
|
8734
|
-
state.position++;
|
|
8735
|
-
captureStart = captureEnd = state.position;
|
|
8736
|
-
while (0 !== (ch = state.input.charCodeAt(state.position))) if (34 === ch) {
|
|
8737
|
-
captureSegment(state, captureStart, state.position, true);
|
|
8738
|
-
state.position++;
|
|
8739
|
-
scalar.endPosition = state.position;
|
|
8740
|
-
scalar.rawValue = state.input.substring(scalar.startPosition, scalar.endPosition);
|
|
8741
|
-
return true;
|
|
8742
|
-
} else if (92 === ch) {
|
|
8743
|
-
captureSegment(state, captureStart, state.position, true);
|
|
8744
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8745
|
-
if (is_EOL(ch)) skipSeparationSpace(state, false, nodeIndent);
|
|
8746
|
-
else if (ch < 256 && (state.allowAnyEscape ? customEscapeCheck[ch] : simpleEscapeCheck[ch])) {
|
|
8747
|
-
scalar.value += state.allowAnyEscape ? customEscapeMap[ch] : simpleEscapeMap[ch];
|
|
8748
|
-
state.position++;
|
|
8749
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
8750
|
-
hexLength = tmp;
|
|
8751
|
-
hexResult = 0;
|
|
8752
|
-
for (; hexLength > 0; hexLength--) {
|
|
8753
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8754
|
-
if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
|
|
8755
|
-
else throwError(state, "expected hexadecimal character");
|
|
8756
|
-
}
|
|
8757
|
-
scalar.value += charFromCodepoint(hexResult);
|
|
8758
|
-
state.position++;
|
|
8759
|
-
} else throwError(state, "unknown escape sequence");
|
|
8760
|
-
captureStart = captureEnd = state.position;
|
|
8761
|
-
} else if (is_EOL(ch)) {
|
|
8762
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
8763
|
-
writeFoldedLines(state, scalar, skipSeparationSpace(state, false, nodeIndent));
|
|
8764
|
-
captureStart = captureEnd = state.position;
|
|
8765
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
8766
|
-
else {
|
|
8767
|
-
state.position++;
|
|
8768
|
-
captureEnd = state.position;
|
|
8769
|
-
}
|
|
8770
|
-
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
8771
|
-
}
|
|
8772
|
-
function readFlowCollection(state, nodeIndent) {
|
|
8773
|
-
var readNext = true;
|
|
8774
|
-
var _line;
|
|
8775
|
-
var _tag = state.tag;
|
|
8776
|
-
var _result;
|
|
8777
|
-
var _anchor = state.anchor;
|
|
8778
|
-
var following;
|
|
8779
|
-
var terminator;
|
|
8780
|
-
var isPair;
|
|
8781
|
-
var isExplicitPair;
|
|
8782
|
-
var isMapping;
|
|
8783
|
-
var keyNode;
|
|
8784
|
-
var keyTag;
|
|
8785
|
-
var valueNode;
|
|
8786
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8787
|
-
if (ch === 91) {
|
|
8788
|
-
terminator = 93;
|
|
8789
|
-
isMapping = false;
|
|
8790
|
-
_result = ast.newItems();
|
|
8791
|
-
_result.startPosition = state.position;
|
|
8792
|
-
} else if (ch === 123) {
|
|
8793
|
-
terminator = 125;
|
|
8794
|
-
isMapping = true;
|
|
8795
|
-
_result = ast.newMap();
|
|
8796
|
-
_result.startPosition = state.position;
|
|
8797
|
-
} else return false;
|
|
8798
|
-
if (null !== state.anchor) {
|
|
8799
|
-
_result.anchorId = state.anchor;
|
|
8800
|
-
state.anchorMap[state.anchor] = _result;
|
|
8801
|
-
}
|
|
8802
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8803
|
-
while (0 !== ch) {
|
|
8804
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
8805
|
-
ch = state.input.charCodeAt(state.position);
|
|
8806
|
-
if (ch === terminator) {
|
|
8807
|
-
state.position++;
|
|
8808
|
-
state.tag = _tag;
|
|
8809
|
-
state.anchor = _anchor;
|
|
8810
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
8811
|
-
state.result = _result;
|
|
8812
|
-
_result.endPosition = state.position;
|
|
8813
|
-
return true;
|
|
8814
|
-
} else if (!readNext) {
|
|
8815
|
-
var p = state.position;
|
|
8816
|
-
throwError(state, "missed comma between flow collection entries");
|
|
8817
|
-
state.position = p + 1;
|
|
8818
|
-
}
|
|
8819
|
-
keyTag = keyNode = valueNode = null;
|
|
8820
|
-
isPair = isExplicitPair = false;
|
|
8821
|
-
if (63 === ch) {
|
|
8822
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
8823
|
-
if (is_WS_OR_EOL(following)) {
|
|
8824
|
-
isPair = isExplicitPair = true;
|
|
8825
|
-
state.position++;
|
|
8826
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
8827
|
-
}
|
|
8828
|
-
}
|
|
8829
|
-
_line = state.line;
|
|
8830
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
8831
|
-
keyTag = state.tag;
|
|
8832
|
-
keyNode = state.result;
|
|
8833
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
8834
|
-
ch = state.input.charCodeAt(state.position);
|
|
8835
|
-
if ((isExplicitPair || state.line === _line) && 58 === ch) {
|
|
8836
|
-
isPair = true;
|
|
8837
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8838
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
8839
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
8840
|
-
valueNode = state.result;
|
|
8841
|
-
}
|
|
8842
|
-
if (isMapping) storeMappingPair(state, _result, keyTag, keyNode, valueNode);
|
|
8843
|
-
else if (isPair) {
|
|
8844
|
-
var mp = storeMappingPair(state, null, keyTag, keyNode, valueNode);
|
|
8845
|
-
mp.parent = _result;
|
|
8846
|
-
_result.items.push(mp);
|
|
8847
|
-
} else {
|
|
8848
|
-
if (keyNode) keyNode.parent = _result;
|
|
8849
|
-
_result.items.push(keyNode);
|
|
8850
|
-
}
|
|
8851
|
-
_result.endPosition = state.position + 1;
|
|
8852
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
8853
|
-
ch = state.input.charCodeAt(state.position);
|
|
8854
|
-
if (44 === ch) {
|
|
8855
|
-
readNext = true;
|
|
8856
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8857
|
-
} else readNext = false;
|
|
8858
|
-
}
|
|
8859
|
-
throwError(state, "unexpected end of the stream within a flow collection");
|
|
8860
|
-
}
|
|
8861
|
-
function readBlockScalar(state, nodeIndent) {
|
|
8862
|
-
var captureStart;
|
|
8863
|
-
var folding;
|
|
8864
|
-
var chomping = CHOMPING_CLIP;
|
|
8865
|
-
var detectedIndent = false;
|
|
8866
|
-
var textIndent = nodeIndent;
|
|
8867
|
-
var emptyLines = 0;
|
|
8868
|
-
var atMoreIndented = false;
|
|
8869
|
-
var tmp;
|
|
8870
|
-
var ch = state.input.charCodeAt(state.position);
|
|
8871
|
-
if (ch === 124) folding = false;
|
|
8872
|
-
else if (ch === 62) folding = true;
|
|
8873
|
-
else return false;
|
|
8874
|
-
var sc = ast.newScalar();
|
|
8875
|
-
state.kind = "scalar";
|
|
8876
|
-
state.result = sc;
|
|
8877
|
-
sc.startPosition = state.position;
|
|
8878
|
-
while (0 !== ch) {
|
|
8879
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8880
|
-
if (43 === ch || 45 === ch) if (CHOMPING_CLIP === chomping) chomping = 43 === ch ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
8881
|
-
else throwError(state, "repeat of a chomping mode identifier");
|
|
8882
|
-
else if ((tmp = fromDecimalCode(ch)) >= 0) if (tmp === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
8883
|
-
else if (!detectedIndent) {
|
|
8884
|
-
textIndent = nodeIndent + tmp - 1;
|
|
8885
|
-
detectedIndent = true;
|
|
8886
|
-
} else throwError(state, "repeat of an indentation width identifier");
|
|
8887
|
-
else break;
|
|
8888
|
-
}
|
|
8889
|
-
if (is_WHITE_SPACE(ch)) {
|
|
8890
|
-
do
|
|
8891
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8892
|
-
while (is_WHITE_SPACE(ch));
|
|
8893
|
-
if (35 === ch) {
|
|
8894
|
-
readComment(state);
|
|
8895
|
-
ch = state.input.charCodeAt(state.position);
|
|
8896
|
-
}
|
|
8897
|
-
}
|
|
8898
|
-
while (0 !== ch) {
|
|
8899
|
-
readLineBreak(state);
|
|
8900
|
-
state.lineIndent = 0;
|
|
8901
|
-
ch = state.input.charCodeAt(state.position);
|
|
8902
|
-
while ((!detectedIndent || state.lineIndent < textIndent) && 32 === ch) {
|
|
8903
|
-
state.lineIndent++;
|
|
8904
|
-
ch = state.input.charCodeAt(++state.position);
|
|
8905
|
-
}
|
|
8906
|
-
if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
|
|
8907
|
-
if (is_EOL(ch)) {
|
|
8908
|
-
emptyLines++;
|
|
8909
|
-
continue;
|
|
8910
|
-
}
|
|
8911
|
-
if (state.lineIndent < textIndent) {
|
|
8912
|
-
if (chomping === CHOMPING_KEEP) sc.value += common.repeat("\n", emptyLines);
|
|
8913
|
-
else if (chomping === CHOMPING_CLIP) {
|
|
8914
|
-
if (detectedIndent) sc.value += "\n";
|
|
8915
|
-
}
|
|
8916
|
-
break;
|
|
8917
|
-
}
|
|
8918
|
-
if (folding) if (is_WHITE_SPACE(ch)) {
|
|
8919
|
-
atMoreIndented = true;
|
|
8920
|
-
sc.value += common.repeat("\n", emptyLines + 1);
|
|
8921
|
-
} else if (atMoreIndented) {
|
|
8922
|
-
atMoreIndented = false;
|
|
8923
|
-
sc.value += common.repeat("\n", emptyLines + 1);
|
|
8924
|
-
} else if (0 === emptyLines) {
|
|
8925
|
-
if (detectedIndent) sc.value += " ";
|
|
8926
|
-
} else sc.value += common.repeat("\n", emptyLines);
|
|
8927
|
-
else if (detectedIndent) sc.value += common.repeat("\n", emptyLines + 1);
|
|
8928
|
-
detectedIndent = true;
|
|
8929
|
-
emptyLines = 0;
|
|
8930
|
-
captureStart = state.position;
|
|
8931
|
-
while (!is_EOL(ch) && 0 !== ch) ch = state.input.charCodeAt(++state.position);
|
|
8932
|
-
captureSegment(state, captureStart, state.position, false);
|
|
8933
|
-
}
|
|
8934
|
-
sc.endPosition = state.position;
|
|
8935
|
-
var i2 = state.position - 1;
|
|
8936
|
-
while (true) {
|
|
8937
|
-
var c = state.input[i2];
|
|
8938
|
-
if (c == "\r" || c == "\n") {
|
|
8939
|
-
break;
|
|
8940
|
-
}
|
|
8941
|
-
if (c != " " && c != " ") break;
|
|
8942
|
-
i2--;
|
|
8943
|
-
}
|
|
8944
|
-
sc.endPosition = i2;
|
|
8945
|
-
sc.rawValue = state.input.substring(sc.startPosition, sc.endPosition);
|
|
8946
|
-
return true;
|
|
8947
|
-
}
|
|
8948
|
-
function readBlockSequence(state, nodeIndent) {
|
|
8949
|
-
var _line;
|
|
8950
|
-
var _tag = state.tag;
|
|
8951
|
-
var _anchor = state.anchor;
|
|
8952
|
-
var _result = ast.newItems();
|
|
8953
|
-
var following;
|
|
8954
|
-
var detected = false;
|
|
8955
|
-
var ch;
|
|
8956
|
-
if (null !== state.anchor) {
|
|
8957
|
-
_result.anchorId = state.anchor;
|
|
8958
|
-
state.anchorMap[state.anchor] = _result;
|
|
8959
|
-
}
|
|
8960
|
-
_result.startPosition = state.position;
|
|
8961
|
-
ch = state.input.charCodeAt(state.position);
|
|
8962
|
-
while (0 !== ch) {
|
|
8963
|
-
if (45 !== ch) break;
|
|
8964
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
8965
|
-
if (!is_WS_OR_EOL(following)) break;
|
|
8966
|
-
detected = true;
|
|
8967
|
-
state.position++;
|
|
8968
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
8969
|
-
if (state.lineIndent <= nodeIndent) {
|
|
8970
|
-
_result.items.push(null);
|
|
8971
|
-
ch = state.input.charCodeAt(state.position);
|
|
8972
|
-
continue;
|
|
8973
|
-
}
|
|
8974
|
-
}
|
|
8975
|
-
_line = state.line;
|
|
8976
|
-
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
8977
|
-
if (state.result) {
|
|
8978
|
-
state.result.parent = _result;
|
|
8979
|
-
_result.items.push(state.result);
|
|
8980
|
-
}
|
|
8981
|
-
skipSeparationSpace(state, true, -1);
|
|
8982
|
-
ch = state.input.charCodeAt(state.position);
|
|
8983
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && 0 !== ch) throwError(state, "bad indentation of a sequence entry");
|
|
8984
|
-
else if (state.lineIndent < nodeIndent) break;
|
|
8985
|
-
}
|
|
8986
|
-
_result.endPosition = state.position;
|
|
8987
|
-
if (detected) {
|
|
8988
|
-
state.tag = _tag;
|
|
8989
|
-
state.anchor = _anchor;
|
|
8990
|
-
state.kind = "sequence";
|
|
8991
|
-
state.result = _result;
|
|
8992
|
-
_result.endPosition = state.position;
|
|
8993
|
-
return true;
|
|
8994
|
-
}
|
|
8995
|
-
return false;
|
|
8996
|
-
}
|
|
8997
|
-
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
8998
|
-
var following;
|
|
8999
|
-
var allowCompact;
|
|
9000
|
-
var _line;
|
|
9001
|
-
var _tag = state.tag;
|
|
9002
|
-
var _anchor = state.anchor;
|
|
9003
|
-
var _result = ast.newMap();
|
|
9004
|
-
var keyTag = null;
|
|
9005
|
-
var keyNode = null;
|
|
9006
|
-
var valueNode = null;
|
|
9007
|
-
var atExplicitKey = false;
|
|
9008
|
-
var detected = false;
|
|
9009
|
-
var ch;
|
|
9010
|
-
_result.startPosition = state.position;
|
|
9011
|
-
if (null !== state.anchor) {
|
|
9012
|
-
_result.anchorId = state.anchor;
|
|
9013
|
-
state.anchorMap[state.anchor] = _result;
|
|
9014
|
-
}
|
|
9015
|
-
ch = state.input.charCodeAt(state.position);
|
|
9016
|
-
while (0 !== ch) {
|
|
9017
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
9018
|
-
_line = state.line;
|
|
9019
|
-
if ((63 === ch || 58 === ch) && is_WS_OR_EOL(following)) {
|
|
9020
|
-
if (63 === ch) {
|
|
9021
|
-
if (atExplicitKey) {
|
|
9022
|
-
storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
9023
|
-
keyTag = keyNode = valueNode = null;
|
|
9024
|
-
}
|
|
9025
|
-
detected = true;
|
|
9026
|
-
atExplicitKey = true;
|
|
9027
|
-
allowCompact = true;
|
|
9028
|
-
} else if (atExplicitKey) {
|
|
9029
|
-
atExplicitKey = false;
|
|
9030
|
-
allowCompact = true;
|
|
9031
|
-
} else throwError(state, "incomplete explicit mapping pair; a key node is missed");
|
|
9032
|
-
state.position += 1;
|
|
9033
|
-
ch = following;
|
|
9034
|
-
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) if (state.line === _line) {
|
|
9035
|
-
ch = state.input.charCodeAt(state.position);
|
|
9036
|
-
while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9037
|
-
if (58 === ch) {
|
|
9038
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9039
|
-
if (!is_WS_OR_EOL(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
9040
|
-
if (atExplicitKey) {
|
|
9041
|
-
storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
9042
|
-
keyTag = keyNode = valueNode = null;
|
|
9043
|
-
}
|
|
9044
|
-
detected = true;
|
|
9045
|
-
atExplicitKey = false;
|
|
9046
|
-
allowCompact = false;
|
|
9047
|
-
keyTag = state.tag;
|
|
9048
|
-
keyNode = state.result;
|
|
9049
|
-
} else if (state.position == state.lineStart && testDocumentSeparator(state)) break;
|
|
9050
|
-
else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
9051
|
-
else {
|
|
9052
|
-
state.tag = _tag;
|
|
9053
|
-
state.anchor = _anchor;
|
|
9054
|
-
return true;
|
|
9055
|
-
}
|
|
9056
|
-
} else if (detected) {
|
|
9057
|
-
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
9058
|
-
while (state.position > 0) {
|
|
9059
|
-
ch = state.input.charCodeAt(--state.position);
|
|
9060
|
-
if (is_EOL(ch)) {
|
|
9061
|
-
state.position++;
|
|
9062
|
-
break;
|
|
9063
|
-
}
|
|
9064
|
-
}
|
|
9065
|
-
} else {
|
|
9066
|
-
state.tag = _tag;
|
|
9067
|
-
state.anchor = _anchor;
|
|
9068
|
-
return true;
|
|
9069
|
-
}
|
|
9070
|
-
else break;
|
|
9071
|
-
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
9072
|
-
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
|
|
9073
|
-
else valueNode = state.result;
|
|
9074
|
-
if (!atExplicitKey) {
|
|
9075
|
-
storeMappingPair(state, _result, keyTag, keyNode, valueNode);
|
|
9076
|
-
keyTag = keyNode = valueNode = null;
|
|
9077
|
-
}
|
|
9078
|
-
skipSeparationSpace(state, true, -1);
|
|
9079
|
-
ch = state.input.charCodeAt(state.position);
|
|
9080
|
-
}
|
|
9081
|
-
if (state.lineIndent > nodeIndent && 0 !== ch) throwError(state, "bad indentation of a mapping entry");
|
|
9082
|
-
else if (state.lineIndent < nodeIndent) break;
|
|
9083
|
-
}
|
|
9084
|
-
if (atExplicitKey) storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
9085
|
-
if (detected) {
|
|
9086
|
-
state.tag = _tag;
|
|
9087
|
-
state.anchor = _anchor;
|
|
9088
|
-
state.kind = "mapping";
|
|
9089
|
-
state.result = _result;
|
|
9090
|
-
}
|
|
9091
|
-
return detected;
|
|
9092
|
-
}
|
|
9093
|
-
function readTagProperty(state) {
|
|
9094
|
-
var _position;
|
|
9095
|
-
var isVerbatim = false;
|
|
9096
|
-
var isNamed = false;
|
|
9097
|
-
var tagHandle;
|
|
9098
|
-
var tagName;
|
|
9099
|
-
var ch = state.input.charCodeAt(state.position);
|
|
9100
|
-
if (33 !== ch) return false;
|
|
9101
|
-
if (null !== state.tag) throwError(state, "duplication of a tag property");
|
|
9102
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9103
|
-
if (60 === ch) {
|
|
9104
|
-
isVerbatim = true;
|
|
9105
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9106
|
-
} else if (33 === ch) {
|
|
9107
|
-
isNamed = true;
|
|
9108
|
-
tagHandle = "!!";
|
|
9109
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9110
|
-
} else tagHandle = "!";
|
|
9111
|
-
_position = state.position;
|
|
9112
|
-
if (isVerbatim) {
|
|
9113
|
-
do
|
|
9114
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9115
|
-
while (0 !== ch && 62 !== ch);
|
|
9116
|
-
if (state.position < state.length) {
|
|
9117
|
-
tagName = state.input.slice(_position, state.position);
|
|
9118
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9119
|
-
} else throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
9120
|
-
} else {
|
|
9121
|
-
while (0 !== ch && !is_WS_OR_EOL(ch)) {
|
|
9122
|
-
if (33 === ch) if (!isNamed) {
|
|
9123
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
9124
|
-
if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
|
|
9125
|
-
isNamed = true;
|
|
9126
|
-
_position = state.position + 1;
|
|
9127
|
-
} else throwError(state, "tag suffix cannot contain exclamation marks");
|
|
9128
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9129
|
-
}
|
|
9130
|
-
tagName = state.input.slice(_position, state.position);
|
|
9131
|
-
if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
9132
|
-
}
|
|
9133
|
-
if (tagName && !PATTERN_TAG_URI.test(tagName)) throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
9134
|
-
if (isVerbatim) state.tag = tagName;
|
|
9135
|
-
else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
|
|
9136
|
-
else if ("!" === tagHandle) state.tag = "!" + tagName;
|
|
9137
|
-
else if ("!!" === tagHandle) state.tag = "tag:yaml.org,2002:" + tagName;
|
|
9138
|
-
else throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
9139
|
-
return true;
|
|
9140
|
-
}
|
|
9141
|
-
function readAnchorProperty(state) {
|
|
9142
|
-
var _position;
|
|
9143
|
-
var ch = state.input.charCodeAt(state.position);
|
|
9144
|
-
if (38 !== ch) return false;
|
|
9145
|
-
if (null !== state.anchor) throwError(state, "duplication of an anchor property");
|
|
9146
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9147
|
-
_position = state.position;
|
|
9148
|
-
while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9149
|
-
if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
|
|
9150
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
9151
|
-
return true;
|
|
9152
|
-
}
|
|
9153
|
-
function readAlias(state) {
|
|
9154
|
-
var _position;
|
|
9155
|
-
var alias;
|
|
9156
|
-
state.length;
|
|
9157
|
-
state.input;
|
|
9158
|
-
var ch = state.input.charCodeAt(state.position);
|
|
9159
|
-
if (42 !== ch) return false;
|
|
9160
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9161
|
-
_position = state.position;
|
|
9162
|
-
while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9163
|
-
if (state.position <= _position) {
|
|
9164
|
-
throwError(state, "name of an alias node must contain at least one character");
|
|
9165
|
-
state.position = _position + 1;
|
|
9166
|
-
}
|
|
9167
|
-
alias = state.input.slice(_position, state.position);
|
|
9168
|
-
if (!state.anchorMap.hasOwnProperty(alias)) {
|
|
9169
|
-
throwError(state, 'unidentified alias "' + alias + '"');
|
|
9170
|
-
if (state.position <= _position) state.position = _position + 1;
|
|
9171
|
-
}
|
|
9172
|
-
state.result = ast.newAnchorRef(alias, _position, state.position, state.anchorMap[alias]);
|
|
9173
|
-
skipSeparationSpace(state, true, -1);
|
|
9174
|
-
return true;
|
|
9175
|
-
}
|
|
9176
|
-
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
9177
|
-
var allowBlockStyles;
|
|
9178
|
-
var allowBlockScalars;
|
|
9179
|
-
var allowBlockCollections;
|
|
9180
|
-
var indentStatus = 1;
|
|
9181
|
-
var atNewLine = false;
|
|
9182
|
-
var hasContent = false;
|
|
9183
|
-
var typeIndex;
|
|
9184
|
-
var typeQuantity;
|
|
9185
|
-
var type;
|
|
9186
|
-
var flowIndent;
|
|
9187
|
-
var blockIndent;
|
|
9188
|
-
state.tag = null;
|
|
9189
|
-
state.anchor = null;
|
|
9190
|
-
state.kind = null;
|
|
9191
|
-
state.result = null;
|
|
9192
|
-
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
9193
|
-
if (allowToSeek) {
|
|
9194
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
9195
|
-
atNewLine = true;
|
|
9196
|
-
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
9197
|
-
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
9198
|
-
else if (state.lineIndent < parentIndent) indentStatus = -1;
|
|
9199
|
-
}
|
|
9200
|
-
}
|
|
9201
|
-
let tagStart = state.position;
|
|
9202
|
-
state.position - state.lineStart;
|
|
9203
|
-
if (1 === indentStatus) while (readTagProperty(state) || readAnchorProperty(state)) if (skipSeparationSpace(state, true, -1)) {
|
|
9204
|
-
atNewLine = true;
|
|
9205
|
-
allowBlockCollections = allowBlockStyles;
|
|
9206
|
-
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
9207
|
-
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
9208
|
-
else if (state.lineIndent < parentIndent) indentStatus = -1;
|
|
9209
|
-
} else allowBlockCollections = false;
|
|
9210
|
-
if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
|
|
9211
|
-
if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
9212
|
-
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) flowIndent = parentIndent;
|
|
9213
|
-
else flowIndent = parentIndent + 1;
|
|
9214
|
-
blockIndent = state.position - state.lineStart;
|
|
9215
|
-
if (1 === indentStatus) if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) hasContent = true;
|
|
9216
|
-
else {
|
|
9217
|
-
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
|
|
9218
|
-
else if (readAlias(state)) {
|
|
9219
|
-
hasContent = true;
|
|
9220
|
-
if (null !== state.tag || null !== state.anchor) throwError(state, "alias node should not have any properties");
|
|
9221
|
-
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
9222
|
-
hasContent = true;
|
|
9223
|
-
if (null === state.tag) state.tag = "?";
|
|
9224
|
-
}
|
|
9225
|
-
if (null !== state.anchor) {
|
|
9226
|
-
state.anchorMap[state.anchor] = state.result;
|
|
9227
|
-
state.result.anchorId = state.anchor;
|
|
9228
|
-
}
|
|
9229
|
-
}
|
|
9230
|
-
else if (0 === indentStatus) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
9231
|
-
}
|
|
9232
|
-
if (null !== state.tag && "!" !== state.tag) if (state.tag == "!include") {
|
|
9233
|
-
if (!state.result) {
|
|
9234
|
-
state.result = ast.newScalar();
|
|
9235
|
-
state.result.startPosition = state.position;
|
|
9236
|
-
state.result.endPosition = state.position;
|
|
9237
|
-
throwError(state, "!include without value");
|
|
9238
|
-
}
|
|
9239
|
-
state.result.kind = ast.Kind.INCLUDE_REF;
|
|
9240
|
-
} else if ("?" === state.tag) for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
9241
|
-
type = state.implicitTypes[typeIndex];
|
|
9242
|
-
var vl = state.result["value"];
|
|
9243
|
-
if (type.resolve(vl)) {
|
|
9244
|
-
state.result.valueObject = type.construct(state.result["value"]);
|
|
9245
|
-
state.tag = type.tag;
|
|
9246
|
-
if (null !== state.anchor) {
|
|
9247
|
-
state.result.anchorId = state.anchor;
|
|
9248
|
-
state.anchorMap[state.anchor] = state.result;
|
|
9249
|
-
}
|
|
9250
|
-
break;
|
|
9251
|
-
}
|
|
9252
|
-
}
|
|
9253
|
-
else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
|
|
9254
|
-
type = state.typeMap[state.tag];
|
|
9255
|
-
if (null !== state.result && type.kind !== state.kind) throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
9256
|
-
if (!type.resolve(state.result)) throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
9257
|
-
else {
|
|
9258
|
-
state.result = type.construct(state.result);
|
|
9259
|
-
if (null !== state.anchor) {
|
|
9260
|
-
state.result.anchorId = state.anchor;
|
|
9261
|
-
state.anchorMap[state.anchor] = state.result;
|
|
9262
|
-
}
|
|
9263
|
-
}
|
|
9264
|
-
} else throwErrorFromPosition(state, tagStart, "unknown tag <" + state.tag + ">", false, true);
|
|
9265
|
-
return null !== state.tag || null !== state.anchor || hasContent;
|
|
9266
|
-
}
|
|
9267
|
-
function readDocument(state) {
|
|
9268
|
-
var documentStart = state.position;
|
|
9269
|
-
var _position;
|
|
9270
|
-
var directiveName;
|
|
9271
|
-
var directiveArgs;
|
|
9272
|
-
var hasDirectives = false;
|
|
9273
|
-
var ch;
|
|
9274
|
-
state.version = null;
|
|
9275
|
-
state.checkLineBreaks = state.legacy;
|
|
9276
|
-
state.tagMap = {};
|
|
9277
|
-
state.anchorMap = {};
|
|
9278
|
-
state.comments = [];
|
|
9279
|
-
while (0 !== (ch = state.input.charCodeAt(state.position))) {
|
|
9280
|
-
skipSeparationSpace(state, true, -1);
|
|
9281
|
-
ch = state.input.charCodeAt(state.position);
|
|
9282
|
-
if (state.lineIndent > 0 || 37 !== ch) break;
|
|
9283
|
-
hasDirectives = true;
|
|
9284
|
-
ch = state.input.charCodeAt(++state.position);
|
|
9285
|
-
_position = state.position;
|
|
9286
|
-
while (0 !== ch && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9287
|
-
directiveName = state.input.slice(_position, state.position);
|
|
9288
|
-
directiveArgs = [];
|
|
9289
|
-
if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
|
|
9290
|
-
while (0 !== ch) {
|
|
9291
|
-
while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9292
|
-
if (35 === ch) {
|
|
9293
|
-
readComment(state);
|
|
9294
|
-
ch = state.input.charCodeAt(state.position);
|
|
9295
|
-
break;
|
|
9296
|
-
}
|
|
9297
|
-
if (is_EOL(ch)) break;
|
|
9298
|
-
_position = state.position;
|
|
9299
|
-
while (0 !== ch && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
|
|
9300
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
9301
|
-
}
|
|
9302
|
-
if (0 !== ch) readLineBreak(state);
|
|
9303
|
-
if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
9304
|
-
else {
|
|
9305
|
-
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
9306
|
-
state.position++;
|
|
9307
|
-
}
|
|
9308
|
-
}
|
|
9309
|
-
skipSeparationSpace(state, true, -1);
|
|
9310
|
-
if (0 === state.lineIndent && 45 === state.input.charCodeAt(state.position) && 45 === state.input.charCodeAt(state.position + 1) && 45 === state.input.charCodeAt(state.position + 2)) {
|
|
9311
|
-
state.position += 3;
|
|
9312
|
-
skipSeparationSpace(state, true, -1);
|
|
9313
|
-
} else if (hasDirectives) throwError(state, "directives end mark is expected");
|
|
9314
|
-
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
9315
|
-
skipSeparationSpace(state, true, -1);
|
|
9316
|
-
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
9317
|
-
state.result.comments = state.comments;
|
|
9318
|
-
state.documents.push(state.result);
|
|
9319
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
9320
|
-
if (46 === state.input.charCodeAt(state.position)) {
|
|
9321
|
-
state.position += 3;
|
|
9322
|
-
skipSeparationSpace(state, true, -1);
|
|
9323
|
-
}
|
|
9324
|
-
return;
|
|
9325
|
-
}
|
|
9326
|
-
if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
|
|
9327
|
-
else return;
|
|
9328
|
-
}
|
|
9329
|
-
function loadDocuments(input, options) {
|
|
9330
|
-
input = String(input);
|
|
9331
|
-
options = options || {};
|
|
9332
|
-
let inputLength = input.length;
|
|
9333
|
-
if (inputLength !== 0) {
|
|
9334
|
-
if (10 !== input.charCodeAt(inputLength - 1) && 13 !== input.charCodeAt(inputLength - 1)) input += "\n";
|
|
9335
|
-
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
9336
|
-
}
|
|
9337
|
-
var state = new State(input, options);
|
|
9338
|
-
state.input += "\0";
|
|
9339
|
-
while (32 === state.input.charCodeAt(state.position)) {
|
|
9340
|
-
state.lineIndent += 1;
|
|
9341
|
-
state.position += 1;
|
|
9342
|
-
}
|
|
9343
|
-
while (state.position < state.length - 1) {
|
|
9344
|
-
var q = state.position;
|
|
9345
|
-
readDocument(state);
|
|
9346
|
-
if (state.position <= q) {
|
|
9347
|
-
for (; state.position < state.length - 1; state.position++) if (state.input.charAt(state.position) == "\n") break;
|
|
9348
|
-
}
|
|
9349
|
-
}
|
|
9350
|
-
let documents = state.documents;
|
|
9351
|
-
let docsCount = documents.length;
|
|
9352
|
-
if (docsCount > 0) documents[docsCount - 1].endPosition = inputLength;
|
|
9353
|
-
for (let x of documents) {
|
|
9354
|
-
x.errors = state.errors;
|
|
9355
|
-
if (x.startPosition > x.endPosition) x.startPosition = x.endPosition;
|
|
9356
|
-
}
|
|
9357
|
-
return documents;
|
|
9358
|
-
}
|
|
9359
|
-
function loadAll(input, iterator, options = {}) {
|
|
9360
|
-
var documents = loadDocuments(input, options);
|
|
9361
|
-
var index;
|
|
9362
|
-
var length;
|
|
9363
|
-
for (index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
|
|
9364
|
-
}
|
|
9365
|
-
exports$1.loadAll = loadAll;
|
|
9366
|
-
function load(input, options = {}) {
|
|
9367
|
-
var documents = loadDocuments(input, options);
|
|
9368
|
-
if (0 === documents.length) return;
|
|
9369
|
-
else if (1 === documents.length) return documents[0];
|
|
9370
|
-
var e = new YAMLException("expected a single document in the stream, but found more");
|
|
9371
|
-
e.mark = new Mark("", "", 0, 0, 0);
|
|
9372
|
-
e.mark.position = documents[0].endPosition;
|
|
9373
|
-
documents[0].errors.push(e);
|
|
9374
|
-
return documents[0];
|
|
9375
|
-
}
|
|
9376
|
-
exports$1.load = load;
|
|
9377
|
-
function safeLoadAll(input, output, options = {}) {
|
|
9378
|
-
loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
9379
|
-
}
|
|
9380
|
-
exports$1.safeLoadAll = safeLoadAll;
|
|
9381
|
-
function safeLoad(input, options = {}) {
|
|
9382
|
-
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
9383
|
-
}
|
|
9384
|
-
exports$1.safeLoad = safeLoad;
|
|
9385
|
-
module.exports.loadAll = loadAll;
|
|
9386
|
-
module.exports.load = load;
|
|
9387
|
-
module.exports.safeLoadAll = safeLoadAll;
|
|
9388
|
-
module.exports.safeLoad = safeLoad;
|
|
9389
|
-
}));
|
|
9390
|
-
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
9391
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
9392
|
-
var common = require_common();
|
|
9393
|
-
var YAMLException = require_exception();
|
|
9394
|
-
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
9395
|
-
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
9396
|
-
var _toString = Object.prototype.toString;
|
|
9397
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
9398
|
-
var CHAR_TAB = 9;
|
|
9399
|
-
var CHAR_LINE_FEED = 10;
|
|
9400
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
9401
|
-
var CHAR_SPACE = 32;
|
|
9402
|
-
var CHAR_EXCLAMATION = 33;
|
|
9403
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
9404
|
-
var CHAR_SHARP = 35;
|
|
9405
|
-
var CHAR_PERCENT = 37;
|
|
9406
|
-
var CHAR_AMPERSAND = 38;
|
|
9407
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
9408
|
-
var CHAR_ASTERISK = 42;
|
|
9409
|
-
var CHAR_COMMA = 44;
|
|
9410
|
-
var CHAR_MINUS = 45;
|
|
9411
|
-
var CHAR_COLON = 58;
|
|
9412
|
-
var CHAR_EQUALS = 61;
|
|
9413
|
-
var CHAR_GREATER_THAN = 62;
|
|
9414
|
-
var CHAR_QUESTION = 63;
|
|
9415
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
9416
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
9417
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
9418
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
9419
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
9420
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
9421
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
9422
|
-
var ESCAPE_SEQUENCES = {};
|
|
9423
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
9424
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
9425
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
9426
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
9427
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
9428
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
9429
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
9430
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
9431
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
9432
|
-
ESCAPE_SEQUENCES[34] = '\\"';
|
|
9433
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
9434
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
9435
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
9436
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
9437
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
9438
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
9439
|
-
"y",
|
|
9440
|
-
"Y",
|
|
9441
|
-
"yes",
|
|
9442
|
-
"Yes",
|
|
9443
|
-
"YES",
|
|
9444
|
-
"on",
|
|
9445
|
-
"On",
|
|
9446
|
-
"ON",
|
|
9447
|
-
"n",
|
|
9448
|
-
"N",
|
|
9449
|
-
"no",
|
|
9450
|
-
"No",
|
|
9451
|
-
"NO",
|
|
9452
|
-
"off",
|
|
9453
|
-
"Off",
|
|
9454
|
-
"OFF"
|
|
9455
|
-
];
|
|
9456
|
-
function compileStyleMap(schema, map) {
|
|
9457
|
-
var result;
|
|
9458
|
-
var keys;
|
|
9459
|
-
var index;
|
|
9460
|
-
var length;
|
|
9461
|
-
var tag;
|
|
9462
|
-
var style;
|
|
9463
|
-
var type;
|
|
9464
|
-
if (map === null) return {};
|
|
9465
|
-
result = {};
|
|
9466
|
-
keys = Object.keys(map);
|
|
9467
|
-
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
9468
|
-
tag = keys[index];
|
|
9469
|
-
style = String(map[tag]);
|
|
9470
|
-
if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
9471
|
-
type = schema.compiledTypeMap["fallback"][tag];
|
|
9472
|
-
if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
|
|
9473
|
-
result[tag] = style;
|
|
9474
|
-
}
|
|
9475
|
-
return result;
|
|
9476
|
-
}
|
|
9477
|
-
function encodeHex(character) {
|
|
9478
|
-
var string = character.toString(16).toUpperCase();
|
|
9479
|
-
var handle;
|
|
9480
|
-
var length;
|
|
9481
|
-
if (character <= 255) {
|
|
9482
|
-
handle = "x";
|
|
9483
|
-
length = 2;
|
|
9484
|
-
} else if (character <= 65535) {
|
|
9485
|
-
handle = "u";
|
|
9486
|
-
length = 4;
|
|
9487
|
-
} else if (character <= 4294967295) {
|
|
9488
|
-
handle = "U";
|
|
9489
|
-
length = 8;
|
|
9490
|
-
} else throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
9491
|
-
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
9492
|
-
}
|
|
9493
|
-
function State(options) {
|
|
9494
|
-
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
9495
|
-
this.indent = Math.max(1, options["indent"] || 2);
|
|
9496
|
-
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
9497
|
-
this.skipInvalid = options["skipInvalid"] || false;
|
|
9498
|
-
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
9499
|
-
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
9500
|
-
this.sortKeys = options["sortKeys"] || false;
|
|
9501
|
-
this.lineWidth = options["lineWidth"] || 80;
|
|
9502
|
-
this.noRefs = options["noRefs"] || false;
|
|
9503
|
-
this.noCompatMode = options["noCompatMode"] || false;
|
|
9504
|
-
this.condenseFlow = options["condenseFlow"] || false;
|
|
9505
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
9506
|
-
this.explicitTypes = this.schema.compiledExplicit;
|
|
9507
|
-
this.comments = options["comments"] || {};
|
|
9508
|
-
this.tag = null;
|
|
9509
|
-
this.result = "";
|
|
9510
|
-
this.duplicates = [];
|
|
9511
|
-
this.usedDuplicates = null;
|
|
9512
|
-
}
|
|
9513
|
-
function indentString(string, spaces) {
|
|
9514
|
-
var ind = common.repeat(" ", spaces);
|
|
9515
|
-
var position = 0;
|
|
9516
|
-
var next = -1;
|
|
9517
|
-
var result = "";
|
|
9518
|
-
var line;
|
|
9519
|
-
var length = string.length;
|
|
9520
|
-
while (position < length) {
|
|
9521
|
-
next = string.indexOf("\n", position);
|
|
9522
|
-
if (next === -1) {
|
|
9523
|
-
line = string.slice(position);
|
|
9524
|
-
position = length;
|
|
9525
|
-
} else {
|
|
9526
|
-
line = string.slice(position, next + 1);
|
|
9527
|
-
position = next + 1;
|
|
9528
|
-
}
|
|
9529
|
-
if (line.length && line !== "\n") result += ind;
|
|
9530
|
-
result += line;
|
|
9531
|
-
}
|
|
9532
|
-
return result;
|
|
9533
|
-
}
|
|
9534
|
-
function generateNextLine(state, level) {
|
|
9535
|
-
return "\n" + common.repeat(" ", state.indent * level);
|
|
9536
|
-
}
|
|
9537
|
-
function testImplicitResolving(state, str) {
|
|
9538
|
-
var index;
|
|
9539
|
-
var length;
|
|
9540
|
-
var type;
|
|
9541
|
-
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
9542
|
-
type = state.implicitTypes[index];
|
|
9543
|
-
if (type.resolve(str)) return true;
|
|
9544
|
-
}
|
|
9545
|
-
return false;
|
|
9546
|
-
}
|
|
9547
|
-
function isWhitespace(c) {
|
|
9548
|
-
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
9549
|
-
}
|
|
9550
|
-
function isPrintable(c) {
|
|
9551
|
-
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
|
9552
|
-
}
|
|
9553
|
-
function isNsChar(c) {
|
|
9554
|
-
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
9555
|
-
}
|
|
9556
|
-
function isPlainSafe(c, prev) {
|
|
9557
|
-
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));
|
|
9558
|
-
}
|
|
9559
|
-
function isPlainSafeFirst(c) {
|
|
9560
|
-
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;
|
|
9561
|
-
}
|
|
9562
|
-
function needIndentIndicator(string) {
|
|
9563
|
-
return /^\n* /.test(string);
|
|
9564
|
-
}
|
|
9565
|
-
var STYLE_PLAIN = 1;
|
|
9566
|
-
var STYLE_SINGLE = 2;
|
|
9567
|
-
var STYLE_LITERAL = 3;
|
|
9568
|
-
var STYLE_FOLDED = 4;
|
|
9569
|
-
var STYLE_DOUBLE = 5;
|
|
9570
|
-
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
9571
|
-
var i;
|
|
9572
|
-
var char;
|
|
9573
|
-
var prev_char;
|
|
9574
|
-
var hasLineBreak = false;
|
|
9575
|
-
var hasFoldableLine = false;
|
|
9576
|
-
var shouldTrackWidth = lineWidth !== -1;
|
|
9577
|
-
var previousLineBreak = -1;
|
|
9578
|
-
var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
|
|
9579
|
-
if (singleLineOnly) for (i = 0; i < string.length; i++) {
|
|
9580
|
-
char = string.charCodeAt(i);
|
|
9581
|
-
if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
9582
|
-
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
9583
|
-
plain = plain && isPlainSafe(char, prev_char);
|
|
9584
|
-
}
|
|
9585
|
-
else {
|
|
9586
|
-
for (i = 0; i < string.length; i++) {
|
|
9587
|
-
char = string.charCodeAt(i);
|
|
9588
|
-
if (char === CHAR_LINE_FEED) {
|
|
9589
|
-
hasLineBreak = true;
|
|
9590
|
-
if (shouldTrackWidth) {
|
|
9591
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
9592
|
-
previousLineBreak = i;
|
|
9593
|
-
}
|
|
9594
|
-
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
9595
|
-
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
9596
|
-
plain = plain && isPlainSafe(char, prev_char);
|
|
9597
|
-
}
|
|
9598
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
9599
|
-
}
|
|
9600
|
-
if (!hasLineBreak && !hasFoldableLine) return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
|
|
9601
|
-
if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
|
|
9602
|
-
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
9603
|
-
}
|
|
9604
|
-
function writeScalar(state, string, level, iskey, pointer) {
|
|
9605
|
-
var _result = (function() {
|
|
9606
|
-
if (string.length === 0) return "''";
|
|
9607
|
-
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) return "'" + string + "'";
|
|
9608
|
-
var indent = state.indent * Math.max(1, level);
|
|
9609
|
-
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
9610
|
-
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
9611
|
-
function testAmbiguity(string2) {
|
|
9612
|
-
return testImplicitResolving(state, string2);
|
|
9613
|
-
}
|
|
9614
|
-
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
9615
|
-
case STYLE_PLAIN:
|
|
9616
|
-
return string;
|
|
9617
|
-
case STYLE_SINGLE:
|
|
9618
|
-
return "'" + string.replace(/'/g, "''") + "'";
|
|
9619
|
-
case STYLE_LITERAL:
|
|
9620
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
9621
|
-
case STYLE_FOLDED:
|
|
9622
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
9623
|
-
case STYLE_DOUBLE:
|
|
9624
|
-
return '"' + escapeString(string) + '"';
|
|
9625
|
-
default:
|
|
9626
|
-
throw new YAMLException("impossible error: invalid scalar style");
|
|
9627
|
-
}
|
|
9628
|
-
})();
|
|
9629
|
-
if (!iskey) {
|
|
9630
|
-
let comment = new Comments(state, pointer).write(level, "before-eol");
|
|
9631
|
-
if (comment !== "") _result += " " + comment;
|
|
9632
|
-
}
|
|
9633
|
-
state.dump = _result;
|
|
9634
|
-
}
|
|
9635
|
-
function blockHeader(string, indentPerLevel) {
|
|
9636
|
-
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
9637
|
-
var clip = string[string.length - 1] === "\n";
|
|
9638
|
-
return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
|
|
9639
|
-
}
|
|
9640
|
-
function dropEndingNewline(string) {
|
|
9641
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
9642
|
-
}
|
|
9643
|
-
function foldString(string, width) {
|
|
9644
|
-
var lineRe = /(\n+)([^\n]*)/g;
|
|
9645
|
-
var result = (function() {
|
|
9646
|
-
var nextLF = string.indexOf("\n");
|
|
9647
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
9648
|
-
lineRe.lastIndex = nextLF;
|
|
9649
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
9650
|
-
})();
|
|
9651
|
-
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
9652
|
-
var moreIndented;
|
|
9653
|
-
var match;
|
|
9654
|
-
while (match = lineRe.exec(string)) {
|
|
9655
|
-
var prefix = match[1];
|
|
9656
|
-
var line = match[2];
|
|
9657
|
-
moreIndented = line[0] === " ";
|
|
9658
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
9659
|
-
prevMoreIndented = moreIndented;
|
|
9660
|
-
}
|
|
9661
|
-
return result;
|
|
9662
|
-
}
|
|
9663
|
-
function foldLine(line, width) {
|
|
9664
|
-
if (line === "" || line[0] === " ") return line;
|
|
9665
|
-
var breakRe = / [^ ]/g;
|
|
9666
|
-
var match;
|
|
9667
|
-
var start = 0;
|
|
9668
|
-
var end;
|
|
9669
|
-
var curr = 0;
|
|
9670
|
-
var next = 0;
|
|
9671
|
-
var result = "";
|
|
9672
|
-
while (match = breakRe.exec(line)) {
|
|
9673
|
-
next = match.index;
|
|
9674
|
-
if (next - start > width) {
|
|
9675
|
-
end = curr > start ? curr : next;
|
|
9676
|
-
result += "\n" + line.slice(start, end);
|
|
9677
|
-
start = end + 1;
|
|
9678
|
-
}
|
|
9679
|
-
curr = next;
|
|
9680
|
-
}
|
|
9681
|
-
result += "\n";
|
|
9682
|
-
if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
9683
|
-
else result += line.slice(start);
|
|
9684
|
-
return result.slice(1);
|
|
9685
|
-
}
|
|
9686
|
-
function escapeString(string) {
|
|
9687
|
-
var result = "";
|
|
9688
|
-
var char;
|
|
9689
|
-
var nextChar;
|
|
9690
|
-
var escapeSeq;
|
|
9691
|
-
for (var i = 0; i < string.length; i++) {
|
|
9692
|
-
char = string.charCodeAt(i);
|
|
9693
|
-
if (char >= 55296 && char <= 56319) {
|
|
9694
|
-
nextChar = string.charCodeAt(i + 1);
|
|
9695
|
-
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
9696
|
-
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
9697
|
-
i++;
|
|
9698
|
-
continue;
|
|
9699
|
-
}
|
|
9700
|
-
}
|
|
9701
|
-
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
9702
|
-
result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
|
|
9703
|
-
}
|
|
9704
|
-
return result;
|
|
9705
|
-
}
|
|
9706
|
-
function writeFlowSequence(state, level, object, pointer) {
|
|
9707
|
-
var _result = "";
|
|
9708
|
-
var _tag = state.tag;
|
|
9709
|
-
var index;
|
|
9710
|
-
var length;
|
|
9711
|
-
for (index = 0, length = object.length; index < length; index += 1) if (writeNode(state, level, object[index], false, false, false, pointer)) {
|
|
9712
|
-
if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
|
|
9713
|
-
_result += state.dump;
|
|
9714
|
-
}
|
|
9715
|
-
state.tag = _tag;
|
|
9716
|
-
state.dump = "[" + _result + "]";
|
|
9717
|
-
}
|
|
9718
|
-
function writeBlockSequence(state, level, object, compact, pointer) {
|
|
9719
|
-
var _result = "";
|
|
9720
|
-
var _tag = state.tag;
|
|
9721
|
-
var index;
|
|
9722
|
-
var length;
|
|
9723
|
-
var comments = new Comments(state, pointer);
|
|
9724
|
-
_result += comments.write(level, "before-eol");
|
|
9725
|
-
_result += comments.write(level, "leading");
|
|
9726
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
9727
|
-
_result += comments.writeAt(String(index), level, "before");
|
|
9728
|
-
if (writeNode(state, level + 1, object[index], true, true, false, `${pointer}/${index}`)) {
|
|
9729
|
-
if (!compact || index !== 0) _result += generateNextLine(state, level);
|
|
9730
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
|
|
9731
|
-
else _result += "- ";
|
|
9732
|
-
_result += state.dump;
|
|
9733
|
-
}
|
|
9734
|
-
_result += comments.writeAt(String(index), level, "after");
|
|
9735
|
-
}
|
|
9736
|
-
state.tag = _tag;
|
|
9737
|
-
state.dump = _result || "[]";
|
|
9738
|
-
state.dump += comments.write(level, "trailing");
|
|
9739
|
-
}
|
|
9740
|
-
function writeFlowMapping(state, level, object, pointer) {
|
|
9741
|
-
var _result = "";
|
|
9742
|
-
var _tag = state.tag;
|
|
9743
|
-
var objectKeyList = Object.keys(object);
|
|
9744
|
-
var index;
|
|
9745
|
-
var length;
|
|
9746
|
-
var objectKey;
|
|
9747
|
-
var objectValue;
|
|
9748
|
-
var pairBuffer;
|
|
9749
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
9750
|
-
pairBuffer = "";
|
|
9751
|
-
if (index !== 0) pairBuffer += ", ";
|
|
9752
|
-
if (state.condenseFlow) pairBuffer += '"';
|
|
9753
|
-
objectKey = objectKeyList[index];
|
|
9754
|
-
objectValue = object[objectKey];
|
|
9755
|
-
if (!writeNode(state, level, objectKey, false, false, false, pointer)) continue;
|
|
9756
|
-
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
9757
|
-
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
9758
|
-
if (!writeNode(state, level, objectValue, false, false, false, pointer)) continue;
|
|
9759
|
-
pairBuffer += state.dump;
|
|
9760
|
-
_result += pairBuffer;
|
|
9761
|
-
}
|
|
9762
|
-
state.tag = _tag;
|
|
9763
|
-
state.dump = "{" + _result + "}";
|
|
9764
|
-
}
|
|
9765
|
-
function writeBlockMapping(state, level, object, compact, pointer) {
|
|
9766
|
-
var _result = "";
|
|
9767
|
-
var _tag = state.tag;
|
|
9768
|
-
var objectKeyList = Object.keys(object);
|
|
9769
|
-
var index;
|
|
9770
|
-
var length;
|
|
9771
|
-
var objectKey;
|
|
9772
|
-
var objectValue;
|
|
9773
|
-
var explicitPair;
|
|
9774
|
-
var pairBuffer;
|
|
9775
|
-
if (state.sortKeys === true) objectKeyList.sort();
|
|
9776
|
-
else if (typeof state.sortKeys === "function") objectKeyList.sort(state.sortKeys);
|
|
9777
|
-
else if (state.sortKeys) throw new YAMLException("sortKeys must be a boolean or a function");
|
|
9778
|
-
var comments = new Comments(state, pointer);
|
|
9779
|
-
_result += comments.write(level, "before-eol");
|
|
9780
|
-
_result += comments.write(level, "leading");
|
|
9781
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
9782
|
-
pairBuffer = "";
|
|
9783
|
-
if (!compact || index !== 0) pairBuffer += generateNextLine(state, level);
|
|
9784
|
-
objectKey = objectKeyList[index];
|
|
9785
|
-
objectValue = object[objectKey];
|
|
9786
|
-
_result += comments.writeAt(objectKey, level, "before");
|
|
9787
|
-
if (!writeNode(state, level + 1, objectKey, true, true, true, pointer)) continue;
|
|
9788
|
-
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
9789
|
-
if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
|
|
9790
|
-
else pairBuffer += "? ";
|
|
9791
|
-
pairBuffer += state.dump;
|
|
9792
|
-
if (explicitPair) pairBuffer += generateNextLine(state, level);
|
|
9793
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair, false, `${pointer}/${encodeSegment(objectKey)}`)) continue;
|
|
9794
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
|
|
9795
|
-
else pairBuffer += ": ";
|
|
9796
|
-
pairBuffer += state.dump;
|
|
9797
|
-
_result += pairBuffer;
|
|
9798
|
-
_result += comments.writeAt(level, objectKey, "after");
|
|
9799
|
-
}
|
|
9800
|
-
state.tag = _tag;
|
|
9801
|
-
state.dump = _result || "{}";
|
|
9802
|
-
state.dump += comments.write(level, "trailing");
|
|
9803
|
-
}
|
|
9804
|
-
function detectType(state, object, explicit) {
|
|
9805
|
-
var _result;
|
|
9806
|
-
var typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
9807
|
-
var index;
|
|
9808
|
-
var length;
|
|
9809
|
-
var type;
|
|
9810
|
-
var style;
|
|
9811
|
-
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
9812
|
-
type = typeList[index];
|
|
9813
|
-
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
9814
|
-
state.tag = explicit ? type.tag : "?";
|
|
9815
|
-
if (type.represent) {
|
|
9816
|
-
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
9817
|
-
if (_toString.call(type.represent) === "[object Function]") _result = type.represent(object, style);
|
|
9818
|
-
else if (_hasOwnProperty.call(type.represent, style)) _result = type.represent[style](object, style);
|
|
9819
|
-
else throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
9820
|
-
state.dump = _result;
|
|
9821
|
-
}
|
|
9822
|
-
return true;
|
|
9823
|
-
}
|
|
9824
|
-
}
|
|
9825
|
-
return false;
|
|
9826
|
-
}
|
|
9827
|
-
function writeNode(state, level, object, block, compact, iskey, pointer) {
|
|
9828
|
-
state.tag = null;
|
|
9829
|
-
state.dump = object;
|
|
9830
|
-
if (!detectType(state, object, false)) detectType(state, object, true);
|
|
9831
|
-
var type = _toString.call(state.dump);
|
|
9832
|
-
if (block) block = state.flowLevel < 0 || state.flowLevel > level;
|
|
9833
|
-
if (state.tag !== null && state.tag !== "?" || state.indent !== 2 && level > 0) compact = false;
|
|
9834
|
-
var objectOrArray = type === "[object Object]" || type === "[object Array]";
|
|
9835
|
-
var duplicateIndex;
|
|
9836
|
-
var duplicate;
|
|
9837
|
-
if (objectOrArray) {
|
|
9838
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
9839
|
-
duplicate = duplicateIndex !== -1;
|
|
9840
|
-
}
|
|
9841
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
|
|
9842
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
|
|
9843
|
-
else {
|
|
9844
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
|
|
9845
|
-
if (type === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
|
|
9846
|
-
writeBlockMapping(state, level, state.dump, compact, pointer);
|
|
9847
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
9848
|
-
} else {
|
|
9849
|
-
writeFlowMapping(state, level, state.dump, pointer);
|
|
9850
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
9851
|
-
}
|
|
9852
|
-
else if (type === "[object Array]") {
|
|
9853
|
-
var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
|
|
9854
|
-
if (block && state.dump.length !== 0) {
|
|
9855
|
-
writeBlockSequence(state, arrayLevel, state.dump, compact, pointer);
|
|
9856
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
9857
|
-
} else {
|
|
9858
|
-
writeFlowSequence(state, arrayLevel, state.dump, pointer);
|
|
9859
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
9860
|
-
}
|
|
9861
|
-
} else if (type === "[object String]") {
|
|
9862
|
-
if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, pointer);
|
|
9863
|
-
} else {
|
|
9864
|
-
if (state.skipInvalid) return false;
|
|
9865
|
-
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
9866
|
-
}
|
|
9867
|
-
if (state.tag !== null && state.tag !== "?") state.dump = "!<" + state.tag + "> " + state.dump;
|
|
9868
|
-
}
|
|
9869
|
-
return true;
|
|
9870
|
-
}
|
|
9871
|
-
function getDuplicateReferences(object, state) {
|
|
9872
|
-
var objects = [];
|
|
9873
|
-
var duplicatesIndexes = [];
|
|
9874
|
-
var index;
|
|
9875
|
-
var length;
|
|
9876
|
-
inspectNode(object, objects, duplicatesIndexes);
|
|
9877
|
-
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
9878
|
-
state.usedDuplicates = new Array(length);
|
|
9879
|
-
}
|
|
9880
|
-
function inspectNode(object, objects, duplicatesIndexes) {
|
|
9881
|
-
var objectKeyList;
|
|
9882
|
-
var index;
|
|
9883
|
-
var length;
|
|
9884
|
-
if (object !== null && typeof object === "object") {
|
|
9885
|
-
index = objects.indexOf(object);
|
|
9886
|
-
if (index !== -1) {
|
|
9887
|
-
if (duplicatesIndexes.indexOf(index) === -1) duplicatesIndexes.push(index);
|
|
9888
|
-
} else {
|
|
9889
|
-
objects.push(object);
|
|
9890
|
-
if (Array.isArray(object)) for (index = 0, length = object.length; index < length; index += 1) inspectNode(object[index], objects, duplicatesIndexes);
|
|
9891
|
-
else {
|
|
9892
|
-
objectKeyList = Object.keys(object);
|
|
9893
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
9894
|
-
}
|
|
9895
|
-
}
|
|
9896
|
-
}
|
|
9897
|
-
}
|
|
9898
|
-
function dump(input, options) {
|
|
9899
|
-
options = options || {};
|
|
9900
|
-
var state = new State(options);
|
|
9901
|
-
if (!options.noRefs) getDuplicateReferences(input, state);
|
|
9902
|
-
if (writeNode(state, 0, input, true, true, false, "#")) return state.dump + "\n";
|
|
9903
|
-
return "";
|
|
9904
|
-
}
|
|
9905
|
-
exports$1.dump = dump;
|
|
9906
|
-
function safeDump(input, options) {
|
|
9907
|
-
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
9908
|
-
}
|
|
9909
|
-
exports$1.safeDump = safeDump;
|
|
9910
|
-
const TILDE_REGEXP = /~/g;
|
|
9911
|
-
const SLASH_REGEXP = /\//g;
|
|
9912
|
-
function encodeSegment(input) {
|
|
9913
|
-
return input.replace(TILDE_REGEXP, "~0").replace(SLASH_REGEXP, "~1");
|
|
9914
|
-
}
|
|
9915
|
-
function Comments(state, pointer) {
|
|
9916
|
-
this.state = state;
|
|
9917
|
-
this.comments = {
|
|
9918
|
-
"before-eol": /* @__PURE__ */ new Set(),
|
|
9919
|
-
leading: /* @__PURE__ */ new Set(),
|
|
9920
|
-
trailing: /* @__PURE__ */ new Set(),
|
|
9921
|
-
before: /* @__PURE__ */ new Map(),
|
|
9922
|
-
after: /* @__PURE__ */ new Map()
|
|
9923
|
-
};
|
|
9924
|
-
this.written = /* @__PURE__ */ new WeakSet();
|
|
9925
|
-
if (state.comments !== null && pointer in state.comments) for (let comment of state.comments[pointer]) switch (comment.placement) {
|
|
9926
|
-
case "before-eol":
|
|
9927
|
-
case "leading":
|
|
9928
|
-
case "trailing":
|
|
9929
|
-
this.comments[comment.placement].add(comment);
|
|
9930
|
-
break;
|
|
9931
|
-
case "between":
|
|
9932
|
-
let before = this.comments.before.get(comment.between[1]);
|
|
9933
|
-
if (!before) this.comments.before.set(comment.between[1], /* @__PURE__ */ new Set([comment]));
|
|
9934
|
-
else before.add(comment);
|
|
9935
|
-
let after = this.comments.after.get(comment.between[0]);
|
|
9936
|
-
if (!after) this.comments.after.set(comment.between[0], /* @__PURE__ */ new Set([comment]));
|
|
9937
|
-
else after.add(comment);
|
|
9938
|
-
break;
|
|
9939
|
-
}
|
|
9940
|
-
}
|
|
9941
|
-
Comments.prototype.write = function(level, placement) {
|
|
9942
|
-
let result = "";
|
|
9943
|
-
for (let comment of this.comments[placement]) result += this._write(comment, level);
|
|
9944
|
-
return result;
|
|
9945
|
-
};
|
|
9946
|
-
Comments.prototype.writeAt = function(key, level, placement) {
|
|
9947
|
-
let result = "";
|
|
9948
|
-
let comments = this.comments[placement].get(key);
|
|
9949
|
-
if (comments) for (let comment of comments) result += this._write(comment, level);
|
|
9950
|
-
return result;
|
|
9951
|
-
};
|
|
9952
|
-
Comments.prototype._write = function(comment, level) {
|
|
9953
|
-
if (this.written.has(comment)) return "";
|
|
9954
|
-
this.written.add(comment);
|
|
9955
|
-
let result = "#" + comment.value;
|
|
9956
|
-
if (comment.placement === "before-eol") return result;
|
|
9957
|
-
else if (level === 0 && comment.placement === "leading") return result + "\n";
|
|
9958
|
-
else return generateNextLine(this.state, level) + result;
|
|
9959
|
-
};
|
|
9960
|
-
}));
|
|
9961
|
-
var require_scalarInference = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
9962
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
9963
|
-
function parseYamlBoolean(input) {
|
|
9964
|
-
if ([
|
|
9965
|
-
"true",
|
|
9966
|
-
"True",
|
|
9967
|
-
"TRUE"
|
|
9968
|
-
].lastIndexOf(input) >= 0) return true;
|
|
9969
|
-
else if ([
|
|
9970
|
-
"false",
|
|
9971
|
-
"False",
|
|
9972
|
-
"FALSE"
|
|
9973
|
-
].lastIndexOf(input) >= 0) return false;
|
|
9974
|
-
throw `Invalid boolean "${input}"`;
|
|
9975
|
-
}
|
|
9976
|
-
exports$1.parseYamlBoolean = parseYamlBoolean;
|
|
9977
|
-
function safeParseYamlInteger(input) {
|
|
9978
|
-
if (input.lastIndexOf("0o", 0) === 0) return parseInt(input.substring(2), 8);
|
|
9979
|
-
return parseInt(input);
|
|
9980
|
-
}
|
|
9981
|
-
function parseYamlInteger(input) {
|
|
9982
|
-
const result = safeParseYamlInteger(input);
|
|
9983
|
-
if (Number.isNaN(result)) throw `Invalid integer "${input}"`;
|
|
9984
|
-
return result;
|
|
9985
|
-
}
|
|
9986
|
-
exports$1.parseYamlInteger = parseYamlInteger;
|
|
9987
|
-
function parseYamlBigInteger(input) {
|
|
9988
|
-
const result = parseYamlInteger(input);
|
|
9989
|
-
if (result > Number.MAX_SAFE_INTEGER && input.lastIndexOf("0o", 0) === -1) return BigInt(input);
|
|
9990
|
-
return result;
|
|
9991
|
-
}
|
|
9992
|
-
exports$1.parseYamlBigInteger = parseYamlBigInteger;
|
|
9993
|
-
function parseYamlFloat(input) {
|
|
9994
|
-
if ([
|
|
9995
|
-
".nan",
|
|
9996
|
-
".NaN",
|
|
9997
|
-
".NAN"
|
|
9998
|
-
].lastIndexOf(input) >= 0) return NaN;
|
|
9999
|
-
const match = /^([-+])?(?:\.inf|\.Inf|\.INF)$/.exec(input);
|
|
10000
|
-
if (match) return match[1] === "-" ? -Infinity : Infinity;
|
|
10001
|
-
const result = parseFloat(input);
|
|
10002
|
-
if (!isNaN(result)) return result;
|
|
10003
|
-
throw `Invalid float "${input}"`;
|
|
10004
|
-
}
|
|
10005
|
-
exports$1.parseYamlFloat = parseYamlFloat;
|
|
10006
|
-
var ScalarType;
|
|
10007
|
-
(function(ScalarType2) {
|
|
10008
|
-
ScalarType2[ScalarType2["null"] = 0] = "null";
|
|
10009
|
-
ScalarType2[ScalarType2["bool"] = 1] = "bool";
|
|
10010
|
-
ScalarType2[ScalarType2["int"] = 2] = "int";
|
|
10011
|
-
ScalarType2[ScalarType2["float"] = 3] = "float";
|
|
10012
|
-
ScalarType2[ScalarType2["string"] = 4] = "string";
|
|
10013
|
-
})(ScalarType = exports$1.ScalarType || (exports$1.ScalarType = {}));
|
|
10014
|
-
function determineScalarType(node) {
|
|
10015
|
-
if (node === void 0) return ScalarType.null;
|
|
10016
|
-
if (node.doubleQuoted || !node.plainScalar || node["singleQuoted"]) return ScalarType.string;
|
|
10017
|
-
const value = node.value;
|
|
10018
|
-
if ([
|
|
10019
|
-
"null",
|
|
10020
|
-
"Null",
|
|
10021
|
-
"NULL",
|
|
10022
|
-
"~",
|
|
10023
|
-
""
|
|
10024
|
-
].indexOf(value) >= 0) return ScalarType.null;
|
|
10025
|
-
if (value === null || value === void 0) return ScalarType.null;
|
|
10026
|
-
if ([
|
|
10027
|
-
"true",
|
|
10028
|
-
"True",
|
|
10029
|
-
"TRUE",
|
|
10030
|
-
"false",
|
|
10031
|
-
"False",
|
|
10032
|
-
"FALSE"
|
|
10033
|
-
].indexOf(value) >= 0) return ScalarType.bool;
|
|
10034
|
-
if (/^[-+]?[0-9]+$/.test(value) || /^0o[0-7]+$/.test(value) || /^0x[0-9a-fA-F]+$/.test(value)) return ScalarType.int;
|
|
10035
|
-
if (/^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/.test(value) || /^[-+]?(\.inf|\.Inf|\.INF)$/.test(value) || [
|
|
10036
|
-
".nan",
|
|
10037
|
-
".NaN",
|
|
10038
|
-
".NAN"
|
|
10039
|
-
].indexOf(value) >= 0) return ScalarType.float;
|
|
10040
|
-
return ScalarType.string;
|
|
10041
|
-
}
|
|
10042
|
-
exports$1.determineScalarType = determineScalarType;
|
|
10043
|
-
}));
|
|
10044
|
-
var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10045
|
-
function __export(m) {
|
|
10046
|
-
for (var p in m) if (!exports$1.hasOwnProperty(p)) exports$1[p] = m[p];
|
|
10047
|
-
}
|
|
10048
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10049
|
-
var loader_1 = require_loader();
|
|
10050
|
-
exports$1.load = loader_1.load;
|
|
10051
|
-
exports$1.loadAll = loader_1.loadAll;
|
|
10052
|
-
exports$1.safeLoad = loader_1.safeLoad;
|
|
10053
|
-
exports$1.safeLoadAll = loader_1.safeLoadAll;
|
|
10054
|
-
var dumper_1 = require_dumper();
|
|
10055
|
-
exports$1.dump = dumper_1.dump;
|
|
10056
|
-
exports$1.safeDump = dumper_1.safeDump;
|
|
10057
|
-
exports$1.YAMLException = require_exception();
|
|
10058
|
-
__export(require_yamlAST());
|
|
10059
|
-
__export(require_scalarInference());
|
|
10060
|
-
}));
|
|
10061
|
-
var require_types = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10062
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10063
|
-
const yaml_ast_parser_1 = require_src$1();
|
|
10064
|
-
exports$1.Kind = yaml_ast_parser_1.Kind;
|
|
10065
|
-
exports$1.ScalarType = yaml_ast_parser_1.ScalarType;
|
|
10066
|
-
}));
|
|
10067
|
-
var require_utils = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10068
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10069
|
-
exports$1.isObject = (sth) => sth !== null && typeof sth === "object";
|
|
10070
|
-
}));
|
|
10071
|
-
var require_buildJsonPath = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10072
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10073
|
-
const types_1 = require_types();
|
|
10074
|
-
const utils_1 = require_utils();
|
|
10075
|
-
function buildJsonPath(node) {
|
|
10076
|
-
const path2 = [];
|
|
10077
|
-
let prevNode = node;
|
|
10078
|
-
while (node) {
|
|
10079
|
-
switch (node.kind) {
|
|
10080
|
-
case types_1.Kind.SCALAR:
|
|
10081
|
-
path2.unshift(node.value);
|
|
10082
|
-
break;
|
|
10083
|
-
case types_1.Kind.MAPPING:
|
|
10084
|
-
if (prevNode !== node.key) if (path2.length > 0 && utils_1.isObject(node.value) && node.value.value === path2[0]) path2[0] = node.key.value;
|
|
10085
|
-
else path2.unshift(node.key.value);
|
|
10086
|
-
break;
|
|
10087
|
-
case types_1.Kind.SEQ:
|
|
10088
|
-
if (prevNode) {
|
|
10089
|
-
const index = node.items.indexOf(prevNode);
|
|
10090
|
-
if (prevNode.kind === types_1.Kind.SCALAR) path2[0] = index;
|
|
10091
|
-
else if (index !== -1) path2.unshift(index);
|
|
10092
|
-
}
|
|
10093
|
-
break;
|
|
10094
|
-
}
|
|
10095
|
-
prevNode = node;
|
|
10096
|
-
node = node.parent;
|
|
10097
|
-
}
|
|
10098
|
-
return path2;
|
|
10099
|
-
}
|
|
10100
|
-
exports$1.buildJsonPath = buildJsonPath;
|
|
10101
|
-
}));
|
|
10102
|
-
var require_dereferenceAnchor = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10103
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10104
|
-
const types_1 = require_types();
|
|
10105
|
-
const utils_1 = require_utils();
|
|
10106
|
-
exports$1.dereferenceAnchor = (node, anchorId) => {
|
|
10107
|
-
if (!utils_1.isObject(node)) return node;
|
|
10108
|
-
if (node.kind === types_1.Kind.ANCHOR_REF && node.referencesAnchor === anchorId) return null;
|
|
10109
|
-
switch (node.kind) {
|
|
10110
|
-
case types_1.Kind.MAP:
|
|
10111
|
-
return Object.assign({}, node, { mappings: node.mappings.map((mapping) => exports$1.dereferenceAnchor(mapping, anchorId)) });
|
|
10112
|
-
case types_1.Kind.SEQ:
|
|
10113
|
-
return Object.assign({}, node, { items: node.items.map((item) => exports$1.dereferenceAnchor(item, anchorId)) });
|
|
10114
|
-
case types_1.Kind.MAPPING:
|
|
10115
|
-
return Object.assign({}, node, { value: exports$1.dereferenceAnchor(node.value, anchorId) });
|
|
10116
|
-
case types_1.Kind.SCALAR:
|
|
10117
|
-
return node;
|
|
10118
|
-
case types_1.Kind.ANCHOR_REF:
|
|
10119
|
-
if (utils_1.isObject(node.value) && isSelfReferencingAnchorRef(node)) return null;
|
|
10120
|
-
return node;
|
|
10121
|
-
default:
|
|
10122
|
-
return node;
|
|
10123
|
-
}
|
|
10124
|
-
};
|
|
10125
|
-
const isSelfReferencingAnchorRef = (anchorRef) => {
|
|
10126
|
-
const { referencesAnchor } = anchorRef;
|
|
10127
|
-
let node = anchorRef;
|
|
10128
|
-
while (node = node.parent) if ("anchorId" in node && node.anchorId === referencesAnchor) return true;
|
|
10129
|
-
return false;
|
|
10130
|
-
};
|
|
10131
|
-
}));
|
|
10132
|
-
var require_getJsonPathForPosition = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10133
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10134
|
-
const buildJsonPath_1 = require_buildJsonPath();
|
|
10135
|
-
const types_1 = require_types();
|
|
10136
|
-
const utils_1 = require_utils();
|
|
10137
|
-
exports$1.getJsonPathForPosition = ({ ast, lineMap }, { line, character }) => {
|
|
10138
|
-
if (line >= lineMap.length || character >= lineMap[line]) return;
|
|
10139
|
-
const startOffset = line === 0 ? 0 : lineMap[line - 1] + 1;
|
|
10140
|
-
const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
|
|
10141
|
-
if (!utils_1.isObject(node)) return;
|
|
10142
|
-
const path2 = buildJsonPath_1.buildJsonPath(node);
|
|
10143
|
-
if (path2.length === 0) return;
|
|
10144
|
-
return path2;
|
|
10145
|
-
};
|
|
10146
|
-
function* walk(node) {
|
|
10147
|
-
switch (node.kind) {
|
|
10148
|
-
case types_1.Kind.MAP:
|
|
10149
|
-
if (node.mappings.length !== 0) {
|
|
10150
|
-
for (const mapping of node.mappings) if (utils_1.isObject(mapping)) yield mapping;
|
|
10151
|
-
}
|
|
10152
|
-
break;
|
|
10153
|
-
case types_1.Kind.MAPPING:
|
|
10154
|
-
if (utils_1.isObject(node.key)) yield node.key;
|
|
10155
|
-
if (utils_1.isObject(node.value)) yield node.value;
|
|
10156
|
-
break;
|
|
10157
|
-
case types_1.Kind.SEQ:
|
|
10158
|
-
if (node.items.length !== 0) {
|
|
10159
|
-
for (const item of node.items) if (utils_1.isObject(item)) yield item;
|
|
10160
|
-
}
|
|
10161
|
-
break;
|
|
10162
|
-
case types_1.Kind.SCALAR:
|
|
10163
|
-
yield node;
|
|
10164
|
-
break;
|
|
10165
|
-
}
|
|
10166
|
-
}
|
|
10167
|
-
function getFirstScalarChild(node, line, lineMap) {
|
|
10168
|
-
const startOffset = lineMap[line - 1] + 1;
|
|
10169
|
-
const endOffset = lineMap[line];
|
|
10170
|
-
switch (node.kind) {
|
|
10171
|
-
case types_1.Kind.MAPPING:
|
|
10172
|
-
return node.key;
|
|
10173
|
-
case types_1.Kind.MAP:
|
|
10174
|
-
if (node.mappings.length !== 0) {
|
|
10175
|
-
for (const mapping of node.mappings) if (mapping.startPosition > startOffset && mapping.startPosition <= endOffset) return getFirstScalarChild(mapping, line, lineMap);
|
|
10176
|
-
}
|
|
10177
|
-
break;
|
|
10178
|
-
case types_1.Kind.SEQ:
|
|
10179
|
-
if (node.items.length !== 0) {
|
|
10180
|
-
for (const item of node.items) if (item !== null && item.startPosition > startOffset && item.startPosition <= endOffset) return getFirstScalarChild(item, line, lineMap);
|
|
10181
|
-
}
|
|
10182
|
-
break;
|
|
10183
|
-
}
|
|
10184
|
-
return node;
|
|
10185
|
-
}
|
|
10186
|
-
function findClosestScalar(container, offset, line, lineMap) {
|
|
10187
|
-
for (const node of walk(container)) if (node.startPosition <= offset && offset <= node.endPosition) return node.kind === types_1.Kind.SCALAR ? node : findClosestScalar(node, offset, line, lineMap);
|
|
10188
|
-
if (lineMap[line - 1] === lineMap[line] - 1) return container;
|
|
10189
|
-
if (container.startPosition < lineMap[line - 1] && offset <= container.endPosition) {
|
|
10190
|
-
if (container.kind !== types_1.Kind.MAPPING) return getFirstScalarChild(container, line, lineMap);
|
|
10191
|
-
if (container.value && container.key.endPosition < offset) return getFirstScalarChild(container.value, line, lineMap);
|
|
10192
|
-
}
|
|
10193
|
-
return container;
|
|
10194
|
-
}
|
|
10195
|
-
}));
|
|
10196
|
-
var require_lineForPosition = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10197
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10198
|
-
exports$1.lineForPosition = (pos, lines, start = 0, end) => {
|
|
10199
|
-
if (pos === 0 || lines.length === 0 || pos < lines[0]) return 0;
|
|
10200
|
-
if (typeof end === "undefined") end = lines.length;
|
|
10201
|
-
const target = Math.floor((end - start) / 2) + start;
|
|
10202
|
-
if (pos >= lines[target] && !lines[target + 1]) return target + 1;
|
|
10203
|
-
const nextLinePos = lines[Math.min(target + 1, lines.length)];
|
|
10204
|
-
if (pos === lines[target] - 1) return target;
|
|
10205
|
-
if (pos >= lines[target] && pos <= nextLinePos) {
|
|
10206
|
-
if (pos === nextLinePos) return target + 2;
|
|
10207
|
-
return target + 1;
|
|
10208
|
-
}
|
|
10209
|
-
if (pos > lines[target]) return exports$1.lineForPosition(pos, lines, target + 1, end);
|
|
10210
|
-
else return exports$1.lineForPosition(pos, lines, start, target - 1);
|
|
10211
|
-
};
|
|
10212
|
-
}));
|
|
10213
|
-
var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10214
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10215
|
-
const lineForPosition_1 = require_lineForPosition();
|
|
10216
|
-
const types_1 = require_types();
|
|
10217
|
-
const utils_1 = require_utils();
|
|
10218
|
-
exports$1.getLocationForJsonPath = ({ ast, lineMap, metadata }, path2, closest = false) => {
|
|
10219
|
-
const node = findNodeAtPath(ast, path2, {
|
|
10220
|
-
closest,
|
|
10221
|
-
mergeKeys: metadata !== void 0 && metadata.mergeKeys === true
|
|
10222
|
-
});
|
|
10223
|
-
if (node === void 0) return;
|
|
10224
|
-
return getLoc(lineMap, {
|
|
10225
|
-
start: getStartPosition(node, lineMap.length > 0 ? lineMap[0] : 0),
|
|
10226
|
-
end: getEndPosition(node)
|
|
10227
|
-
});
|
|
10228
|
-
};
|
|
10229
|
-
function getStartPosition(node, offset) {
|
|
10230
|
-
if (node.parent && node.parent.kind === types_1.Kind.MAPPING) {
|
|
10231
|
-
if (node.parent.value === null) return node.parent.endPosition;
|
|
10232
|
-
if (node.kind !== types_1.Kind.SCALAR) return node.parent.key.endPosition + 1;
|
|
10233
|
-
}
|
|
10234
|
-
if (node.parent === null && offset - node.startPosition === 0) return 0;
|
|
10235
|
-
return node.startPosition;
|
|
10236
|
-
}
|
|
10237
|
-
function getEndPosition(node) {
|
|
10238
|
-
switch (node.kind) {
|
|
10239
|
-
case types_1.Kind.SEQ:
|
|
10240
|
-
const { items } = node;
|
|
10241
|
-
if (items.length !== 0) {
|
|
10242
|
-
const lastItem = items[items.length - 1];
|
|
10243
|
-
if (lastItem !== null) return getEndPosition(lastItem);
|
|
10244
|
-
}
|
|
10245
|
-
break;
|
|
10246
|
-
case types_1.Kind.MAPPING:
|
|
10247
|
-
if (node.value !== null) return getEndPosition(node.value);
|
|
10248
|
-
break;
|
|
10249
|
-
case types_1.Kind.MAP:
|
|
10250
|
-
if (node.value !== null && node.mappings.length !== 0) return getEndPosition(node.mappings[node.mappings.length - 1]);
|
|
10251
|
-
break;
|
|
10252
|
-
case types_1.Kind.SCALAR:
|
|
10253
|
-
if (node.parent !== null && node.parent.kind === types_1.Kind.MAPPING && node.parent.value === null) return node.parent.endPosition;
|
|
10254
|
-
break;
|
|
10255
|
-
}
|
|
10256
|
-
return node.endPosition;
|
|
10257
|
-
}
|
|
10258
|
-
function findNodeAtPath(node, path2, { closest, mergeKeys }) {
|
|
10259
|
-
pathLoop: for (const segment of path2) {
|
|
10260
|
-
if (!utils_1.isObject(node)) return closest ? node : void 0;
|
|
10261
|
-
switch (node.kind) {
|
|
10262
|
-
case types_1.Kind.MAP:
|
|
10263
|
-
const mappings = getMappings(node.mappings, mergeKeys);
|
|
10264
|
-
for (let i = mappings.length - 1; i >= 0; i--) {
|
|
10265
|
-
const item = mappings[i];
|
|
10266
|
-
if (item.key.value === segment) {
|
|
10267
|
-
if (item.value === null) node = item.key;
|
|
10268
|
-
else node = item.value;
|
|
10269
|
-
continue pathLoop;
|
|
10270
|
-
}
|
|
10271
|
-
}
|
|
10272
|
-
return closest ? node : void 0;
|
|
10273
|
-
case types_1.Kind.SEQ:
|
|
10274
|
-
for (let i = 0; i < node.items.length; i++) if (i === Number(segment)) {
|
|
10275
|
-
const item = node.items[i];
|
|
10276
|
-
if (item === null) break;
|
|
10277
|
-
node = item;
|
|
10278
|
-
continue pathLoop;
|
|
10279
|
-
}
|
|
10280
|
-
return closest ? node : void 0;
|
|
10281
|
-
default:
|
|
10282
|
-
return closest ? node : void 0;
|
|
10283
|
-
}
|
|
10284
|
-
}
|
|
10285
|
-
return node;
|
|
10286
|
-
}
|
|
10287
|
-
function getMappings(mappings, mergeKeys) {
|
|
10288
|
-
if (!mergeKeys) return mappings;
|
|
10289
|
-
return mappings.reduce((mergedMappings, mapping) => {
|
|
10290
|
-
if (utils_1.isObject(mapping)) if (mapping.key.value === "<<") mergedMappings.push(...reduceMergeKeys(mapping.value));
|
|
10291
|
-
else mergedMappings.push(mapping);
|
|
10292
|
-
return mergedMappings;
|
|
10293
|
-
}, []);
|
|
10294
|
-
}
|
|
10295
|
-
function reduceMergeKeys(node) {
|
|
10296
|
-
if (!utils_1.isObject(node)) return [];
|
|
10297
|
-
switch (node.kind) {
|
|
10298
|
-
case types_1.Kind.SEQ:
|
|
10299
|
-
return node.items.reduceRight((items, item) => {
|
|
10300
|
-
items.push(...reduceMergeKeys(item));
|
|
10301
|
-
return items;
|
|
10302
|
-
}, []);
|
|
10303
|
-
case types_1.Kind.MAP:
|
|
10304
|
-
return node.mappings;
|
|
10305
|
-
case types_1.Kind.ANCHOR_REF:
|
|
10306
|
-
return reduceMergeKeys(node.value);
|
|
10307
|
-
default:
|
|
10308
|
-
return [];
|
|
10309
|
-
}
|
|
10310
|
-
}
|
|
10311
|
-
const getLoc = (lineMap, { start = 0, end = 0 }) => {
|
|
10312
|
-
const startLine = lineForPosition_1.lineForPosition(start, lineMap);
|
|
10313
|
-
const endLine = lineForPosition_1.lineForPosition(end, lineMap);
|
|
10314
|
-
return { range: {
|
|
10315
|
-
start: {
|
|
10316
|
-
line: startLine,
|
|
10317
|
-
character: start - (startLine === 0 ? 0 : lineMap[startLine - 1])
|
|
10318
|
-
},
|
|
10319
|
-
end: {
|
|
10320
|
-
line: endLine,
|
|
10321
|
-
character: end - (endLine === 0 ? 0 : lineMap[endLine - 1])
|
|
10322
|
-
}
|
|
10323
|
-
} };
|
|
10324
|
-
};
|
|
10325
|
-
}));
|
|
10326
|
-
var require_src = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10327
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10328
|
-
const ORDER_KEY_ID = `__object_order_${Math.floor(Date.now() / 36e5)}__`;
|
|
10329
|
-
const ORDER_KEY = Symbol.for(ORDER_KEY_ID);
|
|
10330
|
-
const STRINGIFIED_ORDER_KEY = String(ORDER_KEY);
|
|
10331
|
-
const traps = {
|
|
10332
|
-
defineProperty(target, key, descriptor) {
|
|
10333
|
-
if (!Object.prototype.hasOwnProperty.call(target, key) && ORDER_KEY in target) target[ORDER_KEY].push(key);
|
|
10334
|
-
else if ("value" in descriptor && key === ORDER_KEY && descriptor.value.lastIndexOf(ORDER_KEY) === -1) descriptor.value.push(ORDER_KEY);
|
|
10335
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
10336
|
-
},
|
|
10337
|
-
deleteProperty(target, key) {
|
|
10338
|
-
const hasKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
10339
|
-
const deleted = Reflect.deleteProperty(target, key);
|
|
10340
|
-
if (deleted && hasKey && ORDER_KEY in target) {
|
|
10341
|
-
const index = target[ORDER_KEY].indexOf(key);
|
|
10342
|
-
if (index !== -1) target[ORDER_KEY].splice(index, 1);
|
|
10343
|
-
}
|
|
10344
|
-
return deleted;
|
|
10345
|
-
},
|
|
10346
|
-
ownKeys(target) {
|
|
10347
|
-
if (ORDER_KEY in target) return target[ORDER_KEY];
|
|
10348
|
-
return Reflect.ownKeys(target);
|
|
10349
|
-
},
|
|
10350
|
-
set(target, key, value) {
|
|
10351
|
-
const hasKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
10352
|
-
const set = Reflect.set(target, key, value);
|
|
10353
|
-
if (set && !hasKey && ORDER_KEY in target) target[ORDER_KEY].push(key);
|
|
10354
|
-
return set;
|
|
10355
|
-
}
|
|
10356
|
-
};
|
|
10357
|
-
function createObj(target, order = Reflect.ownKeys(target)) {
|
|
10358
|
-
assertObjectLiteral(target);
|
|
10359
|
-
const t = new Proxy(target, traps);
|
|
10360
|
-
setOrder(t, order);
|
|
10361
|
-
return t;
|
|
10362
|
-
}
|
|
10363
|
-
function setOrder(target, order) {
|
|
10364
|
-
if (ORDER_KEY in target) {
|
|
10365
|
-
target[ORDER_KEY].length = 0;
|
|
10366
|
-
target[ORDER_KEY].push(...order);
|
|
10367
|
-
return true;
|
|
10368
|
-
} else return Reflect.defineProperty(target, ORDER_KEY, {
|
|
10369
|
-
configurable: true,
|
|
10370
|
-
value: order
|
|
10371
|
-
});
|
|
10372
|
-
}
|
|
10373
|
-
function getOrder(target) {
|
|
10374
|
-
return target[ORDER_KEY];
|
|
10375
|
-
}
|
|
10376
|
-
function serializeArray(target) {
|
|
10377
|
-
const newTarget = target.slice();
|
|
10378
|
-
for (let i = 0; i < newTarget.length; i += 1) {
|
|
10379
|
-
const value = newTarget[i];
|
|
10380
|
-
if (isObject(value)) newTarget[i] = Array.isArray(value) ? serializeArray(value) : serialize(value, true);
|
|
10381
|
-
}
|
|
10382
|
-
return newTarget;
|
|
10383
|
-
}
|
|
10384
|
-
function serialize(target, deep) {
|
|
10385
|
-
assertObjectLiteral(target, "Invalid target provided");
|
|
10386
|
-
const newTarget = { ...target };
|
|
10387
|
-
if (ORDER_KEY in target) Object.defineProperty(newTarget, STRINGIFIED_ORDER_KEY, {
|
|
10388
|
-
enumerable: true,
|
|
10389
|
-
value: target[ORDER_KEY].filter((item) => item !== ORDER_KEY)
|
|
10390
|
-
});
|
|
10391
|
-
if (deep) for (const key of Object.keys(target)) {
|
|
10392
|
-
if (key === STRINGIFIED_ORDER_KEY) continue;
|
|
10393
|
-
const value = target[key];
|
|
10394
|
-
if (isObject(value)) newTarget[key] = Array.isArray(value) ? serializeArray(value) : serialize(value, true);
|
|
10395
|
-
}
|
|
10396
|
-
return newTarget;
|
|
10397
|
-
}
|
|
10398
|
-
function deserializeArray(target) {
|
|
10399
|
-
for (let i = 0; i < target.length; i += 1) {
|
|
10400
|
-
const value = target[i];
|
|
10401
|
-
if (isObject(value)) target[i] = Array.isArray(value) ? deserializeArray(value) : deserialize(value, true);
|
|
10402
|
-
}
|
|
10403
|
-
return target;
|
|
10404
|
-
}
|
|
10405
|
-
function deserialize(target, deep) {
|
|
10406
|
-
assertObjectLiteral(target, "Invalid target provided");
|
|
10407
|
-
const newTarget = createObj(target, STRINGIFIED_ORDER_KEY in target ? target[STRINGIFIED_ORDER_KEY] : Reflect.ownKeys(target));
|
|
10408
|
-
delete newTarget[STRINGIFIED_ORDER_KEY];
|
|
10409
|
-
if (deep) for (const key of Object.keys(target)) {
|
|
10410
|
-
const value = target[key];
|
|
10411
|
-
if (isObject(value)) target[key] = Array.isArray(value) ? deserializeArray(value) : deserialize(value, true);
|
|
10412
|
-
}
|
|
10413
|
-
return newTarget;
|
|
10414
|
-
}
|
|
10415
|
-
function isOrderedObject(target) {
|
|
10416
|
-
return ORDER_KEY in target;
|
|
10417
|
-
}
|
|
10418
|
-
function isObject(maybeObj) {
|
|
10419
|
-
return maybeObj !== null && typeof maybeObj === "object";
|
|
10420
|
-
}
|
|
10421
|
-
function isObjectLiteral(obj) {
|
|
10422
|
-
if (!isObject(obj)) return false;
|
|
10423
|
-
if (obj[Symbol.toStringTag] !== void 0) {
|
|
10424
|
-
const proto = Object.getPrototypeOf(obj);
|
|
10425
|
-
return proto === null || proto === Object.prototype;
|
|
10426
|
-
}
|
|
10427
|
-
return toStringTag(obj) === "Object";
|
|
10428
|
-
}
|
|
10429
|
-
function toStringTag(obj) {
|
|
10430
|
-
const tag = obj[Symbol.toStringTag];
|
|
10431
|
-
if (typeof tag === "string") return tag;
|
|
10432
|
-
const name = Reflect.apply(Object.prototype.toString, obj, []);
|
|
10433
|
-
return name.slice(8, name.length - 1);
|
|
10434
|
-
}
|
|
10435
|
-
function assertObjectLiteral(maybeObj, message) {
|
|
10436
|
-
if (isDevEnv() && !isObjectLiteral(maybeObj)) throw new TypeError(message);
|
|
10437
|
-
}
|
|
10438
|
-
function isDevEnv() {
|
|
10439
|
-
if (typeof process === "undefined" || !isObject(process) || !isObject(process.env)) return false;
|
|
10440
|
-
return false;
|
|
10441
|
-
}
|
|
10442
|
-
exports$1.ORDER_KEY_ID = ORDER_KEY_ID;
|
|
10443
|
-
exports$1.default = createObj;
|
|
10444
|
-
exports$1.deserialize = deserialize;
|
|
10445
|
-
exports$1.getOrder = getOrder;
|
|
10446
|
-
exports$1.isOrderedObject = isOrderedObject;
|
|
10447
|
-
exports$1.serialize = serialize;
|
|
10448
|
-
exports$1.setOrder = setOrder;
|
|
10449
|
-
}));
|
|
10450
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10451
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10452
|
-
exports$1.HttpOperationSecurityDeclarationTypes = void 0;
|
|
10453
|
-
(function(HttpOperationSecurityDeclarationTypes) {
|
|
10454
|
-
HttpOperationSecurityDeclarationTypes["None"] = "none";
|
|
10455
|
-
HttpOperationSecurityDeclarationTypes["Declared"] = "declared";
|
|
10456
|
-
HttpOperationSecurityDeclarationTypes["InheritedFromService"] = "inheritedFromService";
|
|
10457
|
-
})(exports$1.HttpOperationSecurityDeclarationTypes || (exports$1.HttpOperationSecurityDeclarationTypes = {}));
|
|
10458
|
-
exports$1.HttpParamStyles = void 0;
|
|
10459
|
-
(function(HttpParamStyles) {
|
|
10460
|
-
HttpParamStyles["Unspecified"] = "unspecified";
|
|
10461
|
-
HttpParamStyles["Simple"] = "simple";
|
|
10462
|
-
HttpParamStyles["Matrix"] = "matrix";
|
|
10463
|
-
HttpParamStyles["Label"] = "label";
|
|
10464
|
-
HttpParamStyles["Form"] = "form";
|
|
10465
|
-
HttpParamStyles["CommaDelimited"] = "commaDelimited";
|
|
10466
|
-
HttpParamStyles["SpaceDelimited"] = "spaceDelimited";
|
|
10467
|
-
HttpParamStyles["PipeDelimited"] = "pipeDelimited";
|
|
10468
|
-
HttpParamStyles["DeepObject"] = "deepObject";
|
|
10469
|
-
HttpParamStyles["TabDelimited"] = "tabDelimited";
|
|
10470
|
-
})(exports$1.HttpParamStyles || (exports$1.HttpParamStyles = {}));
|
|
10471
|
-
exports$1.DiagnosticSeverity = void 0;
|
|
10472
|
-
(function(DiagnosticSeverity) {
|
|
10473
|
-
DiagnosticSeverity[DiagnosticSeverity["Error"] = 0] = "Error";
|
|
10474
|
-
DiagnosticSeverity[DiagnosticSeverity["Warning"] = 1] = "Warning";
|
|
10475
|
-
DiagnosticSeverity[DiagnosticSeverity["Information"] = 2] = "Information";
|
|
10476
|
-
DiagnosticSeverity[DiagnosticSeverity["Hint"] = 3] = "Hint";
|
|
10477
|
-
})(exports$1.DiagnosticSeverity || (exports$1.DiagnosticSeverity = {}));
|
|
10478
|
-
exports$1.NodeType = void 0;
|
|
10479
|
-
(function(NodeType) {
|
|
10480
|
-
NodeType["Article"] = "article";
|
|
10481
|
-
NodeType["HttpService"] = "http_service";
|
|
10482
|
-
NodeType["HttpServer"] = "http_server";
|
|
10483
|
-
NodeType["HttpOperation"] = "http_operation";
|
|
10484
|
-
NodeType["HttpCallback"] = "http_callback";
|
|
10485
|
-
NodeType["HttpWebhook"] = "http_webhook";
|
|
10486
|
-
NodeType["Model"] = "model";
|
|
10487
|
-
NodeType["Generic"] = "generic";
|
|
10488
|
-
NodeType["Unknown"] = "unknown";
|
|
10489
|
-
NodeType["TableOfContents"] = "table_of_contents";
|
|
10490
|
-
NodeType["SpectralRuleset"] = "spectral_ruleset";
|
|
10491
|
-
NodeType["Styleguide"] = "styleguide";
|
|
10492
|
-
NodeType["Image"] = "image";
|
|
10493
|
-
NodeType["StoplightResolutions"] = "stoplight_resolutions";
|
|
10494
|
-
NodeType["StoplightOverride"] = "stoplight_override";
|
|
10495
|
-
})(exports$1.NodeType || (exports$1.NodeType = {}));
|
|
10496
|
-
exports$1.NodeFormat = void 0;
|
|
10497
|
-
(function(NodeFormat) {
|
|
10498
|
-
NodeFormat["Json"] = "json";
|
|
10499
|
-
NodeFormat["Markdown"] = "markdown";
|
|
10500
|
-
NodeFormat["Yaml"] = "yaml";
|
|
10501
|
-
NodeFormat["Javascript"] = "javascript";
|
|
10502
|
-
NodeFormat["Apng"] = "apng";
|
|
10503
|
-
NodeFormat["Avif"] = "avif";
|
|
10504
|
-
NodeFormat["Bmp"] = "bmp";
|
|
10505
|
-
NodeFormat["Gif"] = "gif";
|
|
10506
|
-
NodeFormat["Jpeg"] = "jpeg";
|
|
10507
|
-
NodeFormat["Png"] = "png";
|
|
10508
|
-
NodeFormat["Svg"] = "svg";
|
|
10509
|
-
NodeFormat["Webp"] = "webp";
|
|
10510
|
-
})(exports$1.NodeFormat || (exports$1.NodeFormat = {}));
|
|
10511
|
-
}));
|
|
10512
|
-
var require_parseWithPointers = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10513
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10514
|
-
const ordered_object_literal_1 = require_src();
|
|
10515
|
-
const types_1 = require_dist();
|
|
10516
|
-
const yaml_ast_parser_1 = require_src$1();
|
|
10517
|
-
const buildJsonPath_1 = require_buildJsonPath();
|
|
10518
|
-
const dereferenceAnchor_1 = require_dereferenceAnchor();
|
|
10519
|
-
const lineForPosition_1 = require_lineForPosition();
|
|
10520
|
-
const types_2 = require_types();
|
|
10521
|
-
const utils_1 = require_utils();
|
|
10522
|
-
exports$1.parseWithPointers = (value, options) => {
|
|
10523
|
-
const lineMap = computeLineMap(value);
|
|
10524
|
-
const ast = yaml_ast_parser_1.load(value, Object.assign({}, options, { ignoreDuplicateKeys: true }));
|
|
10525
|
-
const parsed = {
|
|
10526
|
-
ast,
|
|
10527
|
-
lineMap,
|
|
10528
|
-
data: void 0,
|
|
10529
|
-
diagnostics: [],
|
|
10530
|
-
metadata: options,
|
|
10531
|
-
comments: {}
|
|
10532
|
-
};
|
|
10533
|
-
if (!ast) return parsed;
|
|
10534
|
-
const normalizedOptions = normalizeOptions(options);
|
|
10535
|
-
const comments = new Comments(parsed.comments, Comments.mapComments(normalizedOptions.attachComments && ast.comments ? ast.comments : [], lineMap), ast, lineMap, "#");
|
|
10536
|
-
parsed.data = walkAST({
|
|
10537
|
-
lineMap,
|
|
10538
|
-
diagnostics: parsed.diagnostics
|
|
10539
|
-
}, ast, comments, normalizedOptions);
|
|
10540
|
-
if (ast.errors) parsed.diagnostics.push(...transformErrors(ast.errors, lineMap));
|
|
10541
|
-
if (parsed.diagnostics.length > 0) parsed.diagnostics.sort((itemA, itemB) => itemA.range.start.line - itemB.range.start.line);
|
|
10542
|
-
if (Array.isArray(parsed.ast.errors)) parsed.ast.errors.length = 0;
|
|
10543
|
-
return parsed;
|
|
10544
|
-
};
|
|
10545
|
-
const TILDE_REGEXP = /~/g;
|
|
10546
|
-
const SLASH_REGEXP = /\//g;
|
|
10547
|
-
function encodeSegment(input) {
|
|
10548
|
-
return input.replace(TILDE_REGEXP, "~0").replace(SLASH_REGEXP, "~1");
|
|
10549
|
-
}
|
|
10550
|
-
const walkAST = (ctx, node, comments, options) => {
|
|
10551
|
-
if (node) switch (node.kind) {
|
|
10552
|
-
case types_2.Kind.MAP: {
|
|
10553
|
-
const mapComments = comments.enter(node);
|
|
10554
|
-
const { lineMap, diagnostics } = ctx;
|
|
10555
|
-
const { preserveKeyOrder, ignoreDuplicateKeys, json, mergeKeys } = options;
|
|
10556
|
-
const container = createMapContainer(preserveKeyOrder);
|
|
10557
|
-
const seenKeys = [];
|
|
10558
|
-
const handleMergeKeys = mergeKeys;
|
|
10559
|
-
const yamlMode = !json;
|
|
10560
|
-
const handleDuplicates = !ignoreDuplicateKeys;
|
|
10561
|
-
for (const mapping of node.mappings) {
|
|
10562
|
-
if (!validateMappingKey(mapping, lineMap, diagnostics, yamlMode)) continue;
|
|
10563
|
-
const key = String(getScalarValue(mapping.key));
|
|
10564
|
-
const mappingComments = mapComments.enter(mapping, encodeSegment(key));
|
|
10565
|
-
if ((yamlMode || handleDuplicates) && (!handleMergeKeys || key !== "<<")) if (seenKeys.includes(key)) {
|
|
10566
|
-
if (yamlMode) throw new Error("Duplicate YAML mapping key encountered");
|
|
10567
|
-
if (handleDuplicates) diagnostics.push(createYAMLException(mapping.key, lineMap, "duplicate key"));
|
|
10568
|
-
} else seenKeys.push(key);
|
|
10569
|
-
if (handleMergeKeys && key === "<<") {
|
|
10570
|
-
const reduced = reduceMergeKeys(walkAST(ctx, mapping.value, mappingComments, options), preserveKeyOrder);
|
|
10571
|
-
Object.assign(container, reduced);
|
|
10572
|
-
} else {
|
|
10573
|
-
container[key] = walkAST(ctx, mapping.value, mappingComments, options);
|
|
10574
|
-
if (preserveKeyOrder) pushKey(container, key);
|
|
10575
|
-
}
|
|
10576
|
-
mappingComments.attachComments();
|
|
10577
|
-
}
|
|
10578
|
-
mapComments.attachComments();
|
|
10579
|
-
return container;
|
|
10580
|
-
}
|
|
10581
|
-
case types_2.Kind.SEQ: {
|
|
10582
|
-
const nodeComments = comments.enter(node);
|
|
10583
|
-
const container = node.items.map((item, i) => {
|
|
10584
|
-
if (item !== null) {
|
|
10585
|
-
const sequenceItemComments = nodeComments.enter(item, i);
|
|
10586
|
-
const walked = walkAST(ctx, item, sequenceItemComments, options);
|
|
10587
|
-
sequenceItemComments.attachComments();
|
|
10588
|
-
return walked;
|
|
10589
|
-
} else return null;
|
|
10590
|
-
});
|
|
10591
|
-
nodeComments.attachComments();
|
|
10592
|
-
return container;
|
|
10593
|
-
}
|
|
10594
|
-
case types_2.Kind.SCALAR: {
|
|
10595
|
-
const value = getScalarValue(node);
|
|
10596
|
-
return !options.bigInt && typeof value === "bigint" ? Number(value) : value;
|
|
10597
|
-
}
|
|
10598
|
-
case types_2.Kind.ANCHOR_REF:
|
|
10599
|
-
if (utils_1.isObject(node.value)) node.value = dereferenceAnchor_1.dereferenceAnchor(node.value, node.referencesAnchor);
|
|
10600
|
-
return walkAST(ctx, node.value, comments, options);
|
|
10601
|
-
default:
|
|
10602
|
-
return null;
|
|
10603
|
-
}
|
|
10604
|
-
return node;
|
|
10605
|
-
};
|
|
10606
|
-
function getScalarValue(node) {
|
|
10607
|
-
switch (yaml_ast_parser_1.determineScalarType(node)) {
|
|
10608
|
-
case types_2.ScalarType.null:
|
|
10609
|
-
return null;
|
|
10610
|
-
case types_2.ScalarType.string:
|
|
10611
|
-
return String(node.value);
|
|
10612
|
-
case types_2.ScalarType.bool:
|
|
10613
|
-
return yaml_ast_parser_1.parseYamlBoolean(node.value);
|
|
10614
|
-
case types_2.ScalarType.int:
|
|
10615
|
-
return yaml_ast_parser_1.parseYamlBigInteger(node.value);
|
|
10616
|
-
case types_2.ScalarType.float:
|
|
10617
|
-
return yaml_ast_parser_1.parseYamlFloat(node.value);
|
|
10618
|
-
}
|
|
10619
|
-
}
|
|
10620
|
-
const computeLineMap = (input) => {
|
|
10621
|
-
const lineMap = [];
|
|
10622
|
-
let i = 0;
|
|
10623
|
-
for (; i < input.length; i++) if (input[i] === "\n") lineMap.push(i + 1);
|
|
10624
|
-
lineMap.push(i + 1);
|
|
10625
|
-
return lineMap;
|
|
10626
|
-
};
|
|
10627
|
-
function getLineLength(lineMap, line) {
|
|
10628
|
-
if (line === 0) return Math.max(0, lineMap[0] - 1);
|
|
10629
|
-
return Math.max(0, lineMap[line] - lineMap[line - 1] - 1);
|
|
10630
|
-
}
|
|
10631
|
-
const transformErrors = (errors, lineMap) => {
|
|
10632
|
-
const validations = [];
|
|
10633
|
-
let possiblyUnexpectedFlow = -1;
|
|
10634
|
-
let i = 0;
|
|
10635
|
-
for (const error of errors) {
|
|
10636
|
-
const validation = {
|
|
10637
|
-
code: error.name,
|
|
10638
|
-
message: error.reason,
|
|
10639
|
-
severity: error.isWarning ? types_1.DiagnosticSeverity.Warning : types_1.DiagnosticSeverity.Error,
|
|
10640
|
-
range: {
|
|
10641
|
-
start: {
|
|
10642
|
-
line: error.mark.line,
|
|
10643
|
-
character: error.mark.column
|
|
10644
|
-
},
|
|
10645
|
-
end: {
|
|
10646
|
-
line: error.mark.line,
|
|
10647
|
-
character: error.mark.toLineEnd ? getLineLength(lineMap, error.mark.line) : error.mark.column
|
|
10648
|
-
}
|
|
10649
|
-
}
|
|
10650
|
-
};
|
|
10651
|
-
if (error.reason === "missed comma between flow collection entries") possiblyUnexpectedFlow = possiblyUnexpectedFlow === -1 ? i : possiblyUnexpectedFlow;
|
|
10652
|
-
else if (possiblyUnexpectedFlow !== -1) {
|
|
10653
|
-
validations[possiblyUnexpectedFlow].range.end = validation.range.end;
|
|
10654
|
-
validations[possiblyUnexpectedFlow].message = "invalid mixed usage of block and flow styles";
|
|
10655
|
-
validations.length = possiblyUnexpectedFlow + 1;
|
|
10656
|
-
i = validations.length;
|
|
10657
|
-
possiblyUnexpectedFlow = -1;
|
|
10658
|
-
}
|
|
10659
|
-
validations.push(validation);
|
|
10660
|
-
i++;
|
|
10661
|
-
}
|
|
10662
|
-
return validations;
|
|
10663
|
-
};
|
|
10664
|
-
const reduceMergeKeys = (items, preserveKeyOrder) => {
|
|
10665
|
-
if (Array.isArray(items)) return items.reduceRight(preserveKeyOrder ? (merged, item) => {
|
|
10666
|
-
const keys = Object.keys(item);
|
|
10667
|
-
Object.assign(merged, item);
|
|
10668
|
-
for (let i = keys.length - 1; i >= 0; i--) unshiftKey(merged, keys[i]);
|
|
10669
|
-
return merged;
|
|
10670
|
-
} : (merged, item) => Object.assign(merged, item), createMapContainer(preserveKeyOrder));
|
|
10671
|
-
return typeof items !== "object" || items === null ? null : Object(items);
|
|
10672
|
-
};
|
|
10673
|
-
function createMapContainer(preserveKeyOrder) {
|
|
10674
|
-
return preserveKeyOrder ? ordered_object_literal_1.default({}) : {};
|
|
10675
|
-
}
|
|
10676
|
-
function deleteKey(container, key) {
|
|
10677
|
-
if (!(key in container)) return;
|
|
10678
|
-
const order = ordered_object_literal_1.getOrder(container);
|
|
10679
|
-
const index = order.indexOf(key);
|
|
10680
|
-
if (index !== -1) order.splice(index, 1);
|
|
10681
|
-
}
|
|
10682
|
-
function unshiftKey(container, key) {
|
|
10683
|
-
deleteKey(container, key);
|
|
10684
|
-
ordered_object_literal_1.getOrder(container).unshift(key);
|
|
10685
|
-
}
|
|
10686
|
-
function pushKey(container, key) {
|
|
10687
|
-
deleteKey(container, key);
|
|
10688
|
-
ordered_object_literal_1.getOrder(container).push(key);
|
|
10689
|
-
}
|
|
10690
|
-
function validateMappingKey(mapping, lineMap, diagnostics, yamlMode) {
|
|
10691
|
-
if (mapping.key.kind !== types_2.Kind.SCALAR) {
|
|
10692
|
-
if (!yamlMode) diagnostics.push(createYAMLIncompatibilityException(mapping.key, lineMap, "mapping key must be a string scalar", yamlMode));
|
|
10693
|
-
return false;
|
|
10694
|
-
}
|
|
10695
|
-
if (!yamlMode) {
|
|
10696
|
-
const type = typeof getScalarValue(mapping.key);
|
|
10697
|
-
if (type !== "string") diagnostics.push(createYAMLIncompatibilityException(mapping.key, lineMap, `mapping key must be a string scalar rather than ${mapping.key.valueObject === null ? "null" : type}`, yamlMode));
|
|
10698
|
-
}
|
|
10699
|
-
return true;
|
|
10700
|
-
}
|
|
10701
|
-
function createYAMLIncompatibilityException(node, lineMap, message, yamlMode) {
|
|
10702
|
-
const exception = createYAMLException(node, lineMap, message);
|
|
10703
|
-
exception.code = "YAMLIncompatibleValue";
|
|
10704
|
-
exception.severity = yamlMode ? types_1.DiagnosticSeverity.Hint : types_1.DiagnosticSeverity.Warning;
|
|
10705
|
-
return exception;
|
|
10706
|
-
}
|
|
10707
|
-
function createYAMLException(node, lineMap, message) {
|
|
10708
|
-
return {
|
|
10709
|
-
code: "YAMLException",
|
|
10710
|
-
message,
|
|
10711
|
-
severity: types_1.DiagnosticSeverity.Error,
|
|
10712
|
-
path: buildJsonPath_1.buildJsonPath(node),
|
|
10713
|
-
range: getRange(lineMap, node.startPosition, node.endPosition)
|
|
10714
|
-
};
|
|
10715
|
-
}
|
|
10716
|
-
function getRange(lineMap, startPosition, endPosition) {
|
|
10717
|
-
const startLine = lineForPosition_1.lineForPosition(startPosition, lineMap);
|
|
10718
|
-
const endLine = lineForPosition_1.lineForPosition(endPosition, lineMap);
|
|
10719
|
-
return {
|
|
10720
|
-
start: {
|
|
10721
|
-
line: startLine,
|
|
10722
|
-
character: startLine === 0 ? startPosition : startPosition - lineMap[startLine - 1]
|
|
10723
|
-
},
|
|
10724
|
-
end: {
|
|
10725
|
-
line: endLine,
|
|
10726
|
-
character: endLine === 0 ? endPosition : endPosition - lineMap[endLine - 1]
|
|
10727
|
-
}
|
|
10728
|
-
};
|
|
10729
|
-
}
|
|
10730
|
-
var Comments = class Comments2 {
|
|
10731
|
-
constructor(attachedComments, comments, node, lineMap, pointer) {
|
|
10732
|
-
this.attachedComments = attachedComments;
|
|
10733
|
-
this.node = node;
|
|
10734
|
-
this.lineMap = lineMap;
|
|
10735
|
-
this.pointer = pointer;
|
|
10736
|
-
if (comments.length === 0) this.comments = [];
|
|
10737
|
-
else {
|
|
10738
|
-
const startPosition = this.getStartPosition(node);
|
|
10739
|
-
const endPosition = this.getEndPosition(node);
|
|
10740
|
-
const startLine = lineForPosition_1.lineForPosition(startPosition, this.lineMap);
|
|
10741
|
-
const endLine = lineForPosition_1.lineForPosition(endPosition, this.lineMap);
|
|
10742
|
-
const matchingComments = [];
|
|
10743
|
-
for (let i = comments.length - 1; i >= 0; i--) {
|
|
10744
|
-
const comment = comments[i];
|
|
10745
|
-
if (comment.range.start.line >= startLine && comment.range.end.line <= endLine) {
|
|
10746
|
-
matchingComments.push(comment);
|
|
10747
|
-
comments.splice(i, 1);
|
|
10748
|
-
}
|
|
10749
|
-
}
|
|
10750
|
-
this.comments = matchingComments;
|
|
10751
|
-
}
|
|
10752
|
-
}
|
|
10753
|
-
getStartPosition(node) {
|
|
10754
|
-
if (node.parent === null) return 0;
|
|
10755
|
-
return node.kind === types_2.Kind.MAPPING ? node.key.startPosition : node.startPosition;
|
|
10756
|
-
}
|
|
10757
|
-
getEndPosition(node) {
|
|
10758
|
-
switch (node.kind) {
|
|
10759
|
-
case types_2.Kind.MAPPING:
|
|
10760
|
-
return node.value === null ? node.endPosition : this.getEndPosition(node.value);
|
|
10761
|
-
case types_2.Kind.MAP:
|
|
10762
|
-
return node.mappings.length === 0 ? node.endPosition : node.mappings[node.mappings.length - 1].endPosition;
|
|
10763
|
-
case types_2.Kind.SEQ: {
|
|
10764
|
-
if (node.items.length === 0) return node.endPosition;
|
|
10765
|
-
const lastItem = node.items[node.items.length - 1];
|
|
10766
|
-
return lastItem === null ? node.endPosition : lastItem.endPosition;
|
|
10767
|
-
}
|
|
10768
|
-
default:
|
|
10769
|
-
return node.endPosition;
|
|
10770
|
-
}
|
|
10771
|
-
}
|
|
10772
|
-
static mapComments(comments, lineMap) {
|
|
10773
|
-
return comments.map((comment) => ({
|
|
10774
|
-
value: comment.value,
|
|
10775
|
-
range: getRange(lineMap, comment.startPosition, comment.endPosition),
|
|
10776
|
-
startPosition: comment.startPosition,
|
|
10777
|
-
endPosition: comment.endPosition
|
|
10778
|
-
}));
|
|
10779
|
-
}
|
|
10780
|
-
enter(node, key) {
|
|
10781
|
-
return new Comments2(this.attachedComments, this.comments, node, this.lineMap, key === void 0 ? this.pointer : `${this.pointer}/${key}`);
|
|
10782
|
-
}
|
|
10783
|
-
static isLeading(node, startPosition) {
|
|
10784
|
-
switch (node.kind) {
|
|
10785
|
-
case types_2.Kind.MAP:
|
|
10786
|
-
return node.mappings.length === 0 || node.mappings[0].startPosition > startPosition;
|
|
10787
|
-
case types_2.Kind.SEQ: {
|
|
10788
|
-
if (node.items.length === 0) return true;
|
|
10789
|
-
const firstItem = node.items[0];
|
|
10790
|
-
return firstItem === null || firstItem.startPosition > startPosition;
|
|
10791
|
-
}
|
|
10792
|
-
case types_2.Kind.MAPPING:
|
|
10793
|
-
return node.value === null || node.value.startPosition > startPosition;
|
|
10794
|
-
default:
|
|
10795
|
-
return false;
|
|
10796
|
-
}
|
|
10797
|
-
}
|
|
10798
|
-
static isTrailing(node, endPosition) {
|
|
10799
|
-
switch (node.kind) {
|
|
10800
|
-
case types_2.Kind.MAP:
|
|
10801
|
-
return node.mappings.length > 0 && endPosition > node.mappings[node.mappings.length - 1].endPosition;
|
|
10802
|
-
case types_2.Kind.SEQ:
|
|
10803
|
-
if (node.items.length === 0) return false;
|
|
10804
|
-
const lastItem = node.items[node.items.length - 1];
|
|
10805
|
-
return lastItem !== null && endPosition > lastItem.endPosition;
|
|
10806
|
-
case types_2.Kind.MAPPING:
|
|
10807
|
-
return node.value !== null && endPosition > node.value.endPosition;
|
|
10808
|
-
default:
|
|
10809
|
-
return false;
|
|
10810
|
-
}
|
|
10811
|
-
}
|
|
10812
|
-
static findBetween(node, startPosition, endPosition) {
|
|
10813
|
-
switch (node.kind) {
|
|
10814
|
-
case types_2.Kind.MAP: {
|
|
10815
|
-
let left;
|
|
10816
|
-
for (const mapping of node.mappings) if (startPosition > mapping.startPosition) left = mapping.key.value;
|
|
10817
|
-
else if (left !== void 0 && mapping.startPosition > endPosition) return [left, mapping.key.value];
|
|
10818
|
-
return null;
|
|
10819
|
-
}
|
|
10820
|
-
case types_2.Kind.SEQ: {
|
|
10821
|
-
let left;
|
|
10822
|
-
for (let i = 0; i < node.items.length; i++) {
|
|
10823
|
-
const item = node.items[i];
|
|
10824
|
-
if (item === null) continue;
|
|
10825
|
-
if (startPosition > item.startPosition) left = String(i);
|
|
10826
|
-
else if (left !== void 0 && item.startPosition > endPosition) return [left, String(i)];
|
|
10827
|
-
}
|
|
10828
|
-
return null;
|
|
10829
|
-
}
|
|
10830
|
-
default:
|
|
10831
|
-
return null;
|
|
10832
|
-
}
|
|
10833
|
-
}
|
|
10834
|
-
isBeforeEOL(comment) {
|
|
10835
|
-
return this.node.kind === types_2.Kind.SCALAR || this.node.kind === types_2.Kind.MAPPING && comment.range.end.line === lineForPosition_1.lineForPosition(this.node.key.endPosition, this.lineMap);
|
|
10836
|
-
}
|
|
10837
|
-
attachComments() {
|
|
10838
|
-
if (this.comments.length === 0) return;
|
|
10839
|
-
const attachedComments = this.attachedComments[this.pointer] = this.attachedComments[this.pointer] || [];
|
|
10840
|
-
for (const comment of this.comments) if (this.isBeforeEOL(comment)) attachedComments.push({
|
|
10841
|
-
value: comment.value,
|
|
10842
|
-
placement: "before-eol"
|
|
10843
|
-
});
|
|
10844
|
-
else if (Comments2.isLeading(this.node, comment.startPosition)) attachedComments.push({
|
|
10845
|
-
value: comment.value,
|
|
10846
|
-
placement: "leading"
|
|
10847
|
-
});
|
|
10848
|
-
else if (Comments2.isTrailing(this.node, comment.endPosition)) attachedComments.push({
|
|
10849
|
-
value: comment.value,
|
|
10850
|
-
placement: "trailing"
|
|
10851
|
-
});
|
|
10852
|
-
else {
|
|
10853
|
-
const between = Comments2.findBetween(this.node, comment.startPosition, comment.endPosition);
|
|
10854
|
-
if (between !== null) attachedComments.push({
|
|
10855
|
-
value: comment.value,
|
|
10856
|
-
placement: "between",
|
|
10857
|
-
between
|
|
10858
|
-
});
|
|
10859
|
-
else attachedComments.push({
|
|
10860
|
-
value: comment.value,
|
|
10861
|
-
placement: "trailing"
|
|
10862
|
-
});
|
|
10863
|
-
}
|
|
10864
|
-
}
|
|
10865
|
-
};
|
|
10866
|
-
function normalizeOptions(options) {
|
|
10867
|
-
if (options === void 0) return {
|
|
10868
|
-
attachComments: false,
|
|
10869
|
-
preserveKeyOrder: false,
|
|
10870
|
-
bigInt: false,
|
|
10871
|
-
mergeKeys: false,
|
|
10872
|
-
json: true,
|
|
10873
|
-
ignoreDuplicateKeys: false
|
|
10874
|
-
};
|
|
10875
|
-
return Object.assign({}, options, {
|
|
10876
|
-
attachComments: options.attachComments === true,
|
|
10877
|
-
preserveKeyOrder: options.preserveKeyOrder === true,
|
|
10878
|
-
bigInt: options.bigInt === true,
|
|
10879
|
-
mergeKeys: options.mergeKeys === true,
|
|
10880
|
-
json: options.json !== false,
|
|
10881
|
-
ignoreDuplicateKeys: options.ignoreDuplicateKeys !== false
|
|
10882
|
-
});
|
|
10883
|
-
}
|
|
10884
|
-
}));
|
|
10885
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10886
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10887
|
-
const parseWithPointers_1 = require_parseWithPointers();
|
|
10888
|
-
exports$1.parse = (value) => parseWithPointers_1.parseWithPointers(value).data;
|
|
10889
|
-
}));
|
|
10890
|
-
var require_safeStringify = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10891
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10892
|
-
const yaml_ast_parser_1 = require_src$1();
|
|
10893
|
-
exports$1.safeStringify = (value, options) => typeof value === "string" ? value : yaml_ast_parser_1.safeDump(value, options);
|
|
10894
|
-
}));
|
|
10895
|
-
var require_trapAccess = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10896
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10897
|
-
const ordered_object_literal_1 = require_src();
|
|
10898
|
-
exports$1.KEYS = Symbol.for(ordered_object_literal_1.ORDER_KEY_ID);
|
|
10899
|
-
const traps = { ownKeys(target) {
|
|
10900
|
-
return exports$1.KEYS in target ? target[exports$1.KEYS] : Reflect.ownKeys(target);
|
|
10901
|
-
} };
|
|
10902
|
-
exports$1.trapAccess = (target) => new Proxy(target, traps);
|
|
10903
|
-
}));
|
|
10904
|
-
var import_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
10905
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
10906
|
-
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
10907
|
-
tslib_1.__exportStar(require_buildJsonPath(), exports$1);
|
|
10908
|
-
tslib_1.__exportStar(require_dereferenceAnchor(), exports$1);
|
|
10909
|
-
tslib_1.__exportStar(require_getJsonPathForPosition(), exports$1);
|
|
10910
|
-
tslib_1.__exportStar(require_getLocationForJsonPath(), exports$1);
|
|
10911
|
-
tslib_1.__exportStar(require_lineForPosition(), exports$1);
|
|
10912
|
-
exports$1.parse = require_parse().parse;
|
|
10913
|
-
exports$1.parseWithPointers = require_parseWithPointers().parseWithPointers;
|
|
10914
|
-
tslib_1.__exportStar(require_safeStringify(), exports$1);
|
|
10915
|
-
tslib_1.__exportStar(require_types(), exports$1);
|
|
10916
|
-
tslib_1.__exportStar(require_trapAccess(), exports$1);
|
|
10917
|
-
})))());
|
|
10918
|
-
const STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
|
|
10919
|
-
"properties",
|
|
10920
|
-
"items",
|
|
10921
|
-
"additionalProperties",
|
|
10922
|
-
"oneOf",
|
|
10923
|
-
"anyOf",
|
|
10924
|
-
"allOf",
|
|
10925
|
-
"not"
|
|
10926
|
-
]);
|
|
10927
6949
|
function isOpenApiV2Document(doc) {
|
|
10928
|
-
return doc && isPlainObject$1(doc) && !("openapi" in doc);
|
|
6950
|
+
return !!doc && isPlainObject$1(doc) && !("openapi" in doc);
|
|
10929
6951
|
}
|
|
10930
6952
|
function isOpenApiV3_1Document(doc) {
|
|
10931
|
-
return doc && isPlainObject$1(doc) && "openapi" in doc && doc.openapi.startsWith("3.1");
|
|
6953
|
+
return !!doc && isPlainObject$1(doc) && "openapi" in doc && doc.openapi.startsWith("3.1");
|
|
10932
6954
|
}
|
|
10933
6955
|
function isNullable(schema) {
|
|
10934
6956
|
var _a2;
|
|
@@ -10942,7 +6964,8 @@ function isReference(obj) {
|
|
|
10942
6964
|
return !!obj && isRef(obj);
|
|
10943
6965
|
}
|
|
10944
6966
|
function isDiscriminator(obj) {
|
|
10945
|
-
|
|
6967
|
+
const record = obj;
|
|
6968
|
+
return !!obj && !!record["discriminator"] && typeof record["discriminator"] !== "string";
|
|
10946
6969
|
}
|
|
10947
6970
|
function isRequired(schema) {
|
|
10948
6971
|
var _a2;
|
|
@@ -11019,7 +7042,7 @@ function parseFromConfig(config, oasClass = Oas) {
|
|
|
11019
7042
|
if ("data" in config.input) {
|
|
11020
7043
|
if (typeof config.input.data === "object") return parse$3(structuredClone(config.input.data), { oasClass });
|
|
11021
7044
|
try {
|
|
11022
|
-
return parse$3(
|
|
7045
|
+
return parse$3(yaml.parse(config.input.data), { oasClass });
|
|
11023
7046
|
} catch (_e) {
|
|
11024
7047
|
return parse$3(config.input.data, { oasClass });
|
|
11025
7048
|
}
|
|
@@ -11652,66 +7675,120 @@ function getSchemaFactory(oas) {
|
|
|
11652
7675
|
};
|
|
11653
7676
|
};
|
|
11654
7677
|
}
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
7678
|
+
function isBuildOperationsV1Options(options) {
|
|
7679
|
+
var _a2;
|
|
7680
|
+
return ((_a2 = options.version) != null ? _a2 : "1") === "1";
|
|
7681
|
+
}
|
|
7682
|
+
async function buildOperations(operationsOrNodes, options) {
|
|
7683
|
+
const { config, fabric, plugin } = options;
|
|
7684
|
+
if (!options.Component) return;
|
|
11658
7685
|
const fabricChild = createReactFabric();
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
7686
|
+
if (isBuildOperationsV1Options(options)) {
|
|
7687
|
+
const { generator, Component } = options;
|
|
7688
|
+
const { pluginManager, oas, mode } = generator.context;
|
|
7689
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7690
|
+
meta: {
|
|
7691
|
+
pluginManager,
|
|
7692
|
+
plugin,
|
|
7693
|
+
mode,
|
|
7694
|
+
oas
|
|
7695
|
+
},
|
|
7696
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7697
|
+
config,
|
|
7698
|
+
operations: operationsOrNodes,
|
|
7699
|
+
generator,
|
|
7700
|
+
plugin
|
|
7701
|
+
})
|
|
7702
|
+
}));
|
|
7703
|
+
} else {
|
|
7704
|
+
const { Component } = options;
|
|
7705
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7706
|
+
meta: { plugin },
|
|
7707
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7708
|
+
config,
|
|
7709
|
+
nodes: operationsOrNodes,
|
|
7710
|
+
plugin
|
|
7711
|
+
})
|
|
7712
|
+
}));
|
|
7713
|
+
}
|
|
11673
7714
|
await fabric.context.fileManager.upsert(...fabricChild.files);
|
|
11674
7715
|
fabricChild.unmount();
|
|
11675
7716
|
}
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
7717
|
+
function isBuildOperationV1Options(options) {
|
|
7718
|
+
var _a2;
|
|
7719
|
+
return ((_a2 = options.version) != null ? _a2 : "1") === "1";
|
|
7720
|
+
}
|
|
7721
|
+
async function buildOperation(operationOrNode, options) {
|
|
7722
|
+
const { config, fabric, plugin } = options;
|
|
7723
|
+
if (!options.Component) return;
|
|
11679
7724
|
const fabricChild = createReactFabric();
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
7725
|
+
if (isBuildOperationV1Options(options)) {
|
|
7726
|
+
const { generator, Component } = options;
|
|
7727
|
+
const { pluginManager, oas, mode } = generator.context;
|
|
7728
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7729
|
+
meta: {
|
|
7730
|
+
pluginManager,
|
|
7731
|
+
plugin,
|
|
7732
|
+
mode,
|
|
7733
|
+
oas
|
|
7734
|
+
},
|
|
7735
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7736
|
+
config,
|
|
7737
|
+
operation: operationOrNode,
|
|
7738
|
+
plugin,
|
|
7739
|
+
generator
|
|
7740
|
+
})
|
|
7741
|
+
}));
|
|
7742
|
+
} else {
|
|
7743
|
+
const { Component } = options;
|
|
7744
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7745
|
+
meta: { plugin },
|
|
7746
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7747
|
+
config,
|
|
7748
|
+
node: operationOrNode,
|
|
7749
|
+
plugin
|
|
7750
|
+
})
|
|
7751
|
+
}));
|
|
7752
|
+
}
|
|
11694
7753
|
await fabric.context.fileManager.upsert(...fabricChild.files);
|
|
11695
7754
|
fabricChild.unmount();
|
|
11696
7755
|
}
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
7756
|
+
function isBuildSchemaV1Options(options) {
|
|
7757
|
+
var _a2;
|
|
7758
|
+
return ((_a2 = options.version) != null ? _a2 : "1") === "1";
|
|
7759
|
+
}
|
|
7760
|
+
async function buildSchema(schema, options) {
|
|
7761
|
+
const { config, fabric, plugin } = options;
|
|
7762
|
+
if (!options.Component) return;
|
|
11700
7763
|
const fabricChild = createReactFabric();
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
7764
|
+
if (isBuildSchemaV1Options(options)) {
|
|
7765
|
+
const { generator, Component } = options;
|
|
7766
|
+
const { pluginManager, oas, mode } = generator.context;
|
|
7767
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7768
|
+
meta: {
|
|
7769
|
+
pluginManager,
|
|
7770
|
+
plugin,
|
|
7771
|
+
mode,
|
|
7772
|
+
oas
|
|
7773
|
+
},
|
|
7774
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7775
|
+
config,
|
|
7776
|
+
schema,
|
|
7777
|
+
plugin,
|
|
7778
|
+
generator
|
|
7779
|
+
})
|
|
7780
|
+
}));
|
|
7781
|
+
} else {
|
|
7782
|
+
const { Component } = options;
|
|
7783
|
+
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7784
|
+
meta: { plugin },
|
|
7785
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
7786
|
+
config,
|
|
7787
|
+
node: schema,
|
|
7788
|
+
plugin
|
|
7789
|
+
})
|
|
7790
|
+
}));
|
|
7791
|
+
}
|
|
11715
7792
|
await fabric.context.fileManager.upsert(...fabricChild.files);
|
|
11716
7793
|
fabricChild.unmount();
|
|
11717
7794
|
}
|
|
@@ -12638,6 +8715,8 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
12638
8715
|
const generatorLimit = pLimit(GENERATOR_CONCURRENCY);
|
|
12639
8716
|
const schemaLimit = pLimit(SCHEMA_CONCURRENCY);
|
|
12640
8717
|
const writeTasks = generators.map((generator) => generatorLimit(async () => {
|
|
8718
|
+
if (generator.version === "2") return [];
|
|
8719
|
+
const v1Generator = generator;
|
|
12641
8720
|
const schemaTasks = schemaEntries.map(([name, schemaObject]) => schemaLimit(async () => {
|
|
12642
8721
|
var _a2, _b2;
|
|
12643
8722
|
const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
|
|
@@ -12647,7 +8726,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
12647
8726
|
parentName: null,
|
|
12648
8727
|
rootName: name
|
|
12649
8728
|
});
|
|
12650
|
-
if (
|
|
8729
|
+
if (v1Generator.type === "react") {
|
|
12651
8730
|
await buildSchema({
|
|
12652
8731
|
name,
|
|
12653
8732
|
value: schemaObject,
|
|
@@ -12655,7 +8734,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
12655
8734
|
}, {
|
|
12656
8735
|
config: this.context.pluginManager.config,
|
|
12657
8736
|
fabric: this.context.fabric,
|
|
12658
|
-
Component:
|
|
8737
|
+
Component: v1Generator.Schema,
|
|
12659
8738
|
generator: this,
|
|
12660
8739
|
plugin: {
|
|
12661
8740
|
...this.context.plugin,
|
|
@@ -12667,7 +8746,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
12667
8746
|
});
|
|
12668
8747
|
return [];
|
|
12669
8748
|
}
|
|
12670
|
-
return (_b2 = await ((_a2 =
|
|
8749
|
+
return (_b2 = await ((_a2 = v1Generator.schema) == null ? void 0 : _a2.call(v1Generator, {
|
|
12671
8750
|
config: this.context.pluginManager.config,
|
|
12672
8751
|
generator: this,
|
|
12673
8752
|
schema: {
|
|
@@ -13519,8 +9598,10 @@ ${operations.map(({ operation, name: methodName, typeSchemas, zodSchemas }) => g
|
|
|
13519
9598
|
StaticClassClient.getParams = Client.getParams;
|
|
13520
9599
|
|
|
13521
9600
|
function createGenerator(generator) {
|
|
9601
|
+
var _a;
|
|
13522
9602
|
return {
|
|
13523
9603
|
type: "core",
|
|
9604
|
+
version: (_a = generator.version) != null ? _a : "1",
|
|
13524
9605
|
async operations() {
|
|
13525
9606
|
return [];
|
|
13526
9607
|
},
|
|
@@ -13534,8 +9615,10 @@ function createGenerator(generator) {
|
|
|
13534
9615
|
};
|
|
13535
9616
|
}
|
|
13536
9617
|
function createReactGenerator(generator) {
|
|
9618
|
+
var _a;
|
|
13537
9619
|
return {
|
|
13538
9620
|
type: "react",
|
|
9621
|
+
version: (_a = generator.version) != null ? _a : "1",
|
|
13539
9622
|
Operations() {
|
|
13540
9623
|
return null;
|
|
13541
9624
|
},
|
|
@@ -13740,14 +9823,16 @@ var OperationGenerator = (_a$7 = class {
|
|
|
13740
9823
|
});
|
|
13741
9824
|
const writeTasks = generators.map((generator) => generatorLimit(async () => {
|
|
13742
9825
|
var _a3;
|
|
9826
|
+
if (generator.version === "2") return [];
|
|
9827
|
+
const v1Generator = generator;
|
|
13743
9828
|
const operationTasks = operations.map(({ operation, method }) => operationLimit(async () => {
|
|
13744
9829
|
var _a4, _b;
|
|
13745
9830
|
const options = this.getOptions(operation, method);
|
|
13746
|
-
if (
|
|
9831
|
+
if (v1Generator.type === "react") {
|
|
13747
9832
|
await buildOperation(operation, {
|
|
13748
9833
|
config: this.context.pluginManager.config,
|
|
13749
9834
|
fabric: this.context.fabric,
|
|
13750
|
-
Component:
|
|
9835
|
+
Component: v1Generator.Operation,
|
|
13751
9836
|
generator: this,
|
|
13752
9837
|
plugin: {
|
|
13753
9838
|
...this.context.plugin,
|
|
@@ -13759,7 +9844,7 @@ var OperationGenerator = (_a$7 = class {
|
|
|
13759
9844
|
});
|
|
13760
9845
|
return [];
|
|
13761
9846
|
}
|
|
13762
|
-
return (_b = await ((_a4 =
|
|
9847
|
+
return (_b = await ((_a4 = v1Generator.operation) == null ? void 0 : _a4.call(v1Generator, {
|
|
13763
9848
|
generator: this,
|
|
13764
9849
|
config: this.context.pluginManager.config,
|
|
13765
9850
|
operation,
|
|
@@ -13773,17 +9858,17 @@ var OperationGenerator = (_a$7 = class {
|
|
|
13773
9858
|
}))) != null ? _b : [];
|
|
13774
9859
|
}));
|
|
13775
9860
|
const opResultsFlat = (await Promise.all(operationTasks)).flat();
|
|
13776
|
-
if (
|
|
9861
|
+
if (v1Generator.type === "react") {
|
|
13777
9862
|
await buildOperations(operations.map((op) => op.operation), {
|
|
13778
9863
|
fabric: this.context.fabric,
|
|
13779
9864
|
config: this.context.pluginManager.config,
|
|
13780
|
-
Component:
|
|
9865
|
+
Component: v1Generator.Operations,
|
|
13781
9866
|
generator: this,
|
|
13782
9867
|
plugin: this.context.plugin
|
|
13783
9868
|
});
|
|
13784
9869
|
return [];
|
|
13785
9870
|
}
|
|
13786
|
-
const operationsResult = await ((_a3 =
|
|
9871
|
+
const operationsResult = await ((_a3 = v1Generator.operations) == null ? void 0 : _a3.call(v1Generator, {
|
|
13787
9872
|
generator: this,
|
|
13788
9873
|
config: this.context.pluginManager.config,
|
|
13789
9874
|
operations: operations.map((op) => op.operation),
|
|
@@ -213564,6 +209649,7 @@ function printResponseSchema({ baseName, schemas, pluginManager, unknownType })
|
|
|
213564
209649
|
}
|
|
213565
209650
|
const typeGenerator = createReactGenerator({
|
|
213566
209651
|
name: "typescript",
|
|
209652
|
+
version: "1",
|
|
213567
209653
|
Operation({ operation, generator, plugin }) {
|
|
213568
209654
|
const { options, options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
|
|
213569
209655
|
const mode = useMode();
|
|
@@ -213786,8 +209872,24 @@ const pluginTs = definePlugin((options) => {
|
|
|
213786
209872
|
},
|
|
213787
209873
|
async install() {
|
|
213788
209874
|
var _a;
|
|
213789
|
-
const
|
|
209875
|
+
const { config, fabric, plugin } = this;
|
|
209876
|
+
const root = path$2.resolve(config.root, config.output.path);
|
|
213790
209877
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
209878
|
+
if (this.rootNode) {
|
|
209879
|
+
await this.openInStudio({ ast: true });
|
|
209880
|
+
await walk(this.rootNode, { async schema(schemaNode) {
|
|
209881
|
+
await generators.map(async (generator) => {
|
|
209882
|
+
if (generator.type === "react" && generator.version === "2") await buildSchema(schemaNode, {
|
|
209883
|
+
config,
|
|
209884
|
+
fabric,
|
|
209885
|
+
Component: generator.Schema,
|
|
209886
|
+
plugin,
|
|
209887
|
+
version: generator.version
|
|
209888
|
+
});
|
|
209889
|
+
});
|
|
209890
|
+
} }, { depth: "shallow" });
|
|
209891
|
+
return;
|
|
209892
|
+
}
|
|
213791
209893
|
const oas = await this.getOas();
|
|
213792
209894
|
const schemaFiles = await new SchemaGenerator(this.plugin.options, {
|
|
213793
209895
|
fabric: this.fabric,
|
|
@@ -214236,6 +210338,21 @@ const pluginZod = definePlugin((options) => {
|
|
|
214236
210338
|
};
|
|
214237
210339
|
});
|
|
214238
210340
|
|
|
210341
|
+
function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }) {
|
|
210342
|
+
const classCode = `export class ${name} {
|
|
210343
|
+
${classNames.map((className) => ` readonly ${camelCase$b(className)}: ${className}`).join("\n")}
|
|
210344
|
+
|
|
210345
|
+
constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
210346
|
+
${classNames.map((className) => ` this.${camelCase$b(className)} = new ${className}(config)`).join("\n")}
|
|
210347
|
+
}
|
|
210348
|
+
}`;
|
|
210349
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
210350
|
+
name,
|
|
210351
|
+
isExportable,
|
|
210352
|
+
isIndexable,
|
|
210353
|
+
children: classCode
|
|
210354
|
+
});
|
|
210355
|
+
}
|
|
214239
210356
|
const classClientGenerator = createReactGenerator({
|
|
214240
210357
|
name: "classClient",
|
|
214241
210358
|
Operations({ operations, generator, plugin, config }) {
|
|
@@ -214345,7 +210462,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
214345
210462
|
zodFilesByPath
|
|
214346
210463
|
};
|
|
214347
210464
|
}
|
|
214348
|
-
|
|
210465
|
+
const files = controllers.map(({ name, file, operations: ops }) => {
|
|
214349
210466
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops);
|
|
214350
210467
|
const { zodImportsByFile, zodFilesByPath } = options.parser === "zod" ? collectZodImports(ops) : {
|
|
214351
210468
|
zodImportsByFile: /* @__PURE__ */ new Map(),
|
|
@@ -214447,6 +210564,49 @@ const classClientGenerator = createReactGenerator({
|
|
|
214447
210564
|
]
|
|
214448
210565
|
}, file.path);
|
|
214449
210566
|
});
|
|
210567
|
+
if (options.wrapper) {
|
|
210568
|
+
const wrapperFile = pluginManager.getFile({
|
|
210569
|
+
name: options.wrapper.className,
|
|
210570
|
+
extname: ".ts",
|
|
210571
|
+
pluginKey
|
|
210572
|
+
});
|
|
210573
|
+
files.push(/* @__PURE__ */ jsxs(File, {
|
|
210574
|
+
baseName: wrapperFile.baseName,
|
|
210575
|
+
path: wrapperFile.path,
|
|
210576
|
+
meta: wrapperFile.meta,
|
|
210577
|
+
banner: getBanner({
|
|
210578
|
+
oas,
|
|
210579
|
+
output: options.output,
|
|
210580
|
+
config: pluginManager.config
|
|
210581
|
+
}),
|
|
210582
|
+
footer: getFooter({
|
|
210583
|
+
oas,
|
|
210584
|
+
output: options.output
|
|
210585
|
+
}),
|
|
210586
|
+
children: [
|
|
210587
|
+
options.importPath ? /* @__PURE__ */ jsx(File.Import, {
|
|
210588
|
+
name: ["Client", "RequestConfig"],
|
|
210589
|
+
path: options.importPath,
|
|
210590
|
+
isTypeOnly: true
|
|
210591
|
+
}) : /* @__PURE__ */ jsx(File.Import, {
|
|
210592
|
+
name: ["Client", "RequestConfig"],
|
|
210593
|
+
root: wrapperFile.path,
|
|
210594
|
+
path: path$2.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
210595
|
+
isTypeOnly: true
|
|
210596
|
+
}),
|
|
210597
|
+
controllers.map(({ name, file }) => /* @__PURE__ */ jsx(File.Import, {
|
|
210598
|
+
name: [name],
|
|
210599
|
+
root: wrapperFile.path,
|
|
210600
|
+
path: file.path
|
|
210601
|
+
}, name)),
|
|
210602
|
+
/* @__PURE__ */ jsx(WrapperClient, {
|
|
210603
|
+
name: options.wrapper.className,
|
|
210604
|
+
classNames: controllers.map(({ name }) => name)
|
|
210605
|
+
})
|
|
210606
|
+
]
|
|
210607
|
+
}, wrapperFile.path));
|
|
210608
|
+
}
|
|
210609
|
+
return files;
|
|
214450
210610
|
}
|
|
214451
210611
|
});
|
|
214452
210612
|
const clientGenerator = createReactGenerator({
|
|
@@ -214896,7 +211056,7 @@ const pluginClient = definePlugin((options) => {
|
|
|
214896
211056
|
const { output = {
|
|
214897
211057
|
path: "clients",
|
|
214898
211058
|
barrelType: "named"
|
|
214899
|
-
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false } = options;
|
|
211059
|
+
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false, wrapper } = options;
|
|
214900
211060
|
const resolvedImportPath = importPath != null ? importPath : !bundle ? `@kubb/plugin-client/clients/${client}` : void 0;
|
|
214901
211061
|
const defaultGenerators = [
|
|
214902
211062
|
clientType === "staticClass" ? staticClassClientGenerator : clientType === "class" ? classClientGenerator : clientGenerator,
|
|
@@ -214919,7 +211079,8 @@ const pluginClient = definePlugin((options) => {
|
|
|
214919
211079
|
paramsCasing,
|
|
214920
211080
|
pathParamsType,
|
|
214921
211081
|
baseURL,
|
|
214922
|
-
urlType
|
|
211082
|
+
urlType,
|
|
211083
|
+
wrapper
|
|
214923
211084
|
},
|
|
214924
211085
|
pre: [pluginOasName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
|
|
214925
211086
|
resolvePath(baseName, pathMode, options2) {
|