fumadocs-openapi 10.10.0 → 10.10.2

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 (144) hide show
  1. package/css/generated/shared.css +1 -4
  2. package/dist/_openapi/types.d.ts +27 -1
  3. package/dist/index.d.ts +5 -4
  4. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +239 -0
  5. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +187 -0
  6. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +136 -0
  7. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +41 -0
  8. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +124 -0
  9. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +109 -0
  10. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +30 -0
  11. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +46 -0
  12. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +36 -0
  13. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +49 -0
  14. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +242 -0
  15. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +247 -0
  16. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +210 -0
  17. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +100 -0
  18. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +41 -0
  19. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +112 -0
  20. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +8 -0
  21. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +146 -0
  22. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +5 -0
  23. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +18 -0
  24. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +11 -0
  25. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +99 -0
  26. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +30 -0
  27. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +315 -0
  28. package/dist/playground/client.d.ts +1 -1
  29. package/dist/requests/generators/all.d.ts +1 -1
  30. package/dist/requests/generators/all.js +1 -0
  31. package/dist/types.d.ts +3 -13
  32. package/dist/ui/base.d.ts +1 -1
  33. package/dist/ui/base.js +4 -3
  34. package/dist/ui/client/index.d.ts +15 -10
  35. package/dist/ui/components/heading.js +9 -1
  36. package/dist/ui/contexts/api.js +1 -7
  37. package/dist/ui/create-client.d.ts +2 -1
  38. package/dist/ui/create-client.js +8 -9
  39. package/dist/ui/operation/request-tabs.js +4 -1
  40. package/dist/ui/operation/response-tabs.js +4 -1
  41. package/dist/ui/operation/usage-tabs/index.js +2 -8
  42. package/dist/utils/document/process.js +7 -12
  43. package/dist/utils/pages/builder.d.ts +2 -4
  44. package/dist/utils/pages/preset-auto.d.ts +1 -2
  45. package/package.json +4 -8
  46. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/general/create-limiter.js +0 -43
  47. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/is-object.js +0 -27
  48. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +0 -33
  49. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/queue/queue.js +0 -106
  50. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/string/generate-hash.js +0 -120
  51. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js +0 -357
  52. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js +0 -73
  53. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -3
  54. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +0 -1
  55. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js +0 -51
  56. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +0 -102
  57. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js +0 -24
  58. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +0 -11
  59. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +0 -44
  60. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js +0 -10
  61. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js +0 -42
  62. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +0 -23
  63. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +0 -23
  64. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +0 -28
  65. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +0 -21
  66. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -33
  67. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +0 -30
  68. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js +0 -70
  69. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +0 -33
  70. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +0 -12
  71. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -19
  72. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -430
  73. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -50
  74. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -39
  75. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-node.js +0 -85
  76. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -57
  77. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/composer.js +0 -193
  78. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -82
  79. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -174
  80. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -40
  81. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -36
  82. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -153
  83. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -203
  84. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -105
  85. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -27
  86. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -25
  87. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -10
  88. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -10
  89. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/Document.js +0 -277
  90. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/anchors.js +0 -62
  91. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -38
  92. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/createNode.js +0 -61
  93. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/directives.js +0 -163
  94. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/errors.js +0 -48
  95. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/index.js +0 -16
  96. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/log.js +0 -6
  97. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Alias.js +0 -92
  98. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js +0 -117
  99. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Node.js +0 -32
  100. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Pair.js +0 -29
  101. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
  102. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -106
  103. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -104
  104. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -49
  105. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js +0 -33
  106. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/toJS.js +0 -35
  107. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -3
  108. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -89
  109. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst.js +0 -40
  110. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/lexer.js +0 -529
  111. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js +0 -45
  112. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/parser.js +0 -859
  113. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/public-api.js +0 -44
  114. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/Schema.js +0 -27
  115. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/map.js +0 -16
  116. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/null.js +0 -13
  117. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/seq.js +0 -16
  118. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
  119. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/bool.js +0 -17
  120. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/float.js +0 -38
  121. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/int.js +0 -37
  122. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
  123. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/json/schema.js +0 -61
  124. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/tags.js +0 -81
  125. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -52
  126. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -24
  127. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -41
  128. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -70
  129. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -39
  130. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -60
  131. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -56
  132. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
  133. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -65
  134. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -79
  135. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -111
  136. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringify.js +0 -105
  137. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -116
  138. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -16
  139. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -59
  140. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -19
  141. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -95
  142. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -222
  143. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/visit.js +0 -187
  144. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/index.js +0 -16
