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,529 +0,0 @@
|
|
|
1
|
-
import "./cst.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/lexer.js
|
|
3
|
-
function isEmpty(ch) {
|
|
4
|
-
switch (ch) {
|
|
5
|
-
case void 0:
|
|
6
|
-
case " ":
|
|
7
|
-
case "\n":
|
|
8
|
-
case "\r":
|
|
9
|
-
case " ": return true;
|
|
10
|
-
default: return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const hexDigits = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef");
|
|
14
|
-
const tagChars = /* @__PURE__ */ new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
|
|
15
|
-
const flowIndicatorChars = /* @__PURE__ */ new Set(",[]{}");
|
|
16
|
-
const invalidAnchorChars = /* @__PURE__ */ new Set(" ,[]{}\n\r ");
|
|
17
|
-
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
|
|
18
|
-
/**
|
|
19
|
-
* Splits an input string into lexical tokens, i.e. smaller strings that are
|
|
20
|
-
* easily identifiable by `tokens.tokenType()`.
|
|
21
|
-
*
|
|
22
|
-
* Lexing starts always in a "stream" context. Incomplete input may be buffered
|
|
23
|
-
* until a complete token can be emitted.
|
|
24
|
-
*
|
|
25
|
-
* In addition to slices of the original input, the following control characters
|
|
26
|
-
* may also be emitted:
|
|
27
|
-
*
|
|
28
|
-
* - `\x02` (Start of Text): A document starts with the next token
|
|
29
|
-
* - `\x18` (Cancel): Unexpected end of flow-mode (indicates an error)
|
|
30
|
-
* - `\x1f` (Unit Separator): Next token is a scalar value
|
|
31
|
-
* - `\u{FEFF}` (Byte order mark): Emitted separately outside documents
|
|
32
|
-
*/
|
|
33
|
-
var Lexer = class {
|
|
34
|
-
constructor() {
|
|
35
|
-
/**
|
|
36
|
-
* Flag indicating whether the end of the current buffer marks the end of
|
|
37
|
-
* all input
|
|
38
|
-
*/
|
|
39
|
-
this.atEnd = false;
|
|
40
|
-
/**
|
|
41
|
-
* Explicit indent set in block scalar header, as an offset from the current
|
|
42
|
-
* minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not
|
|
43
|
-
* explicitly set.
|
|
44
|
-
*/
|
|
45
|
-
this.blockScalarIndent = -1;
|
|
46
|
-
/**
|
|
47
|
-
* Block scalars that include a + (keep) chomping indicator in their header
|
|
48
|
-
* include trailing empty lines, which are otherwise excluded from the
|
|
49
|
-
* scalar's contents.
|
|
50
|
-
*/
|
|
51
|
-
this.blockScalarKeep = false;
|
|
52
|
-
/** Current input */
|
|
53
|
-
this.buffer = "";
|
|
54
|
-
/**
|
|
55
|
-
* Flag noting whether the map value indicator : can immediately follow this
|
|
56
|
-
* node within a flow context.
|
|
57
|
-
*/
|
|
58
|
-
this.flowKey = false;
|
|
59
|
-
/** Count of surrounding flow collection levels. */
|
|
60
|
-
this.flowLevel = 0;
|
|
61
|
-
/**
|
|
62
|
-
* Minimum level of indentation required for next lines to be parsed as a
|
|
63
|
-
* part of the current scalar value.
|
|
64
|
-
*/
|
|
65
|
-
this.indentNext = 0;
|
|
66
|
-
/** Indentation level of the current line. */
|
|
67
|
-
this.indentValue = 0;
|
|
68
|
-
/** Position of the next \n character. */
|
|
69
|
-
this.lineEndPos = null;
|
|
70
|
-
/** Stores the state of the lexer if reaching the end of incpomplete input */
|
|
71
|
-
this.next = null;
|
|
72
|
-
/** A pointer to `buffer`; the current position of the lexer. */
|
|
73
|
-
this.pos = 0;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Generate YAML tokens from the `source` string. If `incomplete`,
|
|
77
|
-
* a part of the last line may be left as a buffer for the next call.
|
|
78
|
-
*
|
|
79
|
-
* @returns A generator of lexical tokens
|
|
80
|
-
*/
|
|
81
|
-
*lex(source, incomplete = false) {
|
|
82
|
-
if (source) {
|
|
83
|
-
if (typeof source !== "string") throw TypeError("source is not a string");
|
|
84
|
-
this.buffer = this.buffer ? this.buffer + source : source;
|
|
85
|
-
this.lineEndPos = null;
|
|
86
|
-
}
|
|
87
|
-
this.atEnd = !incomplete;
|
|
88
|
-
let next = this.next ?? "stream";
|
|
89
|
-
while (next && (incomplete || this.hasChars(1))) next = yield* this.parseNext(next);
|
|
90
|
-
}
|
|
91
|
-
atLineEnd() {
|
|
92
|
-
let i = this.pos;
|
|
93
|
-
let ch = this.buffer[i];
|
|
94
|
-
while (ch === " " || ch === " ") ch = this.buffer[++i];
|
|
95
|
-
if (!ch || ch === "#" || ch === "\n") return true;
|
|
96
|
-
if (ch === "\r") return this.buffer[i + 1] === "\n";
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
charAt(n) {
|
|
100
|
-
return this.buffer[this.pos + n];
|
|
101
|
-
}
|
|
102
|
-
continueScalar(offset) {
|
|
103
|
-
let ch = this.buffer[offset];
|
|
104
|
-
if (this.indentNext > 0) {
|
|
105
|
-
let indent = 0;
|
|
106
|
-
while (ch === " ") ch = this.buffer[++indent + offset];
|
|
107
|
-
if (ch === "\r") {
|
|
108
|
-
const next = this.buffer[indent + offset + 1];
|
|
109
|
-
if (next === "\n" || !next && !this.atEnd) return offset + indent + 1;
|
|
110
|
-
}
|
|
111
|
-
return ch === "\n" || indent >= this.indentNext || !ch && !this.atEnd ? offset + indent : -1;
|
|
112
|
-
}
|
|
113
|
-
if (ch === "-" || ch === ".") {
|
|
114
|
-
const dt = this.buffer.substr(offset, 3);
|
|
115
|
-
if ((dt === "---" || dt === "...") && isEmpty(this.buffer[offset + 3])) return -1;
|
|
116
|
-
}
|
|
117
|
-
return offset;
|
|
118
|
-
}
|
|
119
|
-
getLine() {
|
|
120
|
-
let end = this.lineEndPos;
|
|
121
|
-
if (typeof end !== "number" || end !== -1 && end < this.pos) {
|
|
122
|
-
end = this.buffer.indexOf("\n", this.pos);
|
|
123
|
-
this.lineEndPos = end;
|
|
124
|
-
}
|
|
125
|
-
if (end === -1) return this.atEnd ? this.buffer.substring(this.pos) : null;
|
|
126
|
-
if (this.buffer[end - 1] === "\r") end -= 1;
|
|
127
|
-
return this.buffer.substring(this.pos, end);
|
|
128
|
-
}
|
|
129
|
-
hasChars(n) {
|
|
130
|
-
return this.pos + n <= this.buffer.length;
|
|
131
|
-
}
|
|
132
|
-
setNext(state) {
|
|
133
|
-
this.buffer = this.buffer.substring(this.pos);
|
|
134
|
-
this.pos = 0;
|
|
135
|
-
this.lineEndPos = null;
|
|
136
|
-
this.next = state;
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
peek(n) {
|
|
140
|
-
return this.buffer.substr(this.pos, n);
|
|
141
|
-
}
|
|
142
|
-
*parseNext(next) {
|
|
143
|
-
switch (next) {
|
|
144
|
-
case "stream": return yield* this.parseStream();
|
|
145
|
-
case "line-start": return yield* this.parseLineStart();
|
|
146
|
-
case "block-start": return yield* this.parseBlockStart();
|
|
147
|
-
case "doc": return yield* this.parseDocument();
|
|
148
|
-
case "flow": return yield* this.parseFlowCollection();
|
|
149
|
-
case "quoted-scalar": return yield* this.parseQuotedScalar();
|
|
150
|
-
case "block-scalar": return yield* this.parseBlockScalar();
|
|
151
|
-
case "plain-scalar": return yield* this.parsePlainScalar();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
*parseStream() {
|
|
155
|
-
let line = this.getLine();
|
|
156
|
-
if (line === null) return this.setNext("stream");
|
|
157
|
-
if (line[0] === "") {
|
|
158
|
-
yield* this.pushCount(1);
|
|
159
|
-
line = line.substring(1);
|
|
160
|
-
}
|
|
161
|
-
if (line[0] === "%") {
|
|
162
|
-
let dirEnd = line.length;
|
|
163
|
-
let cs = line.indexOf("#");
|
|
164
|
-
while (cs !== -1) {
|
|
165
|
-
const ch = line[cs - 1];
|
|
166
|
-
if (ch === " " || ch === " ") {
|
|
167
|
-
dirEnd = cs - 1;
|
|
168
|
-
break;
|
|
169
|
-
} else cs = line.indexOf("#", cs + 1);
|
|
170
|
-
}
|
|
171
|
-
while (true) {
|
|
172
|
-
const ch = line[dirEnd - 1];
|
|
173
|
-
if (ch === " " || ch === " ") dirEnd -= 1;
|
|
174
|
-
else break;
|
|
175
|
-
}
|
|
176
|
-
const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));
|
|
177
|
-
yield* this.pushCount(line.length - n);
|
|
178
|
-
this.pushNewline();
|
|
179
|
-
return "stream";
|
|
180
|
-
}
|
|
181
|
-
if (this.atLineEnd()) {
|
|
182
|
-
const sp = yield* this.pushSpaces(true);
|
|
183
|
-
yield* this.pushCount(line.length - sp);
|
|
184
|
-
yield* this.pushNewline();
|
|
185
|
-
return "stream";
|
|
186
|
-
}
|
|
187
|
-
yield "";
|
|
188
|
-
return yield* this.parseLineStart();
|
|
189
|
-
}
|
|
190
|
-
*parseLineStart() {
|
|
191
|
-
const ch = this.charAt(0);
|
|
192
|
-
if (!ch && !this.atEnd) return this.setNext("line-start");
|
|
193
|
-
if (ch === "-" || ch === ".") {
|
|
194
|
-
if (!this.atEnd && !this.hasChars(4)) return this.setNext("line-start");
|
|
195
|
-
const s = this.peek(3);
|
|
196
|
-
if ((s === "---" || s === "...") && isEmpty(this.charAt(3))) {
|
|
197
|
-
yield* this.pushCount(3);
|
|
198
|
-
this.indentValue = 0;
|
|
199
|
-
this.indentNext = 0;
|
|
200
|
-
return s === "---" ? "doc" : "stream";
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
this.indentValue = yield* this.pushSpaces(false);
|
|
204
|
-
if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1))) this.indentNext = this.indentValue;
|
|
205
|
-
return yield* this.parseBlockStart();
|
|
206
|
-
}
|
|
207
|
-
*parseBlockStart() {
|
|
208
|
-
const [ch0, ch1] = this.peek(2);
|
|
209
|
-
if (!ch1 && !this.atEnd) return this.setNext("block-start");
|
|
210
|
-
if ((ch0 === "-" || ch0 === "?" || ch0 === ":") && isEmpty(ch1)) {
|
|
211
|
-
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
212
|
-
this.indentNext = this.indentValue + 1;
|
|
213
|
-
this.indentValue += n;
|
|
214
|
-
return "block-start";
|
|
215
|
-
}
|
|
216
|
-
return "doc";
|
|
217
|
-
}
|
|
218
|
-
*parseDocument() {
|
|
219
|
-
yield* this.pushSpaces(true);
|
|
220
|
-
const line = this.getLine();
|
|
221
|
-
if (line === null) return this.setNext("doc");
|
|
222
|
-
let n = yield* this.pushIndicators();
|
|
223
|
-
switch (line[n]) {
|
|
224
|
-
case "#": yield* this.pushCount(line.length - n);
|
|
225
|
-
case void 0:
|
|
226
|
-
yield* this.pushNewline();
|
|
227
|
-
return yield* this.parseLineStart();
|
|
228
|
-
case "{":
|
|
229
|
-
case "[":
|
|
230
|
-
yield* this.pushCount(1);
|
|
231
|
-
this.flowKey = false;
|
|
232
|
-
this.flowLevel = 1;
|
|
233
|
-
return "flow";
|
|
234
|
-
case "}":
|
|
235
|
-
case "]":
|
|
236
|
-
yield* this.pushCount(1);
|
|
237
|
-
return "doc";
|
|
238
|
-
case "*":
|
|
239
|
-
yield* this.pushUntil(isNotAnchorChar);
|
|
240
|
-
return "doc";
|
|
241
|
-
case "\"":
|
|
242
|
-
case "'": return yield* this.parseQuotedScalar();
|
|
243
|
-
case "|":
|
|
244
|
-
case ">":
|
|
245
|
-
n += yield* this.parseBlockScalarHeader();
|
|
246
|
-
n += yield* this.pushSpaces(true);
|
|
247
|
-
yield* this.pushCount(line.length - n);
|
|
248
|
-
yield* this.pushNewline();
|
|
249
|
-
return yield* this.parseBlockScalar();
|
|
250
|
-
default: return yield* this.parsePlainScalar();
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
*parseFlowCollection() {
|
|
254
|
-
let nl, sp;
|
|
255
|
-
let indent = -1;
|
|
256
|
-
do {
|
|
257
|
-
nl = yield* this.pushNewline();
|
|
258
|
-
if (nl > 0) {
|
|
259
|
-
sp = yield* this.pushSpaces(false);
|
|
260
|
-
this.indentValue = indent = sp;
|
|
261
|
-
} else sp = 0;
|
|
262
|
-
sp += yield* this.pushSpaces(true);
|
|
263
|
-
} while (nl + sp > 0);
|
|
264
|
-
const line = this.getLine();
|
|
265
|
-
if (line === null) return this.setNext("flow");
|
|
266
|
-
if (indent !== -1 && indent < this.indentNext && line[0] !== "#" || indent === 0 && (line.startsWith("---") || line.startsWith("...")) && isEmpty(line[3])) {
|
|
267
|
-
if (!(indent === this.indentNext - 1 && this.flowLevel === 1 && (line[0] === "]" || line[0] === "}"))) {
|
|
268
|
-
this.flowLevel = 0;
|
|
269
|
-
yield "";
|
|
270
|
-
return yield* this.parseLineStart();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
let n = 0;
|
|
274
|
-
while (line[n] === ",") {
|
|
275
|
-
n += yield* this.pushCount(1);
|
|
276
|
-
n += yield* this.pushSpaces(true);
|
|
277
|
-
this.flowKey = false;
|
|
278
|
-
}
|
|
279
|
-
n += yield* this.pushIndicators();
|
|
280
|
-
switch (line[n]) {
|
|
281
|
-
case void 0: return "flow";
|
|
282
|
-
case "#":
|
|
283
|
-
yield* this.pushCount(line.length - n);
|
|
284
|
-
return "flow";
|
|
285
|
-
case "{":
|
|
286
|
-
case "[":
|
|
287
|
-
yield* this.pushCount(1);
|
|
288
|
-
this.flowKey = false;
|
|
289
|
-
this.flowLevel += 1;
|
|
290
|
-
return "flow";
|
|
291
|
-
case "}":
|
|
292
|
-
case "]":
|
|
293
|
-
yield* this.pushCount(1);
|
|
294
|
-
this.flowKey = true;
|
|
295
|
-
this.flowLevel -= 1;
|
|
296
|
-
return this.flowLevel ? "flow" : "doc";
|
|
297
|
-
case "*":
|
|
298
|
-
yield* this.pushUntil(isNotAnchorChar);
|
|
299
|
-
return "flow";
|
|
300
|
-
case "\"":
|
|
301
|
-
case "'":
|
|
302
|
-
this.flowKey = true;
|
|
303
|
-
return yield* this.parseQuotedScalar();
|
|
304
|
-
case ":": {
|
|
305
|
-
const next = this.charAt(1);
|
|
306
|
-
if (this.flowKey || isEmpty(next) || next === ",") {
|
|
307
|
-
this.flowKey = false;
|
|
308
|
-
yield* this.pushCount(1);
|
|
309
|
-
yield* this.pushSpaces(true);
|
|
310
|
-
return "flow";
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
default:
|
|
314
|
-
this.flowKey = false;
|
|
315
|
-
return yield* this.parsePlainScalar();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
*parseQuotedScalar() {
|
|
319
|
-
const quote = this.charAt(0);
|
|
320
|
-
let end = this.buffer.indexOf(quote, this.pos + 1);
|
|
321
|
-
if (quote === "'") while (end !== -1 && this.buffer[end + 1] === "'") end = this.buffer.indexOf("'", end + 2);
|
|
322
|
-
else while (end !== -1) {
|
|
323
|
-
let n = 0;
|
|
324
|
-
while (this.buffer[end - 1 - n] === "\\") n += 1;
|
|
325
|
-
if (n % 2 === 0) break;
|
|
326
|
-
end = this.buffer.indexOf("\"", end + 1);
|
|
327
|
-
}
|
|
328
|
-
const qb = this.buffer.substring(0, end);
|
|
329
|
-
let nl = qb.indexOf("\n", this.pos);
|
|
330
|
-
if (nl !== -1) {
|
|
331
|
-
while (nl !== -1) {
|
|
332
|
-
const cs = this.continueScalar(nl + 1);
|
|
333
|
-
if (cs === -1) break;
|
|
334
|
-
nl = qb.indexOf("\n", cs);
|
|
335
|
-
}
|
|
336
|
-
if (nl !== -1) end = nl - (qb[nl - 1] === "\r" ? 2 : 1);
|
|
337
|
-
}
|
|
338
|
-
if (end === -1) {
|
|
339
|
-
if (!this.atEnd) return this.setNext("quoted-scalar");
|
|
340
|
-
end = this.buffer.length;
|
|
341
|
-
}
|
|
342
|
-
yield* this.pushToIndex(end + 1, false);
|
|
343
|
-
return this.flowLevel ? "flow" : "doc";
|
|
344
|
-
}
|
|
345
|
-
*parseBlockScalarHeader() {
|
|
346
|
-
this.blockScalarIndent = -1;
|
|
347
|
-
this.blockScalarKeep = false;
|
|
348
|
-
let i = this.pos;
|
|
349
|
-
while (true) {
|
|
350
|
-
const ch = this.buffer[++i];
|
|
351
|
-
if (ch === "+") this.blockScalarKeep = true;
|
|
352
|
-
else if (ch > "0" && ch <= "9") this.blockScalarIndent = Number(ch) - 1;
|
|
353
|
-
else if (ch !== "-") break;
|
|
354
|
-
}
|
|
355
|
-
return yield* this.pushUntil((ch) => isEmpty(ch) || ch === "#");
|
|
356
|
-
}
|
|
357
|
-
*parseBlockScalar() {
|
|
358
|
-
let nl = this.pos - 1;
|
|
359
|
-
let indent = 0;
|
|
360
|
-
let ch;
|
|
361
|
-
loop: for (let i = this.pos; ch = this.buffer[i]; ++i) switch (ch) {
|
|
362
|
-
case " ":
|
|
363
|
-
indent += 1;
|
|
364
|
-
break;
|
|
365
|
-
case "\n":
|
|
366
|
-
nl = i;
|
|
367
|
-
indent = 0;
|
|
368
|
-
break;
|
|
369
|
-
case "\r": {
|
|
370
|
-
const next = this.buffer[i + 1];
|
|
371
|
-
if (!next && !this.atEnd) return this.setNext("block-scalar");
|
|
372
|
-
if (next === "\n") break;
|
|
373
|
-
}
|
|
374
|
-
default: break loop;
|
|
375
|
-
}
|
|
376
|
-
if (!ch && !this.atEnd) return this.setNext("block-scalar");
|
|
377
|
-
if (indent >= this.indentNext) {
|
|
378
|
-
if (this.blockScalarIndent === -1) this.indentNext = indent;
|
|
379
|
-
else this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
|
380
|
-
do {
|
|
381
|
-
const cs = this.continueScalar(nl + 1);
|
|
382
|
-
if (cs === -1) break;
|
|
383
|
-
nl = this.buffer.indexOf("\n", cs);
|
|
384
|
-
} while (nl !== -1);
|
|
385
|
-
if (nl === -1) {
|
|
386
|
-
if (!this.atEnd) return this.setNext("block-scalar");
|
|
387
|
-
nl = this.buffer.length;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
let i = nl + 1;
|
|
391
|
-
ch = this.buffer[i];
|
|
392
|
-
while (ch === " ") ch = this.buffer[++i];
|
|
393
|
-
if (ch === " ") {
|
|
394
|
-
while (ch === " " || ch === " " || ch === "\r" || ch === "\n") ch = this.buffer[++i];
|
|
395
|
-
nl = i - 1;
|
|
396
|
-
} else if (!this.blockScalarKeep) do {
|
|
397
|
-
let i = nl - 1;
|
|
398
|
-
let ch = this.buffer[i];
|
|
399
|
-
if (ch === "\r") ch = this.buffer[--i];
|
|
400
|
-
const lastChar = i;
|
|
401
|
-
while (ch === " ") ch = this.buffer[--i];
|
|
402
|
-
if (ch === "\n" && i >= this.pos && i + 1 + indent > lastChar) nl = i;
|
|
403
|
-
else break;
|
|
404
|
-
} while (true);
|
|
405
|
-
yield "";
|
|
406
|
-
yield* this.pushToIndex(nl + 1, true);
|
|
407
|
-
return yield* this.parseLineStart();
|
|
408
|
-
}
|
|
409
|
-
*parsePlainScalar() {
|
|
410
|
-
const inFlow = this.flowLevel > 0;
|
|
411
|
-
let end = this.pos - 1;
|
|
412
|
-
let i = this.pos - 1;
|
|
413
|
-
let ch;
|
|
414
|
-
while (ch = this.buffer[++i]) if (ch === ":") {
|
|
415
|
-
const next = this.buffer[i + 1];
|
|
416
|
-
if (isEmpty(next) || inFlow && flowIndicatorChars.has(next)) break;
|
|
417
|
-
end = i;
|
|
418
|
-
} else if (isEmpty(ch)) {
|
|
419
|
-
let next = this.buffer[i + 1];
|
|
420
|
-
if (ch === "\r") if (next === "\n") {
|
|
421
|
-
i += 1;
|
|
422
|
-
ch = "\n";
|
|
423
|
-
next = this.buffer[i + 1];
|
|
424
|
-
} else end = i;
|
|
425
|
-
if (next === "#" || inFlow && flowIndicatorChars.has(next)) break;
|
|
426
|
-
if (ch === "\n") {
|
|
427
|
-
const cs = this.continueScalar(i + 1);
|
|
428
|
-
if (cs === -1) break;
|
|
429
|
-
i = Math.max(i, cs - 2);
|
|
430
|
-
}
|
|
431
|
-
} else {
|
|
432
|
-
if (inFlow && flowIndicatorChars.has(ch)) break;
|
|
433
|
-
end = i;
|
|
434
|
-
}
|
|
435
|
-
if (!ch && !this.atEnd) return this.setNext("plain-scalar");
|
|
436
|
-
yield "";
|
|
437
|
-
yield* this.pushToIndex(end + 1, true);
|
|
438
|
-
return inFlow ? "flow" : "doc";
|
|
439
|
-
}
|
|
440
|
-
*pushCount(n) {
|
|
441
|
-
if (n > 0) {
|
|
442
|
-
yield this.buffer.substr(this.pos, n);
|
|
443
|
-
this.pos += n;
|
|
444
|
-
return n;
|
|
445
|
-
}
|
|
446
|
-
return 0;
|
|
447
|
-
}
|
|
448
|
-
*pushToIndex(i, allowEmpty) {
|
|
449
|
-
const s = this.buffer.slice(this.pos, i);
|
|
450
|
-
if (s) {
|
|
451
|
-
yield s;
|
|
452
|
-
this.pos += s.length;
|
|
453
|
-
return s.length;
|
|
454
|
-
} else if (allowEmpty) yield "";
|
|
455
|
-
return 0;
|
|
456
|
-
}
|
|
457
|
-
*pushIndicators() {
|
|
458
|
-
let n = 0;
|
|
459
|
-
loop: while (true) {
|
|
460
|
-
switch (this.charAt(0)) {
|
|
461
|
-
case "!":
|
|
462
|
-
n += yield* this.pushTag();
|
|
463
|
-
n += yield* this.pushSpaces(true);
|
|
464
|
-
continue loop;
|
|
465
|
-
case "&":
|
|
466
|
-
n += yield* this.pushUntil(isNotAnchorChar);
|
|
467
|
-
n += yield* this.pushSpaces(true);
|
|
468
|
-
continue loop;
|
|
469
|
-
case "-":
|
|
470
|
-
case "?":
|
|
471
|
-
case ":": {
|
|
472
|
-
const inFlow = this.flowLevel > 0;
|
|
473
|
-
const ch1 = this.charAt(1);
|
|
474
|
-
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
475
|
-
if (!inFlow) this.indentNext = this.indentValue + 1;
|
|
476
|
-
else if (this.flowKey) this.flowKey = false;
|
|
477
|
-
n += yield* this.pushCount(1);
|
|
478
|
-
n += yield* this.pushSpaces(true);
|
|
479
|
-
continue loop;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
break loop;
|
|
484
|
-
}
|
|
485
|
-
return n;
|
|
486
|
-
}
|
|
487
|
-
*pushTag() {
|
|
488
|
-
if (this.charAt(1) === "<") {
|
|
489
|
-
let i = this.pos + 2;
|
|
490
|
-
let ch = this.buffer[i];
|
|
491
|
-
while (!isEmpty(ch) && ch !== ">") ch = this.buffer[++i];
|
|
492
|
-
return yield* this.pushToIndex(ch === ">" ? i + 1 : i, false);
|
|
493
|
-
} else {
|
|
494
|
-
let i = this.pos + 1;
|
|
495
|
-
let ch = this.buffer[i];
|
|
496
|
-
while (ch) if (tagChars.has(ch)) ch = this.buffer[++i];
|
|
497
|
-
else if (ch === "%" && hexDigits.has(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 2])) ch = this.buffer[i += 3];
|
|
498
|
-
else break;
|
|
499
|
-
return yield* this.pushToIndex(i, false);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
*pushNewline() {
|
|
503
|
-
const ch = this.buffer[this.pos];
|
|
504
|
-
if (ch === "\n") return yield* this.pushCount(1);
|
|
505
|
-
else if (ch === "\r" && this.charAt(1) === "\n") return yield* this.pushCount(2);
|
|
506
|
-
else return 0;
|
|
507
|
-
}
|
|
508
|
-
*pushSpaces(allowTabs) {
|
|
509
|
-
let i = this.pos - 1;
|
|
510
|
-
let ch;
|
|
511
|
-
do
|
|
512
|
-
ch = this.buffer[++i];
|
|
513
|
-
while (ch === " " || allowTabs && ch === " ");
|
|
514
|
-
const n = i - this.pos;
|
|
515
|
-
if (n > 0) {
|
|
516
|
-
yield this.buffer.substr(this.pos, n);
|
|
517
|
-
this.pos = i;
|
|
518
|
-
}
|
|
519
|
-
return n;
|
|
520
|
-
}
|
|
521
|
-
*pushUntil(test) {
|
|
522
|
-
let i = this.pos;
|
|
523
|
-
let ch = this.buffer[i];
|
|
524
|
-
while (!test(ch)) ch = this.buffer[++i];
|
|
525
|
-
return yield* this.pushToIndex(i, false);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
//#endregion
|
|
529
|
-
export { Lexer };
|
package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js
|
|
2
|
-
/**
|
|
3
|
-
* Tracks newlines during parsing in order to provide an efficient API for
|
|
4
|
-
* determining the one-indexed `{ line, col }` position for any offset
|
|
5
|
-
* within the input.
|
|
6
|
-
*/
|
|
7
|
-
var LineCounter = class {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.lineStarts = [];
|
|
10
|
-
/**
|
|
11
|
-
* Should be called in ascending order. Otherwise, call
|
|
12
|
-
* `lineCounter.lineStarts.sort()` before calling `linePos()`.
|
|
13
|
-
*/
|
|
14
|
-
this.addNewLine = (offset) => this.lineStarts.push(offset);
|
|
15
|
-
/**
|
|
16
|
-
* Performs a binary search and returns the 1-indexed { line, col }
|
|
17
|
-
* position of `offset`. If `line === 0`, `addNewLine` has never been
|
|
18
|
-
* called or `offset` is before the first known newline.
|
|
19
|
-
*/
|
|
20
|
-
this.linePos = (offset) => {
|
|
21
|
-
let low = 0;
|
|
22
|
-
let high = this.lineStarts.length;
|
|
23
|
-
while (low < high) {
|
|
24
|
-
const mid = low + high >> 1;
|
|
25
|
-
if (this.lineStarts[mid] < offset) low = mid + 1;
|
|
26
|
-
else high = mid;
|
|
27
|
-
}
|
|
28
|
-
if (this.lineStarts[low] === offset) return {
|
|
29
|
-
line: low + 1,
|
|
30
|
-
col: 1
|
|
31
|
-
};
|
|
32
|
-
if (low === 0) return {
|
|
33
|
-
line: 0,
|
|
34
|
-
col: offset
|
|
35
|
-
};
|
|
36
|
-
const start = this.lineStarts[low - 1];
|
|
37
|
-
return {
|
|
38
|
-
line: low,
|
|
39
|
-
col: offset - start + 1
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { LineCounter };
|