fumadocs-openapi 10.6.7 → 10.7.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.
Files changed (118) hide show
  1. package/css/generated/shared.css +2 -5
  2. package/dist/_virtual/_rolldown/runtime.js +2 -1
  3. package/dist/i18n.js +3 -2
  4. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
  5. package/dist/node_modules/.pnpm/@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/general/create-limiter.js +43 -0
  6. package/dist/node_modules/.pnpm/@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/object/is-object.js +26 -0
  7. package/dist/node_modules/.pnpm/@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +33 -0
  8. package/dist/node_modules/.pnpm/@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/queue/queue.js +106 -0
  9. package/dist/node_modules/.pnpm/@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/string/generate-hash.js +120 -0
  10. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/bundle.js +346 -0
  11. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js +73 -0
  12. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +3 -0
  13. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +1 -0
  14. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js +51 -0
  15. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +88 -0
  16. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js +24 -0
  17. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +11 -0
  18. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +44 -0
  19. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js +10 -0
  20. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js +42 -0
  21. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +23 -0
  22. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +23 -0
  23. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +28 -0
  24. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +21 -0
  25. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/normalize.js +26 -0
  26. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +30 -0
  27. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js +70 -0
  28. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +33 -0
  29. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +12 -0
  30. package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +487 -0
  31. package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +95 -0
  32. package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +59 -0
  33. package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +25 -0
  34. package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +15 -0
  35. package/dist/node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js +115 -0
  36. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +19 -0
  37. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +430 -0
  38. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/compose-collection.js +50 -0
  39. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/compose-doc.js +39 -0
  40. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/compose-node.js +85 -0
  41. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/compose-scalar.js +57 -0
  42. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/composer.js +193 -0
  43. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-block-map.js +82 -0
  44. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +173 -0
  45. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +40 -0
  46. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-end.js +36 -0
  47. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +153 -0
  48. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +204 -0
  49. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/resolve-props.js +105 -0
  50. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/util-contains-newline.js +27 -0
  51. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +25 -0
  52. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +10 -0
  53. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/compose/util-map-includes.js +10 -0
  54. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/Document.js +277 -0
  55. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/anchors.js +57 -0
  56. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/applyReviver.js +38 -0
  57. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/createNode.js +61 -0
  58. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/directives.js +163 -0
  59. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/errors.js +48 -0
  60. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/index.js +16 -0
  61. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/log.js +6 -0
  62. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/Alias.js +91 -0
  63. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/Collection.js +117 -0
  64. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/Node.js +32 -0
  65. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/Pair.js +29 -0
  66. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  67. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/YAMLMap.js +106 -0
  68. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +104 -0
  69. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +49 -0
  70. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/identity.js +33 -0
  71. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/nodes/toJS.js +35 -0
  72. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/cst-scalar.js +3 -0
  73. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/cst-visit.js +89 -0
  74. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/cst.js +40 -0
  75. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/lexer.js +517 -0
  76. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/line-counter.js +45 -0
  77. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/parse/parser.js +852 -0
  78. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/public-api.js +44 -0
  79. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/Schema.js +27 -0
  80. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/map.js +16 -0
  81. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/null.js +13 -0
  82. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/seq.js +16 -0
  83. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  84. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/bool.js +17 -0
  85. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/float.js +38 -0
  86. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/int.js +37 -0
  87. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  88. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/json/schema.js +61 -0
  89. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/tags.js +81 -0
  90. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +44 -0
  91. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +24 -0
  92. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +41 -0
  93. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +70 -0
  94. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +36 -0
  95. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +60 -0
  96. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +56 -0
  97. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  98. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +65 -0
  99. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +79 -0
  100. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +111 -0
  101. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringify.js +105 -0
  102. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +116 -0
  103. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyComment.js +16 -0
  104. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +59 -0
  105. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +19 -0
  106. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyPair.js +95 -0
  107. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/stringify/stringifyString.js +222 -0
  108. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/visit.js +187 -0
  109. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/index.js +16 -0
  110. package/dist/playground/components/oauth-dialog.js +17 -11
  111. package/dist/playground/components/result-display.js +3 -2
  112. package/dist/playground/schema.js +1 -1
  113. package/dist/scalar/client.js +15 -24
  114. package/dist/ui/operation/get-example-requests.js +1 -1
  115. package/dist/ui/operation/response-tabs.js +1 -1
  116. package/dist/utils/document/process.js +5 -3
  117. package/dist/utils/schema/sample.js +442 -0
  118. package/package.json +26 -25