@@ -1,44 +0,0 @@
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.9.0/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 };
@@ -1,27 +0,0 @@
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.9.0/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 };
@@ -1,16 +0,0 @@
1
- import { isMap } from "../../nodes/identity.js";
2
- import { YAMLMap } from "../../nodes/YAMLMap.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,13 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,16 +0,0 @@
1
- import { isSeq } from "../../nodes/identity.js";
2
- import { YAMLSeq } from "../../nodes/YAMLSeq.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,14 +0,0 @@
1
- import { stringifyString } from "../../stringify/stringifyString.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,17 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,38 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- import { stringifyNumber } from "../../stringify/stringifyNumber.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,37 +0,0 @@
1
- import { stringifyNumber } from "../../stringify/stringifyNumber.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,23 +0,0 @@
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.9.0/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 };
@@ -1,61 +0,0 @@
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.9.0/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 };
@@ -1,81 +0,0 @@
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.9.0/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 };
@@ -1,52 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- import { stringifyString } from "../../stringify/stringifyString.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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
- /**
9
- * Returns a Buffer in node and an Uint8Array in browsers
10
- *
11
- * To use the resulting buffer as an image, you'll want to do something like:
12
- *
13
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
14
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
15
- */
16
- resolve(src, onError) {
17
- if (typeof atob === "function") {
18
- const str = atob(src.replace(/[\n\r]/g, ""));
19
- const buffer = new Uint8Array(str.length);
20
- for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
21
- return buffer;
22
- } else {
23
- onError("This environment does not support reading binary tags; either Buffer or atob is required");
24
- return src;
25
- }
26
- },
27
- stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
28
- if (!value) return "";
29
- const buf = value;
30
- let str;
31
- if (typeof btoa === "function") {
32
- let s = "";
33
- for (let i = 0; i < buf.length; ++i) s += String.fromCharCode(buf[i]);
34
- str = btoa(s);
35
- } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
36
- type ?? (type = Scalar.BLOCK_LITERAL);
37
- if (type !== Scalar.QUOTE_DOUBLE) {
38
- const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
39
- const n = Math.ceil(str.length / lineWidth);
40
- const lines = new Array(n);
41
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) lines[i] = str.substr(o, lineWidth);
42
- str = lines.join(type === Scalar.BLOCK_LITERAL ? "\n" : " ");
43
- }
44
- return stringifyString({
45
- comment,
46
- type,
47
- value: str
48
- }, ctx, onComment, onChompKeep);
49
- }
50
- };
51
- //#endregion
52
- export { binary };
@@ -1,24 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,41 +0,0 @@
1
- import { Scalar } from "../../nodes/Scalar.js";
2
- import { stringifyNumber } from "../../stringify/stringifyNumber.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,70 +0,0 @@
1
- import { stringifyNumber } from "../../stringify/stringifyNumber.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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 };
@@ -1,39 +0,0 @@
1
- import { isAlias, isMap, isScalar, isSeq } from "../../nodes/identity.js";
2
- import { Scalar } from "../../nodes/Scalar.js";
3
- //#region ../../node_modules/.pnpm/yaml@2.9.0/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
- const source = resolveAliasValue(ctx, value);
16
- if (isSeq(source)) for (const it of source.items) mergeValue(ctx, map, it);
17
- else if (Array.isArray(source)) for (const it of source) mergeValue(ctx, map, it);
18
- else mergeValue(ctx, map, source);
19
- }
20
- function mergeValue(ctx, map, value) {
21
- const source = resolveAliasValue(ctx, 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
- function resolveAliasValue(ctx, value) {
36
- return ctx && isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
37
- }
38
- //#endregion
39
- export { addMergeToJSMap, isMergeKey, merge };