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.
- package/css/generated/shared.css +1 -4
- package/dist/_openapi/types.d.ts +27 -1
- package/dist/index.d.ts +5 -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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/playground/client.d.ts +1 -1
- package/dist/requests/generators/all.d.ts +1 -1
- package/dist/requests/generators/all.js +1 -0
- package/dist/types.d.ts +3 -13
- package/dist/ui/base.d.ts +1 -1
- package/dist/ui/base.js +4 -3
- package/dist/ui/client/index.d.ts +15 -10
- package/dist/ui/components/heading.js +9 -1
- package/dist/ui/contexts/api.js +1 -7
- package/dist/ui/create-client.d.ts +2 -1
- package/dist/ui/create-client.js +8 -9
- package/dist/ui/operation/request-tabs.js +4 -1
- package/dist/ui/operation/response-tabs.js +4 -1
- package/dist/ui/operation/usage-tabs/index.js +2 -8
- package/dist/utils/document/process.js +7 -12
- package/dist/utils/pages/builder.d.ts +2 -4
- package/dist/utils/pages/preset-auto.d.ts +1 -2
- package/package.json +4 -8
- package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/general/create-limiter.js +0 -43
- package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/is-object.js +0 -27
- package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +0 -33
- package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/queue/queue.js +0 -106
- package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/string/generate-hash.js +0 -120
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js +0 -357
- 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
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -3
- 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
- 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
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +0 -102
- 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
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +0 -11
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +0 -44
- 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
- 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
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +0 -23
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +0 -23
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +0 -28
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +0 -21
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -33
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +0 -30
- 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
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +0 -33
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +0 -12
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -19
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -430
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -50
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -39
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-node.js +0 -85
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -57
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/composer.js +0 -193
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -82
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -174
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -40
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -36
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -153
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -203
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -105
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -27
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -25
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -10
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -10
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/Document.js +0 -277
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/anchors.js +0 -62
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -38
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/createNode.js +0 -61
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/directives.js +0 -163
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/errors.js +0 -48
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/index.js +0 -16
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/log.js +0 -6
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Alias.js +0 -92
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js +0 -117
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Node.js +0 -32
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Pair.js +0 -29
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -106
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -104
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -49
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js +0 -33
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/toJS.js +0 -35
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -3
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -89
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst.js +0 -40
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/lexer.js +0 -529
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js +0 -45
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/parser.js +0 -859
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/public-api.js +0 -44
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/Schema.js +0 -27
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/map.js +0 -16
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/null.js +0 -13
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/seq.js +0 -16
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/bool.js +0 -17
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/float.js +0 -38
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/int.js +0 -37
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/json/schema.js +0 -61
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/tags.js +0 -81
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -52
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -24
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -41
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -70
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -39
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -60
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -56
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -65
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -79
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -111
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringify.js +0 -105
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -116
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -16
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -59
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -19
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -95
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -222
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/visit.js +0 -187
- package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/index.js +0 -16
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { isCollection, isScalar } from "../nodes/identity.js";
|
|
2
|
-
import { visit } from "../visit.js";
|
|
3
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/anchors.js
|
|
4
|
-
/**
|
|
5
|
-
* Verify that the input string is a valid anchor.
|
|
6
|
-
*
|
|
7
|
-
* Will throw on errors.
|
|
8
|
-
*/
|
|
9
|
-
function anchorIsValid(anchor) {
|
|
10
|
-
if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
|
|
11
|
-
const msg = `Anchor must not contain whitespace or control characters: ${JSON.stringify(anchor)}`;
|
|
12
|
-
throw new Error(msg);
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
function anchorNames(root) {
|
|
17
|
-
const anchors = /* @__PURE__ */ new Set();
|
|
18
|
-
visit(root, { Value(_key, node) {
|
|
19
|
-
if (node.anchor) anchors.add(node.anchor);
|
|
20
|
-
} });
|
|
21
|
-
return anchors;
|
|
22
|
-
}
|
|
23
|
-
/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */
|
|
24
|
-
function findNewAnchor(prefix, exclude) {
|
|
25
|
-
for (let i = 1;; ++i) {
|
|
26
|
-
const name = `${prefix}${i}`;
|
|
27
|
-
if (!exclude.has(name)) return name;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function createNodeAnchors(doc, prefix) {
|
|
31
|
-
const aliasObjects = [];
|
|
32
|
-
const sourceObjects = /* @__PURE__ */ new Map();
|
|
33
|
-
let prevAnchors = null;
|
|
34
|
-
return {
|
|
35
|
-
onAnchor: (source) => {
|
|
36
|
-
aliasObjects.push(source);
|
|
37
|
-
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
38
|
-
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
39
|
-
prevAnchors.add(anchor);
|
|
40
|
-
return anchor;
|
|
41
|
-
},
|
|
42
|
-
/**
|
|
43
|
-
* With circular references, the source node is only resolved after all
|
|
44
|
-
* of its child nodes are. This is why anchors are set only after all of
|
|
45
|
-
* the nodes have been created.
|
|
46
|
-
*/
|
|
47
|
-
setAnchors: () => {
|
|
48
|
-
for (const source of aliasObjects) {
|
|
49
|
-
const ref = sourceObjects.get(source);
|
|
50
|
-
if (typeof ref === "object" && ref.anchor && (isScalar(ref.node) || isCollection(ref.node))) ref.node.anchor = ref.anchor;
|
|
51
|
-
else {
|
|
52
|
-
const error = /* @__PURE__ */ new Error("Failed to resolve repeated object (this should not happen)");
|
|
53
|
-
error.source = source;
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
sourceObjects
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { anchorIsValid, anchorNames, createNodeAnchors, findNewAnchor };
|
package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js
|
|
2
|
-
/**
|
|
3
|
-
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
4
|
-
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
5
|
-
* 2021 edition: https://tc39.es/ecma262/#sec-json.parse
|
|
6
|
-
*
|
|
7
|
-
* Includes extensions for handling Map and Set objects.
|
|
8
|
-
*/
|
|
9
|
-
function applyReviver(reviver, obj, key, val) {
|
|
10
|
-
if (val && typeof val === "object") if (Array.isArray(val)) for (let i = 0, len = val.length; i < len; ++i) {
|
|
11
|
-
const v0 = val[i];
|
|
12
|
-
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
13
|
-
if (v1 === void 0) delete val[i];
|
|
14
|
-
else if (v1 !== v0) val[i] = v1;
|
|
15
|
-
}
|
|
16
|
-
else if (val instanceof Map) for (const k of Array.from(val.keys())) {
|
|
17
|
-
const v0 = val.get(k);
|
|
18
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
19
|
-
if (v1 === void 0) val.delete(k);
|
|
20
|
-
else if (v1 !== v0) val.set(k, v1);
|
|
21
|
-
}
|
|
22
|
-
else if (val instanceof Set) for (const v0 of Array.from(val)) {
|
|
23
|
-
const v1 = applyReviver(reviver, val, v0, v0);
|
|
24
|
-
if (v1 === void 0) val.delete(v0);
|
|
25
|
-
else if (v1 !== v0) {
|
|
26
|
-
val.delete(v0);
|
|
27
|
-
val.add(v1);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else for (const [k, v0] of Object.entries(val)) {
|
|
31
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
32
|
-
if (v1 === void 0) delete val[k];
|
|
33
|
-
else if (v1 !== v0) val[k] = v1;
|
|
34
|
-
}
|
|
35
|
-
return reviver.call(obj, key, val);
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { applyReviver };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { MAP, SEQ, isDocument, isNode, isPair } from "../nodes/identity.js";
|
|
2
|
-
import { Alias } from "../nodes/Alias.js";
|
|
3
|
-
import { Scalar } from "../nodes/Scalar.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/createNode.js
|
|
5
|
-
const defaultTagPrefix = "tag:yaml.org,2002:";
|
|
6
|
-
function findTagObject(value, tagName, tags) {
|
|
7
|
-
if (tagName) {
|
|
8
|
-
const match = tags.filter((t) => t.tag === tagName);
|
|
9
|
-
const tagObj = match.find((t) => !t.format) ?? match[0];
|
|
10
|
-
if (!tagObj) throw new Error(`Tag ${tagName} not found`);
|
|
11
|
-
return tagObj;
|
|
12
|
-
}
|
|
13
|
-
return tags.find((t) => t.identify?.(value) && !t.format);
|
|
14
|
-
}
|
|
15
|
-
function createNode(value, tagName, ctx) {
|
|
16
|
-
if (isDocument(value)) value = value.contents;
|
|
17
|
-
if (isNode(value)) return value;
|
|
18
|
-
if (isPair(value)) {
|
|
19
|
-
const map = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
|
|
20
|
-
map.items.push(value);
|
|
21
|
-
return map;
|
|
22
|
-
}
|
|
23
|
-
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) value = value.valueOf();
|
|
24
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
25
|
-
let ref = void 0;
|
|
26
|
-
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
27
|
-
ref = sourceObjects.get(value);
|
|
28
|
-
if (ref) {
|
|
29
|
-
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
30
|
-
return new Alias(ref.anchor);
|
|
31
|
-
} else {
|
|
32
|
-
ref = {
|
|
33
|
-
anchor: null,
|
|
34
|
-
node: null
|
|
35
|
-
};
|
|
36
|
-
sourceObjects.set(value, ref);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (tagName?.startsWith("!!")) tagName = defaultTagPrefix + tagName.slice(2);
|
|
40
|
-
let tagObj = findTagObject(value, tagName, schema.tags);
|
|
41
|
-
if (!tagObj) {
|
|
42
|
-
if (value && typeof value.toJSON === "function") value = value.toJSON();
|
|
43
|
-
if (!value || typeof value !== "object") {
|
|
44
|
-
const node = new Scalar(value);
|
|
45
|
-
if (ref) ref.node = node;
|
|
46
|
-
return node;
|
|
47
|
-
}
|
|
48
|
-
tagObj = value instanceof Map ? schema[MAP] : Symbol.iterator in Object(value) ? schema[SEQ] : schema[MAP];
|
|
49
|
-
}
|
|
50
|
-
if (onTagObj) {
|
|
51
|
-
onTagObj(tagObj);
|
|
52
|
-
delete ctx.onTagObj;
|
|
53
|
-
}
|
|
54
|
-
const node = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar(value);
|
|
55
|
-
if (tagName) node.tag = tagName;
|
|
56
|
-
else if (!tagObj.default) node.tag = tagObj.tag;
|
|
57
|
-
if (ref) ref.node = node;
|
|
58
|
-
return node;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { createNode };
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { isNode } from "../nodes/identity.js";
|
|
2
|
-
import { visit } from "../visit.js";
|
|
3
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/directives.js
|
|
4
|
-
const escapeChars = {
|
|
5
|
-
"!": "%21",
|
|
6
|
-
",": "%2C",
|
|
7
|
-
"[": "%5B",
|
|
8
|
-
"]": "%5D",
|
|
9
|
-
"{": "%7B",
|
|
10
|
-
"}": "%7D"
|
|
11
|
-
};
|
|
12
|
-
const escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]);
|
|
13
|
-
var Directives = class Directives {
|
|
14
|
-
constructor(yaml, tags) {
|
|
15
|
-
/**
|
|
16
|
-
* The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
|
17
|
-
* included in the document's stringified representation.
|
|
18
|
-
*/
|
|
19
|
-
this.docStart = null;
|
|
20
|
-
/** The doc-end marker `...`. */
|
|
21
|
-
this.docEnd = false;
|
|
22
|
-
this.yaml = Object.assign({}, Directives.defaultYaml, yaml);
|
|
23
|
-
this.tags = Object.assign({}, Directives.defaultTags, tags);
|
|
24
|
-
}
|
|
25
|
-
clone() {
|
|
26
|
-
const copy = new Directives(this.yaml, this.tags);
|
|
27
|
-
copy.docStart = this.docStart;
|
|
28
|
-
return copy;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* During parsing, get a Directives instance for the current document and
|
|
32
|
-
* update the stream state according to the current version's spec.
|
|
33
|
-
*/
|
|
34
|
-
atDocument() {
|
|
35
|
-
const res = new Directives(this.yaml, this.tags);
|
|
36
|
-
switch (this.yaml.version) {
|
|
37
|
-
case "1.1":
|
|
38
|
-
this.atNextDocument = true;
|
|
39
|
-
break;
|
|
40
|
-
case "1.2":
|
|
41
|
-
this.atNextDocument = false;
|
|
42
|
-
this.yaml = {
|
|
43
|
-
explicit: Directives.defaultYaml.explicit,
|
|
44
|
-
version: "1.2"
|
|
45
|
-
};
|
|
46
|
-
this.tags = Object.assign({}, Directives.defaultTags);
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
return res;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @param onError - May be called even if the action was successful
|
|
53
|
-
* @returns `true` on success
|
|
54
|
-
*/
|
|
55
|
-
add(line, onError) {
|
|
56
|
-
if (this.atNextDocument) {
|
|
57
|
-
this.yaml = {
|
|
58
|
-
explicit: Directives.defaultYaml.explicit,
|
|
59
|
-
version: "1.1"
|
|
60
|
-
};
|
|
61
|
-
this.tags = Object.assign({}, Directives.defaultTags);
|
|
62
|
-
this.atNextDocument = false;
|
|
63
|
-
}
|
|
64
|
-
const parts = line.trim().split(/[ \t]+/);
|
|
65
|
-
const name = parts.shift();
|
|
66
|
-
switch (name) {
|
|
67
|
-
case "%TAG": {
|
|
68
|
-
if (parts.length !== 2) {
|
|
69
|
-
onError(0, "%TAG directive should contain exactly two parts");
|
|
70
|
-
if (parts.length < 2) return false;
|
|
71
|
-
}
|
|
72
|
-
const [handle, prefix] = parts;
|
|
73
|
-
this.tags[handle] = prefix;
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
case "%YAML": {
|
|
77
|
-
this.yaml.explicit = true;
|
|
78
|
-
if (parts.length !== 1) {
|
|
79
|
-
onError(0, "%YAML directive should contain exactly one part");
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
const [version] = parts;
|
|
83
|
-
if (version === "1.1" || version === "1.2") {
|
|
84
|
-
this.yaml.version = version;
|
|
85
|
-
return true;
|
|
86
|
-
} else {
|
|
87
|
-
const isValid = /^\d+\.\d+$/.test(version);
|
|
88
|
-
onError(6, `Unsupported YAML version ${version}`, isValid);
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
default:
|
|
93
|
-
onError(0, `Unknown directive ${name}`, true);
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
99
|
-
*
|
|
100
|
-
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
101
|
-
* `'!local'` tag, or `null` if unresolvable.
|
|
102
|
-
*/
|
|
103
|
-
tagName(source, onError) {
|
|
104
|
-
if (source === "!") return "!";
|
|
105
|
-
if (source[0] !== "!") {
|
|
106
|
-
onError(`Not a valid tag: ${source}`);
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
if (source[1] === "<") {
|
|
110
|
-
const verbatim = source.slice(2, -1);
|
|
111
|
-
if (verbatim === "!" || verbatim === "!!") {
|
|
112
|
-
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
if (source[source.length - 1] !== ">") onError("Verbatim tags must end with a >");
|
|
116
|
-
return verbatim;
|
|
117
|
-
}
|
|
118
|
-
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
|
|
119
|
-
if (!suffix) onError(`The ${source} tag has no suffix`);
|
|
120
|
-
const prefix = this.tags[handle];
|
|
121
|
-
if (prefix) try {
|
|
122
|
-
return prefix + decodeURIComponent(suffix);
|
|
123
|
-
} catch (error) {
|
|
124
|
-
onError(String(error));
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
if (handle === "!") return source;
|
|
128
|
-
onError(`Could not resolve tag: ${source}`);
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Given a fully resolved tag, returns its printable string form,
|
|
133
|
-
* taking into account current tag prefixes and defaults.
|
|
134
|
-
*/
|
|
135
|
-
tagString(tag) {
|
|
136
|
-
for (const [handle, prefix] of Object.entries(this.tags)) if (tag.startsWith(prefix)) return handle + escapeTagName(tag.substring(prefix.length));
|
|
137
|
-
return tag[0] === "!" ? tag : `!<${tag}>`;
|
|
138
|
-
}
|
|
139
|
-
toString(doc) {
|
|
140
|
-
const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
|
|
141
|
-
const tagEntries = Object.entries(this.tags);
|
|
142
|
-
let tagNames;
|
|
143
|
-
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
144
|
-
const tags = {};
|
|
145
|
-
visit(doc.contents, (_key, node) => {
|
|
146
|
-
if (isNode(node) && node.tag) tags[node.tag] = true;
|
|
147
|
-
});
|
|
148
|
-
tagNames = Object.keys(tags);
|
|
149
|
-
} else tagNames = [];
|
|
150
|
-
for (const [handle, prefix] of tagEntries) {
|
|
151
|
-
if (handle === "!!" && prefix === "tag:yaml.org,2002:") continue;
|
|
152
|
-
if (!doc || tagNames.some((tn) => tn.startsWith(prefix))) lines.push(`%TAG ${handle} ${prefix}`);
|
|
153
|
-
}
|
|
154
|
-
return lines.join("\n");
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
Directives.defaultYaml = {
|
|
158
|
-
explicit: false,
|
|
159
|
-
version: "1.2"
|
|
160
|
-
};
|
|
161
|
-
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
162
|
-
//#endregion
|
|
163
|
-
export { Directives };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/errors.js
|
|
2
|
-
var YAMLError = class extends Error {
|
|
3
|
-
constructor(name, pos, code, message) {
|
|
4
|
-
super();
|
|
5
|
-
this.name = name;
|
|
6
|
-
this.code = code;
|
|
7
|
-
this.message = message;
|
|
8
|
-
this.pos = pos;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
var YAMLParseError = class extends YAMLError {
|
|
12
|
-
constructor(pos, code, message) {
|
|
13
|
-
super("YAMLParseError", pos, code, message);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var YAMLWarning = class extends YAMLError {
|
|
17
|
-
constructor(pos, code, message) {
|
|
18
|
-
super("YAMLWarning", pos, code, message);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const prettifyError = (src, lc) => (error) => {
|
|
22
|
-
if (error.pos[0] === -1) return;
|
|
23
|
-
error.linePos = error.pos.map((pos) => lc.linePos(pos));
|
|
24
|
-
const { line, col } = error.linePos[0];
|
|
25
|
-
error.message += ` at line ${line}, column ${col}`;
|
|
26
|
-
let ci = col - 1;
|
|
27
|
-
let lineStr = src.substring(lc.lineStarts[line - 1], lc.lineStarts[line]).replace(/[\n\r]+$/, "");
|
|
28
|
-
if (ci >= 60 && lineStr.length > 80) {
|
|
29
|
-
const trimStart = Math.min(ci - 39, lineStr.length - 79);
|
|
30
|
-
lineStr = "…" + lineStr.substring(trimStart);
|
|
31
|
-
ci -= trimStart - 1;
|
|
32
|
-
}
|
|
33
|
-
if (lineStr.length > 80) lineStr = lineStr.substring(0, 79) + "…";
|
|
34
|
-
if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {
|
|
35
|
-
let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);
|
|
36
|
-
if (prev.length > 80) prev = prev.substring(0, 79) + "…\n";
|
|
37
|
-
lineStr = prev + lineStr;
|
|
38
|
-
}
|
|
39
|
-
if (/[^ ]/.test(lineStr)) {
|
|
40
|
-
let count = 1;
|
|
41
|
-
const end = error.linePos[1];
|
|
42
|
-
if (end?.line === line && end.col > col) count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
43
|
-
const pointer = " ".repeat(ci) + "^".repeat(count);
|
|
44
|
-
error.message += `:\n\n${lineStr}\n${pointer}\n`;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
|
-
export { YAMLError, YAMLParseError, YAMLWarning, prettifyError };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./nodes/identity.js";
|
|
2
|
-
import "./visit.js";
|
|
3
|
-
import "./nodes/Alias.js";
|
|
4
|
-
import "./nodes/Scalar.js";
|
|
5
|
-
import "./nodes/Pair.js";
|
|
6
|
-
import "./nodes/YAMLMap.js";
|
|
7
|
-
import "./nodes/YAMLSeq.js";
|
|
8
|
-
import "./schema/Schema.js";
|
|
9
|
-
import "./doc/Document.js";
|
|
10
|
-
import "./errors.js";
|
|
11
|
-
import "./compose/composer.js";
|
|
12
|
-
import "./parse/cst.js";
|
|
13
|
-
import "./parse/lexer.js";
|
|
14
|
-
import "./parse/line-counter.js";
|
|
15
|
-
import "./parse/parser.js";
|
|
16
|
-
import "./public-api.js";
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { ALIAS, hasAnchor, isAlias, isCollection, isPair } from "./identity.js";
|
|
2
|
-
import { visit } from "../visit.js";
|
|
3
|
-
import { anchorIsValid } from "../doc/anchors.js";
|
|
4
|
-
import { toJS } from "./toJS.js";
|
|
5
|
-
import { NodeBase } from "./Node.js";
|
|
6
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Alias.js
|
|
7
|
-
var Alias = class extends NodeBase {
|
|
8
|
-
constructor(source) {
|
|
9
|
-
super(ALIAS);
|
|
10
|
-
this.source = source;
|
|
11
|
-
Object.defineProperty(this, "tag", { set() {
|
|
12
|
-
throw new Error("Alias nodes cannot have tags");
|
|
13
|
-
} });
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Resolve the value of this alias within `doc`, finding the last
|
|
17
|
-
* instance of the `source` anchor before this node.
|
|
18
|
-
*/
|
|
19
|
-
resolve(doc, ctx) {
|
|
20
|
-
if (ctx?.maxAliasCount === 0) throw new ReferenceError("Alias resolution is disabled");
|
|
21
|
-
let nodes;
|
|
22
|
-
if (ctx?.aliasResolveCache) nodes = ctx.aliasResolveCache;
|
|
23
|
-
else {
|
|
24
|
-
nodes = [];
|
|
25
|
-
visit(doc, { Node: (_key, node) => {
|
|
26
|
-
if (isAlias(node) || hasAnchor(node)) nodes.push(node);
|
|
27
|
-
} });
|
|
28
|
-
if (ctx) ctx.aliasResolveCache = nodes;
|
|
29
|
-
}
|
|
30
|
-
let found = void 0;
|
|
31
|
-
for (const node of nodes) {
|
|
32
|
-
if (node === this) break;
|
|
33
|
-
if (node.anchor === this.source) found = node;
|
|
34
|
-
}
|
|
35
|
-
return found;
|
|
36
|
-
}
|
|
37
|
-
toJSON(_arg, ctx) {
|
|
38
|
-
if (!ctx) return { source: this.source };
|
|
39
|
-
const { anchors, doc, maxAliasCount } = ctx;
|
|
40
|
-
const source = this.resolve(doc, ctx);
|
|
41
|
-
if (!source) {
|
|
42
|
-
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
43
|
-
throw new ReferenceError(msg);
|
|
44
|
-
}
|
|
45
|
-
let data = anchors.get(source);
|
|
46
|
-
if (!data) {
|
|
47
|
-
toJS(source, null, ctx);
|
|
48
|
-
data = anchors.get(source);
|
|
49
|
-
}
|
|
50
|
-
/* istanbul ignore if */
|
|
51
|
-
if (data?.res === void 0) throw new ReferenceError("This should not happen: Alias anchor was not resolved?");
|
|
52
|
-
if (maxAliasCount >= 0) {
|
|
53
|
-
data.count += 1;
|
|
54
|
-
if (data.aliasCount === 0) data.aliasCount = getAliasCount(doc, source, anchors);
|
|
55
|
-
if (data.count * data.aliasCount > maxAliasCount) throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack");
|
|
56
|
-
}
|
|
57
|
-
return data.res;
|
|
58
|
-
}
|
|
59
|
-
toString(ctx, _onComment, _onChompKeep) {
|
|
60
|
-
const src = `*${this.source}`;
|
|
61
|
-
if (ctx) {
|
|
62
|
-
anchorIsValid(this.source);
|
|
63
|
-
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
64
|
-
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
65
|
-
throw new Error(msg);
|
|
66
|
-
}
|
|
67
|
-
if (ctx.implicitKey) return `${src} `;
|
|
68
|
-
}
|
|
69
|
-
return src;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
function getAliasCount(doc, node, anchors) {
|
|
73
|
-
if (isAlias(node)) {
|
|
74
|
-
const source = node.resolve(doc);
|
|
75
|
-
const anchor = anchors && source && anchors.get(source);
|
|
76
|
-
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
77
|
-
} else if (isCollection(node)) {
|
|
78
|
-
let count = 0;
|
|
79
|
-
for (const item of node.items) {
|
|
80
|
-
const c = getAliasCount(doc, item, anchors);
|
|
81
|
-
if (c > count) count = c;
|
|
82
|
-
}
|
|
83
|
-
return count;
|
|
84
|
-
} else if (isPair(node)) {
|
|
85
|
-
const kc = getAliasCount(doc, node.key, anchors);
|
|
86
|
-
const vc = getAliasCount(doc, node.value, anchors);
|
|
87
|
-
return Math.max(kc, vc);
|
|
88
|
-
}
|
|
89
|
-
return 1;
|
|
90
|
-
}
|
|
91
|
-
//#endregion
|
|
92
|
-
export { Alias };
|
package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { isCollection, isNode, isPair, isScalar } from "./identity.js";
|
|
2
|
-
import { NodeBase } from "./Node.js";
|
|
3
|
-
import { createNode } from "../doc/createNode.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js
|
|
5
|
-
function collectionFromPath(schema, path, value) {
|
|
6
|
-
let v = value;
|
|
7
|
-
for (let i = path.length - 1; i >= 0; --i) {
|
|
8
|
-
const k = path[i];
|
|
9
|
-
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
10
|
-
const a = [];
|
|
11
|
-
a[k] = v;
|
|
12
|
-
v = a;
|
|
13
|
-
} else v = new Map([[k, v]]);
|
|
14
|
-
}
|
|
15
|
-
return createNode(v, void 0, {
|
|
16
|
-
aliasDuplicateObjects: false,
|
|
17
|
-
keepUndefined: false,
|
|
18
|
-
onAnchor: () => {
|
|
19
|
-
throw new Error("This should not happen, please report a bug.");
|
|
20
|
-
},
|
|
21
|
-
schema,
|
|
22
|
-
sourceObjects: /* @__PURE__ */ new Map()
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
26
|
-
var Collection = class extends NodeBase {
|
|
27
|
-
constructor(type, schema) {
|
|
28
|
-
super(type);
|
|
29
|
-
Object.defineProperty(this, "schema", {
|
|
30
|
-
value: schema,
|
|
31
|
-
configurable: true,
|
|
32
|
-
enumerable: false,
|
|
33
|
-
writable: true
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create a copy of this collection.
|
|
38
|
-
*
|
|
39
|
-
* @param schema - If defined, overwrites the original's schema
|
|
40
|
-
*/
|
|
41
|
-
clone(schema) {
|
|
42
|
-
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
43
|
-
if (schema) copy.schema = schema;
|
|
44
|
-
copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema) : it);
|
|
45
|
-
if (this.range) copy.range = this.range.slice();
|
|
46
|
-
return copy;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
50
|
-
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
51
|
-
* that already exists in the map.
|
|
52
|
-
*/
|
|
53
|
-
addIn(path, value) {
|
|
54
|
-
if (isEmptyPath(path)) this.add(value);
|
|
55
|
-
else {
|
|
56
|
-
const [key, ...rest] = path;
|
|
57
|
-
const node = this.get(key, true);
|
|
58
|
-
if (isCollection(node)) node.addIn(rest, value);
|
|
59
|
-
else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
|
|
60
|
-
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Removes a value from the collection.
|
|
65
|
-
* @returns `true` if the item was found and removed.
|
|
66
|
-
*/
|
|
67
|
-
deleteIn(path) {
|
|
68
|
-
const [key, ...rest] = path;
|
|
69
|
-
if (rest.length === 0) return this.delete(key);
|
|
70
|
-
const node = this.get(key, true);
|
|
71
|
-
if (isCollection(node)) return node.deleteIn(rest);
|
|
72
|
-
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
76
|
-
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
77
|
-
* `true` (collections are always returned intact).
|
|
78
|
-
*/
|
|
79
|
-
getIn(path, keepScalar) {
|
|
80
|
-
const [key, ...rest] = path;
|
|
81
|
-
const node = this.get(key, true);
|
|
82
|
-
if (rest.length === 0) return !keepScalar && isScalar(node) ? node.value : node;
|
|
83
|
-
else return isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
84
|
-
}
|
|
85
|
-
hasAllNullValues(allowScalar) {
|
|
86
|
-
return this.items.every((node) => {
|
|
87
|
-
if (!isPair(node)) return false;
|
|
88
|
-
const n = node.value;
|
|
89
|
-
return n == null || allowScalar && isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Checks if the collection includes a value with the key `key`.
|
|
94
|
-
*/
|
|
95
|
-
hasIn(path) {
|
|
96
|
-
const [key, ...rest] = path;
|
|
97
|
-
if (rest.length === 0) return this.has(key);
|
|
98
|
-
const node = this.get(key, true);
|
|
99
|
-
return isCollection(node) ? node.hasIn(rest) : false;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
103
|
-
* boolean to add/remove the item from the set.
|
|
104
|
-
*/
|
|
105
|
-
setIn(path, value) {
|
|
106
|
-
const [key, ...rest] = path;
|
|
107
|
-
if (rest.length === 0) this.set(key, value);
|
|
108
|
-
else {
|
|
109
|
-
const node = this.get(key, true);
|
|
110
|
-
if (isCollection(node)) node.setIn(rest, value);
|
|
111
|
-
else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
|
|
112
|
-
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
//#endregion
|
|
117
|
-
export { Collection, collectionFromPath, isEmptyPath };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { NODE_TYPE, isDocument } from "./identity.js";
|
|
2
|
-
import { applyReviver } from "../doc/applyReviver.js";
|
|
3
|
-
import { toJS } from "./toJS.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Node.js
|
|
5
|
-
var NodeBase = class {
|
|
6
|
-
constructor(type) {
|
|
7
|
-
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
8
|
-
}
|
|
9
|
-
/** Create a copy of this node. */
|
|
10
|
-
clone() {
|
|
11
|
-
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
12
|
-
if (this.range) copy.range = this.range.slice();
|
|
13
|
-
return copy;
|
|
14
|
-
}
|
|
15
|
-
/** A plain JavaScript representation of this node. */
|
|
16
|
-
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
17
|
-
if (!isDocument(doc)) throw new TypeError("A document argument is required");
|
|
18
|
-
const ctx = {
|
|
19
|
-
anchors: /* @__PURE__ */ new Map(),
|
|
20
|
-
doc,
|
|
21
|
-
keep: true,
|
|
22
|
-
mapAsMap: mapAsMap === true,
|
|
23
|
-
mapKeyWarned: false,
|
|
24
|
-
maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
|
|
25
|
-
};
|
|
26
|
-
const res = toJS(this, "", ctx);
|
|
27
|
-
if (typeof onAnchor === "function") for (const { count, res } of ctx.anchors.values()) onAnchor(res, count);
|
|
28
|
-
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
//#endregion
|
|
32
|
-
export { NodeBase };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { NODE_TYPE, PAIR, isNode } from "./identity.js";
|
|
2
|
-
import { createNode } from "../doc/createNode.js";
|
|
3
|
-
import { stringifyPair } from "../stringify/stringifyPair.js";
|
|
4
|
-
import { addPairToJSMap } from "./addPairToJSMap.js";
|
|
5
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Pair.js
|
|
6
|
-
function createPair(key, value, ctx) {
|
|
7
|
-
return new Pair(createNode(key, void 0, ctx), createNode(value, void 0, ctx));
|
|
8
|
-
}
|
|
9
|
-
var Pair = class Pair {
|
|
10
|
-
constructor(key, value = null) {
|
|
11
|
-
Object.defineProperty(this, NODE_TYPE, { value: PAIR });
|
|
12
|
-
this.key = key;
|
|
13
|
-
this.value = value;
|
|
14
|
-
}
|
|
15
|
-
clone(schema) {
|
|
16
|
-
let { key, value } = this;
|
|
17
|
-
if (isNode(key)) key = key.clone(schema);
|
|
18
|
-
if (isNode(value)) value = value.clone(schema);
|
|
19
|
-
return new Pair(key, value);
|
|
20
|
-
}
|
|
21
|
-
toJSON(_, ctx) {
|
|
22
|
-
return addPairToJSMap(ctx, ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
|
|
23
|
-
}
|
|
24
|
-
toString(ctx, onComment, onChompKeep) {
|
|
25
|
-
return ctx?.doc ? stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
export { Pair, createPair };
|