@@ -0,0 +1,44 @@
1
+ import { warn } from "./log.js";
2
+ import "./doc/Document.js";
3
+ import { YAMLParseError, prettifyError } from "./errors.js";
4
+ import { Composer } from "./compose/composer.js";
5
+ import { LineCounter } from "./parse/line-counter.js";
6
+ import { Parser } from "./parse/parser.js";
7
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/public-api.js
8
+ function parseOptions(options) {
9
+ const prettyErrors = options.prettyErrors !== false;
10
+ return {
11
+ lineCounter: options.lineCounter || prettyErrors && new LineCounter() || null,
12
+ prettyErrors
13
+ };
14
+ }
15
+ /** Parse an input string into a single YAML.Document */
16
+ function parseDocument(source, options = {}) {
17
+ const { lineCounter, prettyErrors } = parseOptions(options);
18
+ const parser = new Parser(lineCounter?.addNewLine);
19
+ const composer = new Composer(options);
20
+ let doc = null;
21
+ for (const _doc of composer.compose(parser.parse(source), true, source.length)) if (!doc) doc = _doc;
22
+ else if (doc.options.logLevel !== "silent") {
23
+ doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
24
+ break;
25
+ }
26
+ if (prettyErrors && lineCounter) {
27
+ doc.errors.forEach(prettifyError(source, lineCounter));
28
+ doc.warnings.forEach(prettifyError(source, lineCounter));
29
+ }
30
+ return doc;
31
+ }
32
+ function parse(src, reviver, options) {
33
+ let _reviver = void 0;
34
+ if (typeof reviver === "function") _reviver = reviver;
35
+ else if (options === void 0 && reviver && typeof reviver === "object") options = reviver;
36
+ const doc = parseDocument(src, options);
37
+ if (!doc) return null;
38
+ doc.warnings.forEach((warning) => warn(doc.options.logLevel, warning));
39
+ if (doc.errors.length > 0) if (doc.options.logLevel !== "silent") throw doc.errors[0];
40
+ else doc.errors = [];
41
+ return doc.toJS(Object.assign({ reviver: _reviver }, options));
42
+ }
43
+ //#endregion
44
+ export { parse, parseDocument };
@@ -0,0 +1,27 @@
1
+ import { MAP, SCALAR, SEQ } from "../nodes/identity.js";
2
+ import { map } from "./common/map.js";
3
+ import { seq } from "./common/seq.js";
4
+ import { string } from "./common/string.js";
5
+ import { coreKnownTags, getTags } from "./tags.js";
6
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/Schema.js
7
+ const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
8
+ var Schema = class Schema {
9
+ constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
10
+ this.compat = Array.isArray(compat) ? getTags(compat, "compat") : compat ? getTags(null, compat) : null;
11
+ this.name = typeof schema === "string" && schema || "core";
12
+ this.knownTags = resolveKnownTags ? coreKnownTags : {};
13
+ this.tags = getTags(customTags, this.name, merge);
14
+ this.toStringOptions = toStringDefaults ?? null;
15
+ Object.defineProperty(this, MAP, { value: map });
16
+ Object.defineProperty(this, SCALAR, { value: string });
17
+ Object.defineProperty(this, SEQ, { value: seq });
18
+ this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
19
+ }
20
+ clone() {
21
+ const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
22
+ copy.tags = this.tags.slice();
23
+ return copy;
24
+ }
25
+ };
26
+ //#endregion
27
+ export { Schema };
@@ -0,0 +1,16 @@
1
+ import { isMap } from "../../nodes/identity.js";
2
+ import { YAMLMap } from "../../nodes/YAMLMap.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/map.js
4
+ const map = {
5
+ collection: "map",
6
+ default: true,
7
+ nodeClass: YAMLMap,
8
+ tag: "tag:yaml.org,2002:map",
9
+ resolve(map, onError) {
10
+ if (!isMap(map)) onError("Expected a mapping for this tag");
11
+ return map;
12
+ },
13
+ createNode: (schema, obj, ctx) => YAMLMap.from(schema, obj, ctx)
14
+ };
15
+ //#endregion
16
+ export { map };
@@ -0,0 +1,13 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/null.js
3
+ const nullTag = {
4
+ identify: (value) => value == null,
5
+ createNode: () => new Scalar(null),
6
+ default: true,
7
+ tag: "tag:yaml.org,2002:null",
8
+ test: /^(?:~|[Nn]ull|NULL)?$/,
9
+ resolve: () => new Scalar(null),
10
+ stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
11
+ };
12
+ //#endregion
13
+ export { nullTag };
@@ -0,0 +1,16 @@
1
+ import { isSeq } from "../../nodes/identity.js";
2
+ import { YAMLSeq } from "../../nodes/YAMLSeq.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/seq.js
4
+ const seq = {
5
+ collection: "seq",
6
+ default: true,
7
+ nodeClass: YAMLSeq,
8
+ tag: "tag:yaml.org,2002:seq",
9
+ resolve(seq, onError) {
10
+ if (!isSeq(seq)) onError("Expected a sequence for this tag");
11
+ return seq;
12
+ },
13
+ createNode: (schema, obj, ctx) => YAMLSeq.from(schema, obj, ctx)
14
+ };
15
+ //#endregion
16
+ export { seq };
@@ -0,0 +1,14 @@
1
+ import { stringifyString } from "../../stringify/stringifyString.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/common/string.js
3
+ const string = {
4
+ identify: (value) => typeof value === "string",
5
+ default: true,
6
+ tag: "tag:yaml.org,2002:str",
7
+ resolve: (str) => str,
8
+ stringify(item, ctx, onComment, onChompKeep) {
9
+ ctx = Object.assign({ actualString: true }, ctx);
10
+ return stringifyString(item, ctx, onComment, onChompKeep);
11
+ }
12
+ };
13
+ //#endregion
14
+ export { string };
@@ -0,0 +1,17 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/bool.js
3
+ const boolTag = {
4
+ identify: (value) => typeof value === "boolean",
5
+ default: true,
6
+ tag: "tag:yaml.org,2002:bool",
7
+ test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
8
+ resolve: (str) => new Scalar(str[0] === "t" || str[0] === "T"),
9
+ stringify({ source, value }, ctx) {
10
+ if (source && boolTag.test.test(source)) {
11
+ if (value === (source[0] === "t" || source[0] === "T")) return source;
12
+ }
13
+ return value ? ctx.options.trueStr : ctx.options.falseStr;
14
+ }
15
+ };
16
+ //#endregion
17
+ export { boolTag };
@@ -0,0 +1,38 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ import { stringifyNumber } from "../../stringify/stringifyNumber.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/float.js
4
+ const floatNaN = {
5
+ identify: (value) => typeof value === "number",
6
+ default: true,
7
+ tag: "tag:yaml.org,2002:float",
8
+ test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
9
+ resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
10
+ stringify: stringifyNumber
11
+ };
12
+ const floatExp = {
13
+ identify: (value) => typeof value === "number",
14
+ default: true,
15
+ tag: "tag:yaml.org,2002:float",
16
+ format: "EXP",
17
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
18
+ resolve: (str) => parseFloat(str),
19
+ stringify(node) {
20
+ const num = Number(node.value);
21
+ return isFinite(num) ? num.toExponential() : stringifyNumber(node);
22
+ }
23
+ };
24
+ const float = {
25
+ identify: (value) => typeof value === "number",
26
+ default: true,
27
+ tag: "tag:yaml.org,2002:float",
28
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
29
+ resolve(str) {
30
+ const node = new Scalar(parseFloat(str));
31
+ const dot = str.indexOf(".");
32
+ if (dot !== -1 && str[str.length - 1] === "0") node.minFractionDigits = str.length - dot - 1;
33
+ return node;
34
+ },
35
+ stringify: stringifyNumber
36
+ };
37
+ //#endregion
38
+ export { float, floatExp, floatNaN };
@@ -0,0 +1,37 @@
1
+ import { stringifyNumber } from "../../stringify/stringifyNumber.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/int.js
3
+ const intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
4
+ const intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
5
+ function intStringify(node, radix, prefix) {
6
+ const { value } = node;
7
+ if (intIdentify(value) && value >= 0) return prefix + value.toString(radix);
8
+ return stringifyNumber(node);
9
+ }
10
+ const intOct = {
11
+ identify: (value) => intIdentify(value) && value >= 0,
12
+ default: true,
13
+ tag: "tag:yaml.org,2002:int",
14
+ format: "OCT",
15
+ test: /^0o[0-7]+$/,
16
+ resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
17
+ stringify: (node) => intStringify(node, 8, "0o")
18
+ };
19
+ const int = {
20
+ identify: intIdentify,
21
+ default: true,
22
+ tag: "tag:yaml.org,2002:int",
23
+ test: /^[-+]?[0-9]+$/,
24
+ resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
25
+ stringify: stringifyNumber
26
+ };
27
+ const intHex = {
28
+ identify: (value) => intIdentify(value) && value >= 0,
29
+ default: true,
30
+ tag: "tag:yaml.org,2002:int",
31
+ format: "HEX",
32
+ test: /^0x[0-9a-fA-F]+$/,
33
+ resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
34
+ stringify: (node) => intStringify(node, 16, "0x")
35
+ };
36
+ //#endregion
37
+ export { int, intHex, intOct };
@@ -0,0 +1,23 @@
1
+ import { map } from "../common/map.js";
2
+ import { seq } from "../common/seq.js";
3
+ import { string } from "../common/string.js";
4
+ import { nullTag } from "../common/null.js";
5
+ import { boolTag } from "./bool.js";
6
+ import { float, floatExp, floatNaN } from "./float.js";
7
+ import { int, intHex, intOct } from "./int.js";
8
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/core/schema.js
9
+ const schema = [
10
+ map,
11
+ seq,
12
+ string,
13
+ nullTag,
14
+ boolTag,
15
+ intOct,
16
+ int,
17
+ intHex,
18
+ floatNaN,
19
+ floatExp,
20
+ float
21
+ ];
22
+ //#endregion
23
+ export { schema };
@@ -0,0 +1,61 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ import { map } from "../common/map.js";
3
+ import { seq } from "../common/seq.js";
4
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/json/schema.js
5
+ function intIdentify(value) {
6
+ return typeof value === "bigint" || Number.isInteger(value);
7
+ }
8
+ const stringifyJSON = ({ value }) => JSON.stringify(value);
9
+ const jsonScalars = [
10
+ {
11
+ identify: (value) => typeof value === "string",
12
+ default: true,
13
+ tag: "tag:yaml.org,2002:str",
14
+ resolve: (str) => str,
15
+ stringify: stringifyJSON
16
+ },
17
+ {
18
+ identify: (value) => value == null,
19
+ createNode: () => new Scalar(null),
20
+ default: true,
21
+ tag: "tag:yaml.org,2002:null",
22
+ test: /^null$/,
23
+ resolve: () => null,
24
+ stringify: stringifyJSON
25
+ },
26
+ {
27
+ identify: (value) => typeof value === "boolean",
28
+ default: true,
29
+ tag: "tag:yaml.org,2002:bool",
30
+ test: /^true$|^false$/,
31
+ resolve: (str) => str === "true",
32
+ stringify: stringifyJSON
33
+ },
34
+ {
35
+ identify: intIdentify,
36
+ default: true,
37
+ tag: "tag:yaml.org,2002:int",
38
+ test: /^-?(?:0|[1-9][0-9]*)$/,
39
+ resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
40
+ stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
41
+ },
42
+ {
43
+ identify: (value) => typeof value === "number",
44
+ default: true,
45
+ tag: "tag:yaml.org,2002:float",
46
+ test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
47
+ resolve: (str) => parseFloat(str),
48
+ stringify: stringifyJSON
49
+ }
50
+ ];
51
+ const schema = [map, seq].concat(jsonScalars, {
52
+ default: true,
53
+ tag: "",
54
+ test: /^/,
55
+ resolve(str, onError) {
56
+ onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
57
+ return str;
58
+ }
59
+ });
60
+ //#endregion
61
+ export { schema };
@@ -0,0 +1,81 @@
1
+ import { merge } from "./yaml-1.1/merge.js";
2
+ import { map } from "./common/map.js";
3
+ import { seq } from "./common/seq.js";
4
+ import { string } from "./common/string.js";
5
+ import { nullTag } from "./common/null.js";
6
+ import { boolTag } from "./core/bool.js";
7
+ import { float, floatExp, floatNaN } from "./core/float.js";
8
+ import { int, intHex, intOct } from "./core/int.js";
9
+ import { schema } from "./core/schema.js";
10
+ import { schema as schema$1 } from "./json/schema.js";
11
+ import { binary } from "./yaml-1.1/binary.js";
12
+ import { pairs } from "./yaml-1.1/pairs.js";
13
+ import { omap } from "./yaml-1.1/omap.js";
14
+ import { set } from "./yaml-1.1/set.js";
15
+ import { floatTime, intTime, timestamp } from "./yaml-1.1/timestamp.js";
16
+ import { schema as schema$2 } from "./yaml-1.1/schema.js";
17
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/tags.js
18
+ const schemas = new Map([
19
+ ["core", schema],
20
+ ["failsafe", [
21
+ map,
22
+ seq,
23
+ string
24
+ ]],
25
+ ["json", schema$1],
26
+ ["yaml11", schema$2],
27
+ ["yaml-1.1", schema$2]
28
+ ]);
29
+ const tagsByName = {
30
+ binary,
31
+ bool: boolTag,
32
+ float,
33
+ floatExp,
34
+ floatNaN,
35
+ floatTime,
36
+ int,
37
+ intHex,
38
+ intOct,
39
+ intTime,
40
+ map,
41
+ merge,
42
+ null: nullTag,
43
+ omap,
44
+ pairs,
45
+ seq,
46
+ set,
47
+ timestamp
48
+ };
49
+ const coreKnownTags = {
50
+ "tag:yaml.org,2002:binary": binary,
51
+ "tag:yaml.org,2002:merge": merge,
52
+ "tag:yaml.org,2002:omap": omap,
53
+ "tag:yaml.org,2002:pairs": pairs,
54
+ "tag:yaml.org,2002:set": set,
55
+ "tag:yaml.org,2002:timestamp": timestamp
56
+ };
57
+ function getTags(customTags, schemaName, addMergeTag) {
58
+ const schemaTags = schemas.get(schemaName);
59
+ if (schemaTags && !customTags) return addMergeTag && !schemaTags.includes(merge) ? schemaTags.concat(merge) : schemaTags.slice();
60
+ let tags = schemaTags;
61
+ if (!tags) if (Array.isArray(customTags)) tags = [];
62
+ else {
63
+ const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
64
+ throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
65
+ }
66
+ if (Array.isArray(customTags)) for (const tag of customTags) tags = tags.concat(tag);
67
+ else if (typeof customTags === "function") tags = customTags(tags.slice());
68
+ if (addMergeTag) tags = tags.concat(merge);
69
+ return tags.reduce((tags, tag) => {
70
+ const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
71
+ if (!tagObj) {
72
+ const tagName = JSON.stringify(tag);
73
+ const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
74
+ throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
75
+ }
76
+ if (!tags.includes(tagObj)) tags.push(tagObj);
77
+ return tags;
78
+ }, []);
79
+ }
80
+ //#endregion
81
+ export { coreKnownTags, getTags };
@@ -0,0 +1,44 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ import { stringifyString } from "../../stringify/stringifyString.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
4
+ const binary = {
5
+ identify: (value) => value instanceof Uint8Array,
6
+ default: false,
7
+ tag: "tag:yaml.org,2002:binary",
8
+ resolve(src, onError) {
9
+ if (typeof atob === "function") {
10
+ const str = atob(src.replace(/[\n\r]/g, ""));
11
+ const buffer = new Uint8Array(str.length);
12
+ for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
13
+ return buffer;
14
+ } else {
15
+ onError("This environment does not support reading binary tags; either Buffer or atob is required");
16
+ return src;
17
+ }
18
+ },
19
+ stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
20
+ if (!value) return "";
21
+ const buf = value;
22
+ let str;
23
+ if (typeof btoa === "function") {
24
+ let s = "";
25
+ for (let i = 0; i < buf.length; ++i) s += String.fromCharCode(buf[i]);
26
+ str = btoa(s);
27
+ } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
28
+ type ?? (type = Scalar.BLOCK_LITERAL);
29
+ if (type !== Scalar.QUOTE_DOUBLE) {
30
+ const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
31
+ const n = Math.ceil(str.length / lineWidth);
32
+ const lines = new Array(n);
33
+ for (let i = 0, o = 0; i < n; ++i, o += lineWidth) lines[i] = str.substr(o, lineWidth);
34
+ str = lines.join(type === Scalar.BLOCK_LITERAL ? "\n" : " ");
35
+ }
36
+ return stringifyString({
37
+ comment,
38
+ type,
39
+ value: str
40
+ }, ctx, onComment, onChompKeep);
41
+ }
42
+ };
43
+ //#endregion
44
+ export { binary };
@@ -0,0 +1,24 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
3
+ function boolStringify({ value, source }, ctx) {
4
+ if (source && (value ? trueTag : falseTag).test.test(source)) return source;
5
+ return value ? ctx.options.trueStr : ctx.options.falseStr;
6
+ }
7
+ const trueTag = {
8
+ identify: (value) => value === true,
9
+ default: true,
10
+ tag: "tag:yaml.org,2002:bool",
11
+ test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
12
+ resolve: () => new Scalar(true),
13
+ stringify: boolStringify
14
+ };
15
+ const falseTag = {
16
+ identify: (value) => value === false,
17
+ default: true,
18
+ tag: "tag:yaml.org,2002:bool",
19
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
20
+ resolve: () => new Scalar(false),
21
+ stringify: boolStringify
22
+ };
23
+ //#endregion
24
+ export { falseTag, trueTag };
@@ -0,0 +1,41 @@
1
+ import { Scalar } from "../../nodes/Scalar.js";
2
+ import { stringifyNumber } from "../../stringify/stringifyNumber.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
4
+ const floatNaN = {
5
+ identify: (value) => typeof value === "number",
6
+ default: true,
7
+ tag: "tag:yaml.org,2002:float",
8
+ test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
9
+ resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
10
+ stringify: stringifyNumber
11
+ };
12
+ const floatExp = {
13
+ identify: (value) => typeof value === "number",
14
+ default: true,
15
+ tag: "tag:yaml.org,2002:float",
16
+ format: "EXP",
17
+ test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
18
+ resolve: (str) => parseFloat(str.replace(/_/g, "")),
19
+ stringify(node) {
20
+ const num = Number(node.value);
21
+ return isFinite(num) ? num.toExponential() : stringifyNumber(node);
22
+ }
23
+ };
24
+ const float = {
25
+ identify: (value) => typeof value === "number",
26
+ default: true,
27
+ tag: "tag:yaml.org,2002:float",
28
+ test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
29
+ resolve(str) {
30
+ const node = new Scalar(parseFloat(str.replace(/_/g, "")));
31
+ const dot = str.indexOf(".");
32
+ if (dot !== -1) {
33
+ const f = str.substring(dot + 1).replace(/_/g, "");
34
+ if (f[f.length - 1] === "0") node.minFractionDigits = f.length;
35
+ }
36
+ return node;
37
+ },
38
+ stringify: stringifyNumber
39
+ };
40
+ //#endregion
41
+ export { float, floatExp, floatNaN };
@@ -0,0 +1,70 @@
1
+ import { stringifyNumber } from "../../stringify/stringifyNumber.js";
2
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
3
+ const intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
4
+ function intResolve(str, offset, radix, { intAsBigInt }) {
5
+ const sign = str[0];
6
+ if (sign === "-" || sign === "+") offset += 1;
7
+ str = str.substring(offset).replace(/_/g, "");
8
+ if (intAsBigInt) {
9
+ switch (radix) {
10
+ case 2:
11
+ str = `0b${str}`;
12
+ break;
13
+ case 8:
14
+ str = `0o${str}`;
15
+ break;
16
+ case 16:
17
+ str = `0x${str}`;
18
+ break;
19
+ }
20
+ const n = BigInt(str);
21
+ return sign === "-" ? BigInt(-1) * n : n;
22
+ }
23
+ const n = parseInt(str, radix);
24
+ return sign === "-" ? -1 * n : n;
25
+ }
26
+ function intStringify(node, radix, prefix) {
27
+ const { value } = node;
28
+ if (intIdentify(value)) {
29
+ const str = value.toString(radix);
30
+ return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
31
+ }
32
+ return stringifyNumber(node);
33
+ }
34
+ const intBin = {
35
+ identify: intIdentify,
36
+ default: true,
37
+ tag: "tag:yaml.org,2002:int",
38
+ format: "BIN",
39
+ test: /^[-+]?0b[0-1_]+$/,
40
+ resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
41
+ stringify: (node) => intStringify(node, 2, "0b")
42
+ };
43
+ const intOct = {
44
+ identify: intIdentify,
45
+ default: true,
46
+ tag: "tag:yaml.org,2002:int",
47
+ format: "OCT",
48
+ test: /^[-+]?0[0-7_]+$/,
49
+ resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
50
+ stringify: (node) => intStringify(node, 8, "0")
51
+ };
52
+ const int = {
53
+ identify: intIdentify,
54
+ default: true,
55
+ tag: "tag:yaml.org,2002:int",
56
+ test: /^[-+]?[0-9][0-9_]*$/,
57
+ resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
58
+ stringify: stringifyNumber
59
+ };
60
+ const intHex = {
61
+ identify: intIdentify,
62
+ default: true,
63
+ tag: "tag:yaml.org,2002:int",
64
+ format: "HEX",
65
+ test: /^[-+]?0x[0-9a-fA-F_]+$/,
66
+ resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
67
+ stringify: (node) => intStringify(node, 16, "0x")
68
+ };
69
+ //#endregion
70
+ export { int, intBin, intHex, intOct };
@@ -0,0 +1,36 @@
1
+ import { isAlias, isMap, isScalar, isSeq } from "../../nodes/identity.js";
2
+ import { Scalar } from "../../nodes/Scalar.js";
3
+ //#region ../../node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
4
+ const MERGE_KEY = "<<";
5
+ const merge = {
6
+ identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
7
+ default: "key",
8
+ tag: "tag:yaml.org,2002:merge",
9
+ test: /^<<$/,
10
+ resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), { addToJSMap: addMergeToJSMap }),
11
+ stringify: () => MERGE_KEY
12
+ };
13
+ const isMergeKey = (ctx, key) => (merge.identify(key) || isScalar(key) && (!key.type || key.type === Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
14
+ function addMergeToJSMap(ctx, map, value) {
15
+ value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
16
+ if (isSeq(value)) for (const it of value.items) mergeValue(ctx, map, it);
17
+ else if (Array.isArray(value)) for (const it of value) mergeValue(ctx, map, it);
18
+ else mergeValue(ctx, map, value);
19
+ }
20
+ function mergeValue(ctx, map, value) {
21
+ const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
22
+ if (!isMap(source)) throw new Error("Merge sources must be maps or map aliases");
23
+ const srcMap = source.toJSON(null, ctx, Map);
24
+ for (const [key, value] of srcMap) if (map instanceof Map) {
25
+ if (!map.has(key)) map.set(key, value);
26
+ } else if (map instanceof Set) map.add(key);
27
+ else if (!Object.prototype.hasOwnProperty.call(map, key)) Object.defineProperty(map, key, {
28
+ value,
29
+ writable: true,
30
+ enumerable: true,
31
+ configurable: true
32
+ });
33
+ return map;
34
+ }
35
+ //#endregion
36
+ export { addMergeToJSMap, isMergeKey, merge };