cngpac 0.0.1
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/LICENSE +201 -0
- package/dist/bin.mjs +24025 -0
- package/dist/src/_virtual/_rolldown/runtime.mjs +35 -0
- package/dist/src/changelog.d.mts +71 -0
- package/dist/src/changelog.mjs +92 -0
- package/dist/src/changenote.d.mts +41 -0
- package/dist/src/changenote.mjs +184 -0
- package/dist/src/cli/commands/change.d.mts +4 -0
- package/dist/src/cli/commands/change.mjs +75 -0
- package/dist/src/formatter.d.mts +31 -0
- package/dist/src/formatter.mjs +50 -0
- package/dist/src/git.d.mts +20 -0
- package/dist/src/git.mjs +121 -0
- package/dist/src/index.d.mts +19 -0
- package/dist/src/index.mjs +20 -0
- package/dist/src/node_modules/.pnpm/@clack_core@1.2.0/node_modules/@clack/core/dist/index.mjs +530 -0
- package/dist/src/node_modules/.pnpm/@clack_prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs +110 -0
- package/dist/src/node_modules/.pnpm/@kwsites_file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.mjs +13 -0
- package/dist/src/node_modules/.pnpm/@kwsites_file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.mjs +59 -0
- package/dist/src/node_modules/.pnpm/@kwsites_promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.mjs +55 -0
- package/dist/src/node_modules/.pnpm/@octokit_auth-token@6.0.0/node_modules/@octokit/auth-token/dist-bundle/index.mjs +32 -0
- package/dist/src/node_modules/.pnpm/@octokit_core@7.0.6/node_modules/@octokit/core/dist-src/index.mjs +94 -0
- package/dist/src/node_modules/.pnpm/@octokit_core@7.0.6/node_modules/@octokit/core/dist-src/version.mjs +4 -0
- package/dist/src/node_modules/.pnpm/@octokit_endpoint@11.0.3/node_modules/@octokit/endpoint/dist-bundle/index.mjs +223 -0
- package/dist/src/node_modules/.pnpm/@octokit_graphql@9.0.3/node_modules/@octokit/graphql/dist-bundle/index.mjs +90 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-paginate-rest@14.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.mjs +86 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-request-log@6.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-request-log/dist-src/index.mjs +22 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-request-log@6.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-request-log/dist-src/version.mjs +4 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-rest-endpoint-methods@17.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.mjs +94 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-rest-endpoint-methods@17.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.mjs +1295 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-rest-endpoint-methods@17.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.mjs +17 -0
- package/dist/src/node_modules/.pnpm/@octokit_plugin-rest-endpoint-methods@17.0.0_@octokit_core@7.0.6/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.mjs +4 -0
- package/dist/src/node_modules/.pnpm/@octokit_request-error@7.1.0/node_modules/@octokit/request-error/dist-src/index.mjs +30 -0
- package/dist/src/node_modules/.pnpm/@octokit_request@10.0.8/node_modules/@octokit/request/dist-bundle/index.mjs +146 -0
- package/dist/src/node_modules/.pnpm/@octokit_rest@22.0.1/node_modules/@octokit/rest/dist-src/index.mjs +9 -0
- package/dist/src/node_modules/.pnpm/@octokit_rest@22.0.1/node_modules/@octokit/rest/dist-src/version.mjs +4 -0
- package/dist/src/node_modules/.pnpm/@simple-git_args-pathspec@1.0.2/node_modules/@simple-git/args-pathspec/dist/index.mjs +14 -0
- package/dist/src/node_modules/.pnpm/@simple-git_argv-parser@1.0.3/node_modules/@simple-git/argv-parser/dist/index.mjs +369 -0
- package/dist/src/node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.mjs +13 -0
- package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/index.mjs +43 -0
- package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/add.mjs +28 -0
- package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/register.mjs +16 -0
- package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/remove.mjs +11 -0
- package/dist/src/node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.mjs +2135 -0
- package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.mjs +200 -0
- package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.mjs +206 -0
- package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.mjs +15 -0
- package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.mjs +212 -0
- package/dist/src/node_modules/.pnpm/decode-named-character-reference@1.3.0/node_modules/decode-named-character-reference/index.mjs +19 -0
- package/dist/src/node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.mjs +4 -0
- package/dist/src/node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.mjs +7 -0
- package/dist/src/node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.mjs +76 -0
- package/dist/src/node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.mjs +115 -0
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.mjs +138 -0
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.mjs +12 -0
- package/dist/src/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.mjs +12 -0
- package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.mjs +165 -0
- package/dist/src/node_modules/.pnpm/fault@2.0.1/node_modules/fault/index.mjs +38 -0
- package/dist/src/node_modules/.pnpm/format@0.2.2/node_modules/format/format.mjs +87 -0
- package/dist/src/node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.mjs +3125 -0
- package/dist/src/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.mjs +13 -0
- package/dist/src/node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.mjs +8 -0
- package/dist/src/node_modules/.pnpm/json-with-bigint@3.5.8/node_modules/json-with-bigint/json-with-bigint.mjs +137 -0
- package/dist/src/node_modules/.pnpm/localstorage-polyfill@1.0.1/node_modules/localstorage-polyfill/localStorage.mjs +39 -0
- package/dist/src/node_modules/.pnpm/longest-streak@3.1.0/node_modules/longest-streak/index.mjs +29 -0
- package/dist/src/node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/index.mjs +976 -0
- package/dist/src/node_modules/.pnpm/mdast-util-frontmatter@2.0.1/node_modules/mdast-util-frontmatter/lib/index.mjs +162 -0
- package/dist/src/node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.mjs +36 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/configure.mjs +48 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.mjs +27 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.mjs +20 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.mjs +62 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.mjs +61 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.mjs +51 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.mjs +47 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.mjs +20 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.mjs +50 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.mjs +69 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.mjs +47 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.mjs +40 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.mjs +50 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.mjs +93 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.mjs +35 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.mjs +48 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.mjs +22 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.mjs +20 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.mjs +51 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.mjs +17 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.mjs +19 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/index.mjs +161 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/join.mjs +18 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/unsafe.mjs +223 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/association.mjs +31 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.mjs +19 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-fence.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-quote.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-strong.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.mjs +16 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-flow.mjs +56 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.mjs +75 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.mjs +14 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-info.mjs +74 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.mjs +15 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.mjs +24 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.mjs +17 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/indent-lines.mjs +32 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.mjs +27 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/safe.mjs +116 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/track.mjs +59 -0
- package/dist/src/node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.mjs +83 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/attention.mjs +224 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/autolink.mjs +213 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.mjs +60 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/block-quote.mjs +130 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-escape.mjs +62 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-reference.mjs +141 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-fenced.mjs +418 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-indented.mjs +147 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-text.mjs +187 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/content.mjs +137 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/definition.mjs +223 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/hard-break-escape.mjs +59 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/heading-atx.mjs +189 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-flow.mjs +777 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-text.mjs +617 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-end.mjs +479 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-image.mjs +95 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-link.mjs +50 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/line-ending.mjs +32 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/list.mjs +177 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/setext-underline.mjs +155 -0
- package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/thematic-break.mjs +98 -0
- package/dist/src/node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/syntax.mjs +352 -0
- package/dist/src/node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/to-matters.mjs +109 -0
- package/dist/src/node_modules/.pnpm/micromark-factory-destination@2.0.1/node_modules/micromark-factory-destination/index.mjs +186 -0
- package/dist/src/node_modules/.pnpm/micromark-factory-label@2.0.1/node_modules/micromark-factory-label/index.mjs +134 -0
- package/dist/src/node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.mjs +61 -0
- package/dist/src/node_modules/.pnpm/micromark-factory-title@2.0.1/node_modules/micromark-factory-title/index.mjs +148 -0
- package/dist/src/node_modules/.pnpm/micromark-factory-whitespace@2.0.1/node_modules/micromark-factory-whitespace/index.mjs +43 -0
- package/dist/src/node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.mjs +229 -0
- package/dist/src/node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.mjs +71 -0
- package/dist/src/node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.mjs +25 -0
- package/dist/src/node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.mjs +73 -0
- package/dist/src/node_modules/.pnpm/micromark-util-decode-numeric-character-reference@2.0.2/node_modules/micromark-util-decode-numeric-character-reference/index.mjs +22 -0
- package/dist/src/node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.mjs +40 -0
- package/dist/src/node_modules/.pnpm/micromark-util-html-tag-name@2.0.1/node_modules/micromark-util-html-tag-name/index.mjs +100 -0
- package/dist/src/node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.mjs +25 -0
- package/dist/src/node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.mjs +31 -0
- package/dist/src/node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/index.mjs +158 -0
- package/dist/src/node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/lib/splice-buffer.mjs +231 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/constructs.mjs +101 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/create-tokenizer.mjs +473 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/content.mjs +70 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/document.mjs +220 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/flow.mjs +51 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/text.mjs +178 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/parse.mjs +52 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/postprocess.mjs +17 -0
- package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/preprocess.mjs +102 -0
- package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.mjs +121 -0
- package/dist/src/node_modules/.pnpm/remark-frontmatter@5.0.0/node_modules/remark-frontmatter/lib/index.mjs +35 -0
- package/dist/src/node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.mjs +37 -0
- package/dist/src/node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.mjs +36 -0
- package/dist/src/node_modules/.pnpm/simple-git@3.35.2/node_modules/simple-git/dist/esm/index.mjs +3563 -0
- package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.mjs +57 -0
- package/dist/src/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.mjs +72 -0
- package/dist/src/node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.mjs +157 -0
- package/dist/src/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.mjs +13 -0
- package/dist/src/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.mjs +1088 -0
- package/dist/src/node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.mjs +110 -0
- package/dist/src/node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.mjs +65 -0
- package/dist/src/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.mjs +10 -0
- package/dist/src/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.mjs +328 -0
- package/dist/src/node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.mjs +287 -0
- package/dist/src/node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.mjs +8 -0
- package/dist/src/node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/lib/index.mjs +247 -0
- package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.mjs +525 -0
- package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minpath.mjs +2 -0
- package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minproc.mjs +2 -0
- package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.mjs +3 -0
- package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.shared.mjs +24 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.mjs +62 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.mjs +49 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.mjs +98 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.mjs +66 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/composer.mjs +207 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.mjs +93 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.mjs +179 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.mjs +48 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.mjs +41 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.mjs +166 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.mjs +211 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.mjs +110 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.mjs +32 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.mjs +30 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.mjs +16 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.mjs +16 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/Document.mjs +295 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.mjs +67 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.mjs +43 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.mjs +69 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/directives.mjs +170 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/errors.mjs +56 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/index.mjs +67 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/log.mjs +17 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.mjs +101 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.mjs +127 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.mjs +40 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.mjs +40 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.mjs +33 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.mjs +118 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.mjs +115 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.mjs +59 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.mjs +53 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.mjs +41 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.mjs +274 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.mjs +54 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.mjs +94 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst.mjs +85 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.mjs +523 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.mjs +50 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/parser.mjs +861 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/public-api.mjs +97 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.mjs +36 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.mjs +22 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.mjs +19 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.mjs +22 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.mjs +19 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.mjs +23 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.mjs +46 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.mjs +45 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.mjs +34 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.mjs +68 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/tags.mjs +103 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.mjs +53 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.mjs +31 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.mjs +49 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.mjs +79 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.mjs +45 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.mjs +71 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.mjs +67 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.mjs +56 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.mjs +74 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.mjs +87 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.mjs +119 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.mjs +115 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.mjs +124 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.mjs +23 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.mjs +67 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.mjs +24 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.mjs +104 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.mjs +229 -0
- package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/visit.mjs +194 -0
- package/dist/src/node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.mjs +106 -0
- package/dist/src/pkg.d.mts +24 -0
- package/dist/src/pkg.mjs +39 -0
- package/dist/src/prepare.d.mts +14 -0
- package/dist/src/prepare.mjs +41 -0
- package/dist/src/publishers/npm.d.mts +21 -0
- package/dist/src/publishers/npm.mjs +42 -0
- package/dist/src/releasers/github.d.mts +10 -0
- package/dist/src/releasers/github.mjs +20 -0
- package/dist/src/saver.d.mts +42 -0
- package/dist/src/saver.mjs +39 -0
- package/dist/src/types.d.mts +150 -0
- package/dist/src/utils.d.mts +7 -0
- package/dist/src/utils.mjs +47 -0
- package/dist/src/version.d.mts +9 -0
- package/dist/src/version.mjs +18 -0
- package/package.json +156 -0
- package/templates/cngpac.config.ts +33 -0
- package/templates/version.yml +30 -0
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { require_cst } from "./cst.mjs";
|
|
3
|
+
import { require_lexer } from "./lexer.mjs";
|
|
4
|
+
//#region node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
5
|
+
var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
+
var node_process = __require("process");
|
|
7
|
+
var cst = require_cst();
|
|
8
|
+
var lexer = require_lexer();
|
|
9
|
+
function includesToken(list, type) {
|
|
10
|
+
for (let i = 0; i < list.length; ++i) if (list[i].type === type) return true;
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
function findNonEmptyIndex(list) {
|
|
14
|
+
for (let i = 0; i < list.length; ++i) switch (list[i].type) {
|
|
15
|
+
case "space":
|
|
16
|
+
case "comment":
|
|
17
|
+
case "newline": break;
|
|
18
|
+
default: return i;
|
|
19
|
+
}
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
22
|
+
function isFlowToken(token) {
|
|
23
|
+
switch (token?.type) {
|
|
24
|
+
case "alias":
|
|
25
|
+
case "scalar":
|
|
26
|
+
case "single-quoted-scalar":
|
|
27
|
+
case "double-quoted-scalar":
|
|
28
|
+
case "flow-collection": return true;
|
|
29
|
+
default: return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getPrevProps(parent) {
|
|
33
|
+
switch (parent.type) {
|
|
34
|
+
case "document": return parent.start;
|
|
35
|
+
case "block-map": {
|
|
36
|
+
const it = parent.items[parent.items.length - 1];
|
|
37
|
+
return it.sep ?? it.start;
|
|
38
|
+
}
|
|
39
|
+
case "block-seq": return parent.items[parent.items.length - 1].start;
|
|
40
|
+
default: return [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Note: May modify input array */
|
|
44
|
+
function getFirstKeyStartProps(prev) {
|
|
45
|
+
if (prev.length === 0) return [];
|
|
46
|
+
let i = prev.length;
|
|
47
|
+
loop: while (--i >= 0) switch (prev[i].type) {
|
|
48
|
+
case "doc-start":
|
|
49
|
+
case "explicit-key-ind":
|
|
50
|
+
case "map-value-ind":
|
|
51
|
+
case "seq-item-ind":
|
|
52
|
+
case "newline": break loop;
|
|
53
|
+
}
|
|
54
|
+
while (prev[++i]?.type === "space");
|
|
55
|
+
return prev.splice(i, prev.length);
|
|
56
|
+
}
|
|
57
|
+
function fixFlowSeqItems(fc) {
|
|
58
|
+
if (fc.start.type === "flow-seq-start") {
|
|
59
|
+
for (const it of fc.items) if (it.sep && !it.value && !includesToken(it.start, "explicit-key-ind") && !includesToken(it.sep, "map-value-ind")) {
|
|
60
|
+
if (it.key) it.value = it.key;
|
|
61
|
+
delete it.key;
|
|
62
|
+
if (isFlowToken(it.value)) if (it.value.end) Array.prototype.push.apply(it.value.end, it.sep);
|
|
63
|
+
else it.value.end = it.sep;
|
|
64
|
+
else Array.prototype.push.apply(it.start, it.sep);
|
|
65
|
+
delete it.sep;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A YAML concrete syntax tree (CST) parser
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* const src: string = ...
|
|
74
|
+
* for (const token of new Parser().parse(src)) {
|
|
75
|
+
* // token: Token
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* To use the parser with a user-provided lexer:
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* function* parse(source: string, lexer: Lexer) {
|
|
83
|
+
* const parser = new Parser()
|
|
84
|
+
* for (const lexeme of lexer.lex(source))
|
|
85
|
+
* yield* parser.next(lexeme)
|
|
86
|
+
* yield* parser.end()
|
|
87
|
+
* }
|
|
88
|
+
*
|
|
89
|
+
* const src: string = ...
|
|
90
|
+
* const lexer = new Lexer()
|
|
91
|
+
* for (const token of parse(src, lexer)) {
|
|
92
|
+
* // token: Token
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
var Parser = class {
|
|
97
|
+
/**
|
|
98
|
+
* @param onNewLine - If defined, called separately with the start position of
|
|
99
|
+
* each new line (in `parse()`, including the start of input).
|
|
100
|
+
*/
|
|
101
|
+
constructor(onNewLine) {
|
|
102
|
+
/** If true, space and sequence indicators count as indentation */
|
|
103
|
+
this.atNewLine = true;
|
|
104
|
+
/** If true, next token is a scalar value */
|
|
105
|
+
this.atScalar = false;
|
|
106
|
+
/** Current indentation level */
|
|
107
|
+
this.indent = 0;
|
|
108
|
+
/** Current offset since the start of parsing */
|
|
109
|
+
this.offset = 0;
|
|
110
|
+
/** On the same line with a block map key */
|
|
111
|
+
this.onKeyLine = false;
|
|
112
|
+
/** Top indicates the node that's currently being built */
|
|
113
|
+
this.stack = [];
|
|
114
|
+
/** The source of the current token, set in parse() */
|
|
115
|
+
this.source = "";
|
|
116
|
+
/** The type of the current token, set in parse() */
|
|
117
|
+
this.type = "";
|
|
118
|
+
this.lexer = new lexer.Lexer();
|
|
119
|
+
this.onNewLine = onNewLine;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parse `source` as a YAML stream.
|
|
123
|
+
* If `incomplete`, a part of the last line may be left as a buffer for the next call.
|
|
124
|
+
*
|
|
125
|
+
* Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
|
|
126
|
+
*
|
|
127
|
+
* @returns A generator of tokens representing each directive, document, and other structure.
|
|
128
|
+
*/
|
|
129
|
+
*parse(source, incomplete = false) {
|
|
130
|
+
if (this.onNewLine && this.offset === 0) this.onNewLine(0);
|
|
131
|
+
for (const lexeme of this.lexer.lex(source, incomplete)) yield* this.next(lexeme);
|
|
132
|
+
if (!incomplete) yield* this.end();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Advance the parser by the `source` of one lexical token.
|
|
136
|
+
*/
|
|
137
|
+
*next(source) {
|
|
138
|
+
this.source = source;
|
|
139
|
+
if (node_process.env.LOG_TOKENS) console.log("|", cst.prettyToken(source));
|
|
140
|
+
if (this.atScalar) {
|
|
141
|
+
this.atScalar = false;
|
|
142
|
+
yield* this.step();
|
|
143
|
+
this.offset += source.length;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const type = cst.tokenType(source);
|
|
147
|
+
if (!type) {
|
|
148
|
+
const message = `Not a YAML token: ${source}`;
|
|
149
|
+
yield* this.pop({
|
|
150
|
+
type: "error",
|
|
151
|
+
offset: this.offset,
|
|
152
|
+
message,
|
|
153
|
+
source
|
|
154
|
+
});
|
|
155
|
+
this.offset += source.length;
|
|
156
|
+
} else if (type === "scalar") {
|
|
157
|
+
this.atNewLine = false;
|
|
158
|
+
this.atScalar = true;
|
|
159
|
+
this.type = "scalar";
|
|
160
|
+
} else {
|
|
161
|
+
this.type = type;
|
|
162
|
+
yield* this.step();
|
|
163
|
+
switch (type) {
|
|
164
|
+
case "newline":
|
|
165
|
+
this.atNewLine = true;
|
|
166
|
+
this.indent = 0;
|
|
167
|
+
if (this.onNewLine) this.onNewLine(this.offset + source.length);
|
|
168
|
+
break;
|
|
169
|
+
case "space":
|
|
170
|
+
if (this.atNewLine && source[0] === " ") this.indent += source.length;
|
|
171
|
+
break;
|
|
172
|
+
case "explicit-key-ind":
|
|
173
|
+
case "map-value-ind":
|
|
174
|
+
case "seq-item-ind":
|
|
175
|
+
if (this.atNewLine) this.indent += source.length;
|
|
176
|
+
break;
|
|
177
|
+
case "doc-mode":
|
|
178
|
+
case "flow-error-end": return;
|
|
179
|
+
default: this.atNewLine = false;
|
|
180
|
+
}
|
|
181
|
+
this.offset += source.length;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/** Call at end of input to push out any remaining constructions */
|
|
185
|
+
*end() {
|
|
186
|
+
while (this.stack.length > 0) yield* this.pop();
|
|
187
|
+
}
|
|
188
|
+
get sourceToken() {
|
|
189
|
+
return {
|
|
190
|
+
type: this.type,
|
|
191
|
+
offset: this.offset,
|
|
192
|
+
indent: this.indent,
|
|
193
|
+
source: this.source
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
*step() {
|
|
197
|
+
const top = this.peek(1);
|
|
198
|
+
if (this.type === "doc-end" && top?.type !== "doc-end") {
|
|
199
|
+
while (this.stack.length > 0) yield* this.pop();
|
|
200
|
+
this.stack.push({
|
|
201
|
+
type: "doc-end",
|
|
202
|
+
offset: this.offset,
|
|
203
|
+
source: this.source
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (!top) return yield* this.stream();
|
|
208
|
+
switch (top.type) {
|
|
209
|
+
case "document": return yield* this.document(top);
|
|
210
|
+
case "alias":
|
|
211
|
+
case "scalar":
|
|
212
|
+
case "single-quoted-scalar":
|
|
213
|
+
case "double-quoted-scalar": return yield* this.scalar(top);
|
|
214
|
+
case "block-scalar": return yield* this.blockScalar(top);
|
|
215
|
+
case "block-map": return yield* this.blockMap(top);
|
|
216
|
+
case "block-seq": return yield* this.blockSequence(top);
|
|
217
|
+
case "flow-collection": return yield* this.flowCollection(top);
|
|
218
|
+
case "doc-end": return yield* this.documentEnd(top);
|
|
219
|
+
}
|
|
220
|
+
/* istanbul ignore next should not happen */
|
|
221
|
+
yield* this.pop();
|
|
222
|
+
}
|
|
223
|
+
peek(n) {
|
|
224
|
+
return this.stack[this.stack.length - n];
|
|
225
|
+
}
|
|
226
|
+
*pop(error) {
|
|
227
|
+
const token = error ?? this.stack.pop();
|
|
228
|
+
/* istanbul ignore if should not happen */
|
|
229
|
+
if (!token) yield {
|
|
230
|
+
type: "error",
|
|
231
|
+
offset: this.offset,
|
|
232
|
+
source: "",
|
|
233
|
+
message: "Tried to pop an empty stack"
|
|
234
|
+
};
|
|
235
|
+
else if (this.stack.length === 0) yield token;
|
|
236
|
+
else {
|
|
237
|
+
const top = this.peek(1);
|
|
238
|
+
if (token.type === "block-scalar") token.indent = "indent" in top ? top.indent : 0;
|
|
239
|
+
else if (token.type === "flow-collection" && top.type === "document") token.indent = 0;
|
|
240
|
+
if (token.type === "flow-collection") fixFlowSeqItems(token);
|
|
241
|
+
switch (top.type) {
|
|
242
|
+
case "document":
|
|
243
|
+
top.value = token;
|
|
244
|
+
break;
|
|
245
|
+
case "block-scalar":
|
|
246
|
+
top.props.push(token);
|
|
247
|
+
break;
|
|
248
|
+
case "block-map": {
|
|
249
|
+
const it = top.items[top.items.length - 1];
|
|
250
|
+
if (it.value) {
|
|
251
|
+
top.items.push({
|
|
252
|
+
start: [],
|
|
253
|
+
key: token,
|
|
254
|
+
sep: []
|
|
255
|
+
});
|
|
256
|
+
this.onKeyLine = true;
|
|
257
|
+
return;
|
|
258
|
+
} else if (it.sep) it.value = token;
|
|
259
|
+
else {
|
|
260
|
+
Object.assign(it, {
|
|
261
|
+
key: token,
|
|
262
|
+
sep: []
|
|
263
|
+
});
|
|
264
|
+
this.onKeyLine = !it.explicitKey;
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
case "block-seq": {
|
|
270
|
+
const it = top.items[top.items.length - 1];
|
|
271
|
+
if (it.value) top.items.push({
|
|
272
|
+
start: [],
|
|
273
|
+
value: token
|
|
274
|
+
});
|
|
275
|
+
else it.value = token;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
case "flow-collection": {
|
|
279
|
+
const it = top.items[top.items.length - 1];
|
|
280
|
+
if (!it || it.value) top.items.push({
|
|
281
|
+
start: [],
|
|
282
|
+
key: token,
|
|
283
|
+
sep: []
|
|
284
|
+
});
|
|
285
|
+
else if (it.sep) it.value = token;
|
|
286
|
+
else Object.assign(it, {
|
|
287
|
+
key: token,
|
|
288
|
+
sep: []
|
|
289
|
+
});
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
default:
|
|
293
|
+
yield* this.pop();
|
|
294
|
+
yield* this.pop(token);
|
|
295
|
+
}
|
|
296
|
+
if ((top.type === "document" || top.type === "block-map" || top.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) {
|
|
297
|
+
const last = token.items[token.items.length - 1];
|
|
298
|
+
if (last && !last.sep && !last.value && last.start.length > 0 && findNonEmptyIndex(last.start) === -1 && (token.indent === 0 || last.start.every((st) => st.type !== "comment" || st.indent < token.indent))) {
|
|
299
|
+
if (top.type === "document") top.end = last.start;
|
|
300
|
+
else top.items.push({ start: last.start });
|
|
301
|
+
token.items.splice(-1, 1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
*stream() {
|
|
307
|
+
switch (this.type) {
|
|
308
|
+
case "directive-line":
|
|
309
|
+
yield {
|
|
310
|
+
type: "directive",
|
|
311
|
+
offset: this.offset,
|
|
312
|
+
source: this.source
|
|
313
|
+
};
|
|
314
|
+
return;
|
|
315
|
+
case "byte-order-mark":
|
|
316
|
+
case "space":
|
|
317
|
+
case "comment":
|
|
318
|
+
case "newline":
|
|
319
|
+
yield this.sourceToken;
|
|
320
|
+
return;
|
|
321
|
+
case "doc-mode":
|
|
322
|
+
case "doc-start": {
|
|
323
|
+
const doc = {
|
|
324
|
+
type: "document",
|
|
325
|
+
offset: this.offset,
|
|
326
|
+
start: []
|
|
327
|
+
};
|
|
328
|
+
if (this.type === "doc-start") doc.start.push(this.sourceToken);
|
|
329
|
+
this.stack.push(doc);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
yield {
|
|
334
|
+
type: "error",
|
|
335
|
+
offset: this.offset,
|
|
336
|
+
message: `Unexpected ${this.type} token in YAML stream`,
|
|
337
|
+
source: this.source
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
*document(doc) {
|
|
341
|
+
if (doc.value) return yield* this.lineEnd(doc);
|
|
342
|
+
switch (this.type) {
|
|
343
|
+
case "doc-start":
|
|
344
|
+
if (findNonEmptyIndex(doc.start) !== -1) {
|
|
345
|
+
yield* this.pop();
|
|
346
|
+
yield* this.step();
|
|
347
|
+
} else doc.start.push(this.sourceToken);
|
|
348
|
+
return;
|
|
349
|
+
case "anchor":
|
|
350
|
+
case "tag":
|
|
351
|
+
case "space":
|
|
352
|
+
case "comment":
|
|
353
|
+
case "newline":
|
|
354
|
+
doc.start.push(this.sourceToken);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const bv = this.startBlockValue(doc);
|
|
358
|
+
if (bv) this.stack.push(bv);
|
|
359
|
+
else yield {
|
|
360
|
+
type: "error",
|
|
361
|
+
offset: this.offset,
|
|
362
|
+
message: `Unexpected ${this.type} token in YAML document`,
|
|
363
|
+
source: this.source
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
*scalar(scalar) {
|
|
367
|
+
if (this.type === "map-value-ind") {
|
|
368
|
+
const start = getFirstKeyStartProps(getPrevProps(this.peek(2)));
|
|
369
|
+
let sep;
|
|
370
|
+
if (scalar.end) {
|
|
371
|
+
sep = scalar.end;
|
|
372
|
+
sep.push(this.sourceToken);
|
|
373
|
+
delete scalar.end;
|
|
374
|
+
} else sep = [this.sourceToken];
|
|
375
|
+
const map = {
|
|
376
|
+
type: "block-map",
|
|
377
|
+
offset: scalar.offset,
|
|
378
|
+
indent: scalar.indent,
|
|
379
|
+
items: [{
|
|
380
|
+
start,
|
|
381
|
+
key: scalar,
|
|
382
|
+
sep
|
|
383
|
+
}]
|
|
384
|
+
};
|
|
385
|
+
this.onKeyLine = true;
|
|
386
|
+
this.stack[this.stack.length - 1] = map;
|
|
387
|
+
} else yield* this.lineEnd(scalar);
|
|
388
|
+
}
|
|
389
|
+
*blockScalar(scalar) {
|
|
390
|
+
switch (this.type) {
|
|
391
|
+
case "space":
|
|
392
|
+
case "comment":
|
|
393
|
+
case "newline":
|
|
394
|
+
scalar.props.push(this.sourceToken);
|
|
395
|
+
return;
|
|
396
|
+
case "scalar":
|
|
397
|
+
scalar.source = this.source;
|
|
398
|
+
this.atNewLine = true;
|
|
399
|
+
this.indent = 0;
|
|
400
|
+
if (this.onNewLine) {
|
|
401
|
+
let nl = this.source.indexOf("\n") + 1;
|
|
402
|
+
while (nl !== 0) {
|
|
403
|
+
this.onNewLine(this.offset + nl);
|
|
404
|
+
nl = this.source.indexOf("\n", nl) + 1;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
yield* this.pop();
|
|
408
|
+
break;
|
|
409
|
+
default:
|
|
410
|
+
yield* this.pop();
|
|
411
|
+
yield* this.step();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
*blockMap(map) {
|
|
415
|
+
const it = map.items[map.items.length - 1];
|
|
416
|
+
switch (this.type) {
|
|
417
|
+
case "newline":
|
|
418
|
+
this.onKeyLine = false;
|
|
419
|
+
if (it.value) {
|
|
420
|
+
const end = "end" in it.value ? it.value.end : void 0;
|
|
421
|
+
if ((Array.isArray(end) ? end[end.length - 1] : void 0)?.type === "comment") end?.push(this.sourceToken);
|
|
422
|
+
else map.items.push({ start: [this.sourceToken] });
|
|
423
|
+
} else if (it.sep) it.sep.push(this.sourceToken);
|
|
424
|
+
else it.start.push(this.sourceToken);
|
|
425
|
+
return;
|
|
426
|
+
case "space":
|
|
427
|
+
case "comment":
|
|
428
|
+
if (it.value) map.items.push({ start: [this.sourceToken] });
|
|
429
|
+
else if (it.sep) it.sep.push(this.sourceToken);
|
|
430
|
+
else {
|
|
431
|
+
if (this.atIndentedComment(it.start, map.indent)) {
|
|
432
|
+
const end = map.items[map.items.length - 2]?.value?.end;
|
|
433
|
+
if (Array.isArray(end)) {
|
|
434
|
+
Array.prototype.push.apply(end, it.start);
|
|
435
|
+
end.push(this.sourceToken);
|
|
436
|
+
map.items.pop();
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
it.start.push(this.sourceToken);
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (this.indent >= map.indent) {
|
|
445
|
+
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
|
|
446
|
+
const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind";
|
|
447
|
+
let start = [];
|
|
448
|
+
if (atNextItem && it.sep && !it.value) {
|
|
449
|
+
const nl = [];
|
|
450
|
+
for (let i = 0; i < it.sep.length; ++i) {
|
|
451
|
+
const st = it.sep[i];
|
|
452
|
+
switch (st.type) {
|
|
453
|
+
case "newline":
|
|
454
|
+
nl.push(i);
|
|
455
|
+
break;
|
|
456
|
+
case "space": break;
|
|
457
|
+
case "comment":
|
|
458
|
+
if (st.indent > map.indent) nl.length = 0;
|
|
459
|
+
break;
|
|
460
|
+
default: nl.length = 0;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (nl.length >= 2) start = it.sep.splice(nl[1]);
|
|
464
|
+
}
|
|
465
|
+
switch (this.type) {
|
|
466
|
+
case "anchor":
|
|
467
|
+
case "tag":
|
|
468
|
+
if (atNextItem || it.value) {
|
|
469
|
+
start.push(this.sourceToken);
|
|
470
|
+
map.items.push({ start });
|
|
471
|
+
this.onKeyLine = true;
|
|
472
|
+
} else if (it.sep) it.sep.push(this.sourceToken);
|
|
473
|
+
else it.start.push(this.sourceToken);
|
|
474
|
+
return;
|
|
475
|
+
case "explicit-key-ind":
|
|
476
|
+
if (!it.sep && !it.explicitKey) {
|
|
477
|
+
it.start.push(this.sourceToken);
|
|
478
|
+
it.explicitKey = true;
|
|
479
|
+
} else if (atNextItem || it.value) {
|
|
480
|
+
start.push(this.sourceToken);
|
|
481
|
+
map.items.push({
|
|
482
|
+
start,
|
|
483
|
+
explicitKey: true
|
|
484
|
+
});
|
|
485
|
+
} else this.stack.push({
|
|
486
|
+
type: "block-map",
|
|
487
|
+
offset: this.offset,
|
|
488
|
+
indent: this.indent,
|
|
489
|
+
items: [{
|
|
490
|
+
start: [this.sourceToken],
|
|
491
|
+
explicitKey: true
|
|
492
|
+
}]
|
|
493
|
+
});
|
|
494
|
+
this.onKeyLine = true;
|
|
495
|
+
return;
|
|
496
|
+
case "map-value-ind":
|
|
497
|
+
if (it.explicitKey) if (!it.sep) if (includesToken(it.start, "newline")) Object.assign(it, {
|
|
498
|
+
key: null,
|
|
499
|
+
sep: [this.sourceToken]
|
|
500
|
+
});
|
|
501
|
+
else {
|
|
502
|
+
const start = getFirstKeyStartProps(it.start);
|
|
503
|
+
this.stack.push({
|
|
504
|
+
type: "block-map",
|
|
505
|
+
offset: this.offset,
|
|
506
|
+
indent: this.indent,
|
|
507
|
+
items: [{
|
|
508
|
+
start,
|
|
509
|
+
key: null,
|
|
510
|
+
sep: [this.sourceToken]
|
|
511
|
+
}]
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
else if (it.value) map.items.push({
|
|
515
|
+
start: [],
|
|
516
|
+
key: null,
|
|
517
|
+
sep: [this.sourceToken]
|
|
518
|
+
});
|
|
519
|
+
else if (includesToken(it.sep, "map-value-ind")) this.stack.push({
|
|
520
|
+
type: "block-map",
|
|
521
|
+
offset: this.offset,
|
|
522
|
+
indent: this.indent,
|
|
523
|
+
items: [{
|
|
524
|
+
start,
|
|
525
|
+
key: null,
|
|
526
|
+
sep: [this.sourceToken]
|
|
527
|
+
}]
|
|
528
|
+
});
|
|
529
|
+
else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
530
|
+
const start = getFirstKeyStartProps(it.start);
|
|
531
|
+
const key = it.key;
|
|
532
|
+
const sep = it.sep;
|
|
533
|
+
sep.push(this.sourceToken);
|
|
534
|
+
delete it.key;
|
|
535
|
+
delete it.sep;
|
|
536
|
+
this.stack.push({
|
|
537
|
+
type: "block-map",
|
|
538
|
+
offset: this.offset,
|
|
539
|
+
indent: this.indent,
|
|
540
|
+
items: [{
|
|
541
|
+
start,
|
|
542
|
+
key,
|
|
543
|
+
sep
|
|
544
|
+
}]
|
|
545
|
+
});
|
|
546
|
+
} else if (start.length > 0) it.sep = it.sep.concat(start, this.sourceToken);
|
|
547
|
+
else it.sep.push(this.sourceToken);
|
|
548
|
+
else if (!it.sep) Object.assign(it, {
|
|
549
|
+
key: null,
|
|
550
|
+
sep: [this.sourceToken]
|
|
551
|
+
});
|
|
552
|
+
else if (it.value || atNextItem) map.items.push({
|
|
553
|
+
start,
|
|
554
|
+
key: null,
|
|
555
|
+
sep: [this.sourceToken]
|
|
556
|
+
});
|
|
557
|
+
else if (includesToken(it.sep, "map-value-ind")) this.stack.push({
|
|
558
|
+
type: "block-map",
|
|
559
|
+
offset: this.offset,
|
|
560
|
+
indent: this.indent,
|
|
561
|
+
items: [{
|
|
562
|
+
start: [],
|
|
563
|
+
key: null,
|
|
564
|
+
sep: [this.sourceToken]
|
|
565
|
+
}]
|
|
566
|
+
});
|
|
567
|
+
else it.sep.push(this.sourceToken);
|
|
568
|
+
this.onKeyLine = true;
|
|
569
|
+
return;
|
|
570
|
+
case "alias":
|
|
571
|
+
case "scalar":
|
|
572
|
+
case "single-quoted-scalar":
|
|
573
|
+
case "double-quoted-scalar": {
|
|
574
|
+
const fs = this.flowScalar(this.type);
|
|
575
|
+
if (atNextItem || it.value) {
|
|
576
|
+
map.items.push({
|
|
577
|
+
start,
|
|
578
|
+
key: fs,
|
|
579
|
+
sep: []
|
|
580
|
+
});
|
|
581
|
+
this.onKeyLine = true;
|
|
582
|
+
} else if (it.sep) this.stack.push(fs);
|
|
583
|
+
else {
|
|
584
|
+
Object.assign(it, {
|
|
585
|
+
key: fs,
|
|
586
|
+
sep: []
|
|
587
|
+
});
|
|
588
|
+
this.onKeyLine = true;
|
|
589
|
+
}
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
default: {
|
|
593
|
+
const bv = this.startBlockValue(map);
|
|
594
|
+
if (bv) {
|
|
595
|
+
if (bv.type === "block-seq") {
|
|
596
|
+
if (!it.explicitKey && it.sep && !includesToken(it.sep, "newline")) {
|
|
597
|
+
yield* this.pop({
|
|
598
|
+
type: "error",
|
|
599
|
+
offset: this.offset,
|
|
600
|
+
message: "Unexpected block-seq-ind on same line with key",
|
|
601
|
+
source: this.source
|
|
602
|
+
});
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
} else if (atMapIndent) map.items.push({ start });
|
|
606
|
+
this.stack.push(bv);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
yield* this.pop();
|
|
613
|
+
yield* this.step();
|
|
614
|
+
}
|
|
615
|
+
*blockSequence(seq) {
|
|
616
|
+
const it = seq.items[seq.items.length - 1];
|
|
617
|
+
switch (this.type) {
|
|
618
|
+
case "newline":
|
|
619
|
+
if (it.value) {
|
|
620
|
+
const end = "end" in it.value ? it.value.end : void 0;
|
|
621
|
+
if ((Array.isArray(end) ? end[end.length - 1] : void 0)?.type === "comment") end?.push(this.sourceToken);
|
|
622
|
+
else seq.items.push({ start: [this.sourceToken] });
|
|
623
|
+
} else it.start.push(this.sourceToken);
|
|
624
|
+
return;
|
|
625
|
+
case "space":
|
|
626
|
+
case "comment":
|
|
627
|
+
if (it.value) seq.items.push({ start: [this.sourceToken] });
|
|
628
|
+
else {
|
|
629
|
+
if (this.atIndentedComment(it.start, seq.indent)) {
|
|
630
|
+
const end = seq.items[seq.items.length - 2]?.value?.end;
|
|
631
|
+
if (Array.isArray(end)) {
|
|
632
|
+
Array.prototype.push.apply(end, it.start);
|
|
633
|
+
end.push(this.sourceToken);
|
|
634
|
+
seq.items.pop();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
it.start.push(this.sourceToken);
|
|
639
|
+
}
|
|
640
|
+
return;
|
|
641
|
+
case "anchor":
|
|
642
|
+
case "tag":
|
|
643
|
+
if (it.value || this.indent <= seq.indent) break;
|
|
644
|
+
it.start.push(this.sourceToken);
|
|
645
|
+
return;
|
|
646
|
+
case "seq-item-ind":
|
|
647
|
+
if (this.indent !== seq.indent) break;
|
|
648
|
+
if (it.value || includesToken(it.start, "seq-item-ind")) seq.items.push({ start: [this.sourceToken] });
|
|
649
|
+
else it.start.push(this.sourceToken);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
if (this.indent > seq.indent) {
|
|
653
|
+
const bv = this.startBlockValue(seq);
|
|
654
|
+
if (bv) {
|
|
655
|
+
this.stack.push(bv);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
yield* this.pop();
|
|
660
|
+
yield* this.step();
|
|
661
|
+
}
|
|
662
|
+
*flowCollection(fc) {
|
|
663
|
+
const it = fc.items[fc.items.length - 1];
|
|
664
|
+
if (this.type === "flow-error-end") {
|
|
665
|
+
let top;
|
|
666
|
+
do {
|
|
667
|
+
yield* this.pop();
|
|
668
|
+
top = this.peek(1);
|
|
669
|
+
} while (top?.type === "flow-collection");
|
|
670
|
+
} else if (fc.end.length === 0) {
|
|
671
|
+
switch (this.type) {
|
|
672
|
+
case "comma":
|
|
673
|
+
case "explicit-key-ind":
|
|
674
|
+
if (!it || it.sep) fc.items.push({ start: [this.sourceToken] });
|
|
675
|
+
else it.start.push(this.sourceToken);
|
|
676
|
+
return;
|
|
677
|
+
case "map-value-ind":
|
|
678
|
+
if (!it || it.value) fc.items.push({
|
|
679
|
+
start: [],
|
|
680
|
+
key: null,
|
|
681
|
+
sep: [this.sourceToken]
|
|
682
|
+
});
|
|
683
|
+
else if (it.sep) it.sep.push(this.sourceToken);
|
|
684
|
+
else Object.assign(it, {
|
|
685
|
+
key: null,
|
|
686
|
+
sep: [this.sourceToken]
|
|
687
|
+
});
|
|
688
|
+
return;
|
|
689
|
+
case "space":
|
|
690
|
+
case "comment":
|
|
691
|
+
case "newline":
|
|
692
|
+
case "anchor":
|
|
693
|
+
case "tag":
|
|
694
|
+
if (!it || it.value) fc.items.push({ start: [this.sourceToken] });
|
|
695
|
+
else if (it.sep) it.sep.push(this.sourceToken);
|
|
696
|
+
else it.start.push(this.sourceToken);
|
|
697
|
+
return;
|
|
698
|
+
case "alias":
|
|
699
|
+
case "scalar":
|
|
700
|
+
case "single-quoted-scalar":
|
|
701
|
+
case "double-quoted-scalar": {
|
|
702
|
+
const fs = this.flowScalar(this.type);
|
|
703
|
+
if (!it || it.value) fc.items.push({
|
|
704
|
+
start: [],
|
|
705
|
+
key: fs,
|
|
706
|
+
sep: []
|
|
707
|
+
});
|
|
708
|
+
else if (it.sep) this.stack.push(fs);
|
|
709
|
+
else Object.assign(it, {
|
|
710
|
+
key: fs,
|
|
711
|
+
sep: []
|
|
712
|
+
});
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
case "flow-map-end":
|
|
716
|
+
case "flow-seq-end":
|
|
717
|
+
fc.end.push(this.sourceToken);
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
const bv = this.startBlockValue(fc);
|
|
721
|
+
/* istanbul ignore else should not happen */
|
|
722
|
+
if (bv) this.stack.push(bv);
|
|
723
|
+
else {
|
|
724
|
+
yield* this.pop();
|
|
725
|
+
yield* this.step();
|
|
726
|
+
}
|
|
727
|
+
} else {
|
|
728
|
+
const parent = this.peek(2);
|
|
729
|
+
if (parent.type === "block-map" && (this.type === "map-value-ind" && parent.indent === fc.indent || this.type === "newline" && !parent.items[parent.items.length - 1].sep)) {
|
|
730
|
+
yield* this.pop();
|
|
731
|
+
yield* this.step();
|
|
732
|
+
} else if (this.type === "map-value-ind" && parent.type !== "flow-collection") {
|
|
733
|
+
const start = getFirstKeyStartProps(getPrevProps(parent));
|
|
734
|
+
fixFlowSeqItems(fc);
|
|
735
|
+
const sep = fc.end.splice(1, fc.end.length);
|
|
736
|
+
sep.push(this.sourceToken);
|
|
737
|
+
const map = {
|
|
738
|
+
type: "block-map",
|
|
739
|
+
offset: fc.offset,
|
|
740
|
+
indent: fc.indent,
|
|
741
|
+
items: [{
|
|
742
|
+
start,
|
|
743
|
+
key: fc,
|
|
744
|
+
sep
|
|
745
|
+
}]
|
|
746
|
+
};
|
|
747
|
+
this.onKeyLine = true;
|
|
748
|
+
this.stack[this.stack.length - 1] = map;
|
|
749
|
+
} else yield* this.lineEnd(fc);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
flowScalar(type) {
|
|
753
|
+
if (this.onNewLine) {
|
|
754
|
+
let nl = this.source.indexOf("\n") + 1;
|
|
755
|
+
while (nl !== 0) {
|
|
756
|
+
this.onNewLine(this.offset + nl);
|
|
757
|
+
nl = this.source.indexOf("\n", nl) + 1;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
type,
|
|
762
|
+
offset: this.offset,
|
|
763
|
+
indent: this.indent,
|
|
764
|
+
source: this.source
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
startBlockValue(parent) {
|
|
768
|
+
switch (this.type) {
|
|
769
|
+
case "alias":
|
|
770
|
+
case "scalar":
|
|
771
|
+
case "single-quoted-scalar":
|
|
772
|
+
case "double-quoted-scalar": return this.flowScalar(this.type);
|
|
773
|
+
case "block-scalar-header": return {
|
|
774
|
+
type: "block-scalar",
|
|
775
|
+
offset: this.offset,
|
|
776
|
+
indent: this.indent,
|
|
777
|
+
props: [this.sourceToken],
|
|
778
|
+
source: ""
|
|
779
|
+
};
|
|
780
|
+
case "flow-map-start":
|
|
781
|
+
case "flow-seq-start": return {
|
|
782
|
+
type: "flow-collection",
|
|
783
|
+
offset: this.offset,
|
|
784
|
+
indent: this.indent,
|
|
785
|
+
start: this.sourceToken,
|
|
786
|
+
items: [],
|
|
787
|
+
end: []
|
|
788
|
+
};
|
|
789
|
+
case "seq-item-ind": return {
|
|
790
|
+
type: "block-seq",
|
|
791
|
+
offset: this.offset,
|
|
792
|
+
indent: this.indent,
|
|
793
|
+
items: [{ start: [this.sourceToken] }]
|
|
794
|
+
};
|
|
795
|
+
case "explicit-key-ind": {
|
|
796
|
+
this.onKeyLine = true;
|
|
797
|
+
const start = getFirstKeyStartProps(getPrevProps(parent));
|
|
798
|
+
start.push(this.sourceToken);
|
|
799
|
+
return {
|
|
800
|
+
type: "block-map",
|
|
801
|
+
offset: this.offset,
|
|
802
|
+
indent: this.indent,
|
|
803
|
+
items: [{
|
|
804
|
+
start,
|
|
805
|
+
explicitKey: true
|
|
806
|
+
}]
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
case "map-value-ind": {
|
|
810
|
+
this.onKeyLine = true;
|
|
811
|
+
const start = getFirstKeyStartProps(getPrevProps(parent));
|
|
812
|
+
return {
|
|
813
|
+
type: "block-map",
|
|
814
|
+
offset: this.offset,
|
|
815
|
+
indent: this.indent,
|
|
816
|
+
items: [{
|
|
817
|
+
start,
|
|
818
|
+
key: null,
|
|
819
|
+
sep: [this.sourceToken]
|
|
820
|
+
}]
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
atIndentedComment(start, indent) {
|
|
827
|
+
if (this.type !== "comment") return false;
|
|
828
|
+
if (this.indent <= indent) return false;
|
|
829
|
+
return start.every((st) => st.type === "newline" || st.type === "space");
|
|
830
|
+
}
|
|
831
|
+
*documentEnd(docEnd) {
|
|
832
|
+
if (this.type !== "doc-mode") {
|
|
833
|
+
if (docEnd.end) docEnd.end.push(this.sourceToken);
|
|
834
|
+
else docEnd.end = [this.sourceToken];
|
|
835
|
+
if (this.type === "newline") yield* this.pop();
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
*lineEnd(token) {
|
|
839
|
+
switch (this.type) {
|
|
840
|
+
case "comma":
|
|
841
|
+
case "doc-start":
|
|
842
|
+
case "doc-end":
|
|
843
|
+
case "flow-seq-end":
|
|
844
|
+
case "flow-map-end":
|
|
845
|
+
case "map-value-ind":
|
|
846
|
+
yield* this.pop();
|
|
847
|
+
yield* this.step();
|
|
848
|
+
break;
|
|
849
|
+
case "newline": this.onKeyLine = false;
|
|
850
|
+
default:
|
|
851
|
+
if (token.end) token.end.push(this.sourceToken);
|
|
852
|
+
else token.end = [this.sourceToken];
|
|
853
|
+
if (this.type === "newline") yield* this.pop();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
exports.Parser = Parser;
|
|
858
|
+
}));
|
|
859
|
+
//#endregion
|
|
860
|
+
export default require_parser();
|
|
861
|
+
export { require_parser };
|