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,24 +0,0 @@
1
- import { SCALAR } from "./identity.js";
2
- import { toJS } from "./toJS.js";
3
- import { NodeBase } from "./Node.js";
4
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Scalar.js
5
- const isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
6
- var Scalar = class extends NodeBase {
7
- constructor(value) {
8
- super(SCALAR);
9
- this.value = value;
10
- }
11
- toJSON(arg, ctx) {
12
- return ctx?.keep ? this.value : toJS(this.value, arg, ctx);
13
- }
14
- toString() {
15
- return String(this.value);
16
- }
17
- };
18
- Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
19
- Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
20
- Scalar.PLAIN = "PLAIN";
21
- Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
22
- Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";
23
- //#endregion
24
- export { Scalar, isScalarValue };
@@ -1,106 +0,0 @@
1
- import { MAP, isPair, isScalar } from "./identity.js";
2
- import { isScalarValue } from "./Scalar.js";
3
- import { Collection } from "./Collection.js";
4
- import { addPairToJSMap } from "./addPairToJSMap.js";
5
- import { Pair, createPair } from "./Pair.js";
6
- import { stringifyCollection } from "../stringify/stringifyCollection.js";
7
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLMap.js
8
- function findPair(items, key) {
9
- const k = isScalar(key) ? key.value : key;
10
- for (const it of items) if (isPair(it)) {
11
- if (it.key === key || it.key === k) return it;
12
- if (isScalar(it.key) && it.key.value === k) return it;
13
- }
14
- }
15
- var YAMLMap = class extends Collection {
16
- static get tagName() {
17
- return "tag:yaml.org,2002:map";
18
- }
19
- constructor(schema) {
20
- super(MAP, schema);
21
- this.items = [];
22
- }
23
- /**
24
- * A generic collection parsing method that can be extended
25
- * to other node classes that inherit from YAMLMap
26
- */
27
- static from(schema, obj, ctx) {
28
- const { keepUndefined, replacer } = ctx;
29
- const map = new this(schema);
30
- const add = (key, value) => {
31
- if (typeof replacer === "function") value = replacer.call(obj, key, value);
32
- else if (Array.isArray(replacer) && !replacer.includes(key)) return;
33
- if (value !== void 0 || keepUndefined) map.items.push(createPair(key, value, ctx));
34
- };
35
- if (obj instanceof Map) for (const [key, value] of obj) add(key, value);
36
- else if (obj && typeof obj === "object") for (const key of Object.keys(obj)) add(key, obj[key]);
37
- if (typeof schema.sortMapEntries === "function") map.items.sort(schema.sortMapEntries);
38
- return map;
39
- }
40
- /**
41
- * Adds a value to the collection.
42
- *
43
- * @param overwrite - If not set `true`, using a key that is already in the
44
- * collection will throw. Otherwise, overwrites the previous value.
45
- */
46
- add(pair, overwrite) {
47
- let _pair;
48
- if (isPair(pair)) _pair = pair;
49
- else if (!pair || typeof pair !== "object" || !("key" in pair)) _pair = new Pair(pair, pair?.value);
50
- else _pair = new Pair(pair.key, pair.value);
51
- const prev = findPair(this.items, _pair.key);
52
- const sortEntries = this.schema?.sortMapEntries;
53
- if (prev) {
54
- if (!overwrite) throw new Error(`Key ${_pair.key} already set`);
55
- if (isScalar(prev.value) && isScalarValue(_pair.value)) prev.value.value = _pair.value;
56
- else prev.value = _pair.value;
57
- } else if (sortEntries) {
58
- const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
59
- if (i === -1) this.items.push(_pair);
60
- else this.items.splice(i, 0, _pair);
61
- } else this.items.push(_pair);
62
- }
63
- delete(key) {
64
- const it = findPair(this.items, key);
65
- if (!it) return false;
66
- return this.items.splice(this.items.indexOf(it), 1).length > 0;
67
- }
68
- get(key, keepScalar) {
69
- const node = findPair(this.items, key)?.value;
70
- return (!keepScalar && isScalar(node) ? node.value : node) ?? void 0;
71
- }
72
- has(key) {
73
- return !!findPair(this.items, key);
74
- }
75
- set(key, value) {
76
- this.add(new Pair(key, value), true);
77
- }
78
- /**
79
- * @param ctx - Conversion context, originally set in Document#toJS()
80
- * @param {Class} Type - If set, forces the returned collection type
81
- * @returns Instance of Type, Map, or Object
82
- */
83
- toJSON(_, ctx, Type) {
84
- const map = Type ? new Type() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
85
- if (ctx?.onCreate) ctx.onCreate(map);
86
- for (const item of this.items) addPairToJSMap(ctx, map, item);
87
- return map;
88
- }
89
- toString(ctx, onComment, onChompKeep) {
90
- if (!ctx) return JSON.stringify(this);
91
- for (const item of this.items) if (!isPair(item)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
92
- if (!ctx.allNullValues && this.hasAllNullValues(false)) ctx = Object.assign({}, ctx, { allNullValues: true });
93
- return stringifyCollection(this, ctx, {
94
- blockItemPrefix: "",
95
- flowChars: {
96
- start: "{",
97
- end: "}"
98
- },
99
- itemIndent: ctx.indent || "",
100
- onChompKeep,
101
- onComment
102
- });
103
- }
104
- };
105
- //#endregion
106
- export { YAMLMap, findPair };
@@ -1,104 +0,0 @@
1
- import { SEQ, isScalar } from "./identity.js";
2
- import { toJS } from "./toJS.js";
3
- import { isScalarValue } from "./Scalar.js";
4
- import { createNode } from "../doc/createNode.js";
5
- import { Collection } from "./Collection.js";
6
- import { stringifyCollection } from "../stringify/stringifyCollection.js";
7
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLSeq.js
8
- var YAMLSeq = class extends Collection {
9
- static get tagName() {
10
- return "tag:yaml.org,2002:seq";
11
- }
12
- constructor(schema) {
13
- super(SEQ, schema);
14
- this.items = [];
15
- }
16
- add(value) {
17
- this.items.push(value);
18
- }
19
- /**
20
- * Removes a value from the collection.
21
- *
22
- * `key` must contain a representation of an integer for this to succeed.
23
- * It may be wrapped in a `Scalar`.
24
- *
25
- * @returns `true` if the item was found and removed.
26
- */
27
- delete(key) {
28
- const idx = asItemIndex(key);
29
- if (typeof idx !== "number") return false;
30
- return this.items.splice(idx, 1).length > 0;
31
- }
32
- get(key, keepScalar) {
33
- const idx = asItemIndex(key);
34
- if (typeof idx !== "number") return void 0;
35
- const it = this.items[idx];
36
- return !keepScalar && isScalar(it) ? it.value : it;
37
- }
38
- /**
39
- * Checks if the collection includes a value with the key `key`.
40
- *
41
- * `key` must contain a representation of an integer for this to succeed.
42
- * It may be wrapped in a `Scalar`.
43
- */
44
- has(key) {
45
- const idx = asItemIndex(key);
46
- return typeof idx === "number" && idx < this.items.length;
47
- }
48
- /**
49
- * Sets a value in this collection. For `!!set`, `value` needs to be a
50
- * boolean to add/remove the item from the set.
51
- *
52
- * If `key` does not contain a representation of an integer, this will throw.
53
- * It may be wrapped in a `Scalar`.
54
- */
55
- set(key, value) {
56
- const idx = asItemIndex(key);
57
- if (typeof idx !== "number") throw new Error(`Expected a valid index, not ${key}.`);
58
- const prev = this.items[idx];
59
- if (isScalar(prev) && isScalarValue(value)) prev.value = value;
60
- else this.items[idx] = value;
61
- }
62
- toJSON(_, ctx) {
63
- const seq = [];
64
- if (ctx?.onCreate) ctx.onCreate(seq);
65
- let i = 0;
66
- for (const item of this.items) seq.push(toJS(item, String(i++), ctx));
67
- return seq;
68
- }
69
- toString(ctx, onComment, onChompKeep) {
70
- if (!ctx) return JSON.stringify(this);
71
- return stringifyCollection(this, ctx, {
72
- blockItemPrefix: "- ",
73
- flowChars: {
74
- start: "[",
75
- end: "]"
76
- },
77
- itemIndent: (ctx.indent || "") + " ",
78
- onChompKeep,
79
- onComment
80
- });
81
- }
82
- static from(schema, obj, ctx) {
83
- const { replacer } = ctx;
84
- const seq = new this(schema);
85
- if (obj && Symbol.iterator in Object(obj)) {
86
- let i = 0;
87
- for (let it of obj) {
88
- if (typeof replacer === "function") {
89
- const key = obj instanceof Set ? it : String(i++);
90
- it = replacer.call(obj, key, it);
91
- }
92
- seq.items.push(createNode(it, void 0, ctx));
93
- }
94
- }
95
- return seq;
96
- }
97
- };
98
- function asItemIndex(key) {
99
- let idx = isScalar(key) ? key.value : key;
100
- if (idx && typeof idx === "string") idx = Number(idx);
101
- return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
102
- }
103
- //#endregion
104
- export { YAMLSeq };
@@ -1,49 +0,0 @@
1
- import { isNode } from "./identity.js";
2
- import { toJS } from "./toJS.js";
3
- import { createStringifyContext } from "../stringify/stringify.js";
4
- import { warn } from "../log.js";
5
- import { addMergeToJSMap, isMergeKey } from "../schema/yaml-1.1/merge.js";
6
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
7
- function addPairToJSMap(ctx, map, { key, value }) {
8
- if (isNode(key) && key.addToJSMap) key.addToJSMap(ctx, map, value);
9
- else if (isMergeKey(ctx, key)) addMergeToJSMap(ctx, map, value);
10
- else {
11
- const jsKey = toJS(key, "", ctx);
12
- if (map instanceof Map) map.set(jsKey, toJS(value, jsKey, ctx));
13
- else if (map instanceof Set) map.add(jsKey);
14
- else {
15
- const stringKey = stringifyKey(key, jsKey, ctx);
16
- const jsValue = toJS(value, stringKey, ctx);
17
- if (stringKey in map) Object.defineProperty(map, stringKey, {
18
- value: jsValue,
19
- writable: true,
20
- enumerable: true,
21
- configurable: true
22
- });
23
- else map[stringKey] = jsValue;
24
- }
25
- }
26
- return map;
27
- }
28
- function stringifyKey(key, jsKey, ctx) {
29
- if (jsKey === null) return "";
30
- if (typeof jsKey !== "object") return String(jsKey);
31
- if (isNode(key) && ctx?.doc) {
32
- const strCtx = createStringifyContext(ctx.doc, {});
33
- strCtx.anchors = /* @__PURE__ */ new Set();
34
- for (const node of ctx.anchors.keys()) strCtx.anchors.add(node.anchor);
35
- strCtx.inFlow = true;
36
- strCtx.inStringifyKey = true;
37
- const strKey = key.toString(strCtx);
38
- if (!ctx.mapKeyWarned) {
39
- let jsonStr = JSON.stringify(strKey);
40
- if (jsonStr.length > 40) jsonStr = jsonStr.substring(0, 36) + "...\"";
41
- warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
42
- ctx.mapKeyWarned = true;
43
- }
44
- return strKey;
45
- }
46
- return JSON.stringify(jsKey);
47
- }
48
- //#endregion
49
- export { addPairToJSMap };
@@ -1,33 +0,0 @@
1
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
2
- const ALIAS = Symbol.for("yaml.alias");
3
- const DOC = Symbol.for("yaml.document");
4
- const MAP = Symbol.for("yaml.map");
5
- const PAIR = Symbol.for("yaml.pair");
6
- const SCALAR = Symbol.for("yaml.scalar");
7
- const SEQ = Symbol.for("yaml.seq");
8
- const NODE_TYPE = Symbol.for("yaml.node.type");
9
- const isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
10
- const isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
11
- const isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
12
- const isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
13
- const isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
14
- const isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
15
- function isCollection(node) {
16
- if (node && typeof node === "object") switch (node[NODE_TYPE]) {
17
- case MAP:
18
- case SEQ: return true;
19
- }
20
- return false;
21
- }
22
- function isNode(node) {
23
- if (node && typeof node === "object") switch (node[NODE_TYPE]) {
24
- case ALIAS:
25
- case MAP:
26
- case SCALAR:
27
- case SEQ: return true;
28
- }
29
- return false;
30
- }
31
- const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
32
- //#endregion
33
- export { ALIAS, DOC, MAP, NODE_TYPE, PAIR, SCALAR, SEQ, hasAnchor, isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq };
@@ -1,35 +0,0 @@
1
- import { hasAnchor } from "./identity.js";
2
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/toJS.js
3
- /**
4
- * Recursively convert any node or its contents to native JavaScript
5
- *
6
- * @param value - The input value
7
- * @param arg - If `value` defines a `toJSON()` method, use this
8
- * as its first argument
9
- * @param ctx - Conversion context, originally set in Document#toJS(). If
10
- * `{ keep: true }` is not set, output should be suitable for JSON
11
- * stringification.
12
- */
13
- function toJS(value, arg, ctx) {
14
- if (Array.isArray(value)) return value.map((v, i) => toJS(v, String(i), ctx));
15
- if (value && typeof value.toJSON === "function") {
16
- if (!ctx || !hasAnchor(value)) return value.toJSON(arg, ctx);
17
- const data = {
18
- aliasCount: 0,
19
- count: 1,
20
- res: void 0
21
- };
22
- ctx.anchors.set(value, data);
23
- ctx.onCreate = (res) => {
24
- data.res = res;
25
- delete ctx.onCreate;
26
- };
27
- const res = value.toJSON(arg, ctx);
28
- if (ctx.onCreate) ctx.onCreate(res);
29
- return res;
30
- }
31
- if (typeof value === "bigint" && !ctx?.keep) return Number(value);
32
- return value;
33
- }
34
- //#endregion
35
- export { toJS };
@@ -1,3 +0,0 @@
1
- import "../stringify/stringifyString.js";
2
- import "../compose/resolve-block-scalar.js";
3
- import "../compose/resolve-flow-scalar.js";
@@ -1,89 +0,0 @@
1
- //#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-visit.js
2
- const BREAK = Symbol("break visit");
3
- const SKIP = Symbol("skip children");
4
- const REMOVE = Symbol("remove item");
5
- /**
6
- * Apply a visitor to a CST document or item.
7
- *
8
- * Walks through the tree (depth-first) starting from the root, calling a
9
- * `visitor` function with two arguments when entering each item:
10
- * - `item`: The current item, which included the following members:
11
- * - `start: SourceToken[]` – Source tokens before the key or value,
12
- * possibly including its anchor or tag.
13
- * - `key?: Token | null` – Set for pair values. May then be `null`, if
14
- * the key before the `:` separator is empty.
15
- * - `sep?: SourceToken[]` – Source tokens between the key and the value,
16
- * which should include the `:` map value indicator if `value` is set.
17
- * - `value?: Token` – The value of a sequence item, or of a map pair.
18
- * - `path`: The steps from the root to the current node, as an array of
19
- * `['key' | 'value', number]` tuples.
20
- *
21
- * The return value of the visitor may be used to control the traversal:
22
- * - `undefined` (default): Do nothing and continue
23
- * - `visit.SKIP`: Do not visit the children of this token, continue with
24
- * next sibling
25
- * - `visit.BREAK`: Terminate traversal completely
26
- * - `visit.REMOVE`: Remove the current item, then continue with the next one
27
- * - `number`: Set the index of the next step. This is useful especially if
28
- * the index of the current token has changed.
29
- * - `function`: Define the next visitor for this item. After the original
30
- * visitor is called on item entry, next visitors are called after handling
31
- * a non-empty `key` and when exiting the item.
32
- */
33
- function visit(cst, visitor) {
34
- if ("type" in cst && cst.type === "document") cst = {
35
- start: cst.start,
36
- value: cst.value
37
- };
38
- _visit(Object.freeze([]), cst, visitor);
39
- }
40
- /** Terminate visit traversal completely */
41
- visit.BREAK = BREAK;
42
- /** Do not visit the children of the current item */
43
- visit.SKIP = SKIP;
44
- /** Remove the current item */
45
- visit.REMOVE = REMOVE;
46
- /** Find the item at `path` from `cst` as the root */
47
- visit.itemAtPath = (cst, path) => {
48
- let item = cst;
49
- for (const [field, index] of path) {
50
- const tok = item?.[field];
51
- if (tok && "items" in tok) item = tok.items[index];
52
- else return void 0;
53
- }
54
- return item;
55
- };
56
- /**
57
- * Get the immediate parent collection of the item at `path` from `cst` as the root.
58
- *
59
- * Throws an error if the collection is not found, which should never happen if the item itself exists.
60
- */
61
- visit.parentCollection = (cst, path) => {
62
- const parent = visit.itemAtPath(cst, path.slice(0, -1));
63
- const field = path[path.length - 1][0];
64
- const coll = parent?.[field];
65
- if (coll && "items" in coll) return coll;
66
- throw new Error("Parent collection not found");
67
- };
68
- function _visit(path, item, visitor) {
69
- let ctrl = visitor(item, path);
70
- if (typeof ctrl === "symbol") return ctrl;
71
- for (const field of ["key", "value"]) {
72
- const token = item[field];
73
- if (token && "items" in token) {
74
- for (let i = 0; i < token.items.length; ++i) {
75
- const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
76
- if (typeof ci === "number") i = ci - 1;
77
- else if (ci === BREAK) return BREAK;
78
- else if (ci === REMOVE) {
79
- token.items.splice(i, 1);
80
- i -= 1;
81
- }
82
- }
83
- if (typeof ctrl === "function" && field === "key") ctrl = ctrl(item, path);
84
- }
85
- }
86
- return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
87
- }
88
- //#endregion
89
- export { visit };
@@ -1,40 +0,0 @@
1
- import "./cst-scalar.js";
2
- import "./cst-visit.js";
3
- /** Identify the type of a lexer token. May return `null` for unknown tokens. */
4
- function tokenType(source) {
5
- switch (source) {
6
- case "": return "byte-order-mark";
7
- case "": return "doc-mode";
8
- case "": return "flow-error-end";
9
- case "": return "scalar";
10
- case "---": return "doc-start";
11
- case "...": return "doc-end";
12
- case "":
13
- case "\n":
14
- case "\r\n": return "newline";
15
- case "-": return "seq-item-ind";
16
- case "?": return "explicit-key-ind";
17
- case ":": return "map-value-ind";
18
- case "{": return "flow-map-start";
19
- case "}": return "flow-map-end";
20
- case "[": return "flow-seq-start";
21
- case "]": return "flow-seq-end";
22
- case ",": return "comma";
23
- }
24
- switch (source[0]) {
25
- case " ":
26
- case " ": return "space";
27
- case "#": return "comment";
28
- case "%": return "directive-line";
29
- case "*": return "alias";
30
- case "&": return "anchor";
31
- case "!": return "tag";
32
- case "'": return "single-quoted-scalar";
33
- case "\"": return "double-quoted-scalar";
34
- case "|":
35
- case ">": return "block-scalar-header";
36
- }
37
- return null;
38
- }
39
- //#endregion
40
- export { tokenType };