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,976 @@
|
|
|
1
|
+
import { toString } from "../../../../mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.mjs";
|
|
2
|
+
import { decodeNamedCharacterReference } from "../../../../decode-named-character-reference@1.3.0/node_modules/decode-named-character-reference/index.mjs";
|
|
3
|
+
import { decodeNumericCharacterReference } from "../../../../micromark-util-decode-numeric-character-reference@2.0.2/node_modules/micromark-util-decode-numeric-character-reference/index.mjs";
|
|
4
|
+
import { normalizeIdentifier } from "../../../../micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.mjs";
|
|
5
|
+
import { parse } from "../../../../micromark@4.0.2/node_modules/micromark/lib/parse.mjs";
|
|
6
|
+
import { postprocess } from "../../../../micromark@4.0.2/node_modules/micromark/lib/postprocess.mjs";
|
|
7
|
+
import { preprocess } from "../../../../micromark@4.0.2/node_modules/micromark/lib/preprocess.mjs";
|
|
8
|
+
import { decodeString } from "../../../../micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.mjs";
|
|
9
|
+
import { stringifyPosition } from "../../../../unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.mjs";
|
|
10
|
+
//#region node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/index.js
|
|
11
|
+
/**
|
|
12
|
+
* @import {
|
|
13
|
+
* Break,
|
|
14
|
+
* Blockquote,
|
|
15
|
+
* Code,
|
|
16
|
+
* Definition,
|
|
17
|
+
* Emphasis,
|
|
18
|
+
* Heading,
|
|
19
|
+
* Html,
|
|
20
|
+
* Image,
|
|
21
|
+
* InlineCode,
|
|
22
|
+
* Link,
|
|
23
|
+
* ListItem,
|
|
24
|
+
* List,
|
|
25
|
+
* Nodes,
|
|
26
|
+
* Paragraph,
|
|
27
|
+
* PhrasingContent,
|
|
28
|
+
* ReferenceType,
|
|
29
|
+
* Root,
|
|
30
|
+
* Strong,
|
|
31
|
+
* Text,
|
|
32
|
+
* ThematicBreak
|
|
33
|
+
* } from 'mdast'
|
|
34
|
+
* @import {
|
|
35
|
+
* Encoding,
|
|
36
|
+
* Event,
|
|
37
|
+
* Token,
|
|
38
|
+
* Value
|
|
39
|
+
* } from 'micromark-util-types'
|
|
40
|
+
* @import {Point} from 'unist'
|
|
41
|
+
* @import {
|
|
42
|
+
* CompileContext,
|
|
43
|
+
* CompileData,
|
|
44
|
+
* Config,
|
|
45
|
+
* Extension,
|
|
46
|
+
* Handle,
|
|
47
|
+
* OnEnterError,
|
|
48
|
+
* Options
|
|
49
|
+
* } from './types.js'
|
|
50
|
+
*/
|
|
51
|
+
const own = {}.hasOwnProperty;
|
|
52
|
+
/**
|
|
53
|
+
* Turn markdown into a syntax tree.
|
|
54
|
+
*
|
|
55
|
+
* @overload
|
|
56
|
+
* @param {Value} value
|
|
57
|
+
* @param {Encoding | null | undefined} [encoding]
|
|
58
|
+
* @param {Options | null | undefined} [options]
|
|
59
|
+
* @returns {Root}
|
|
60
|
+
*
|
|
61
|
+
* @overload
|
|
62
|
+
* @param {Value} value
|
|
63
|
+
* @param {Options | null | undefined} [options]
|
|
64
|
+
* @returns {Root}
|
|
65
|
+
*
|
|
66
|
+
* @param {Value} value
|
|
67
|
+
* Markdown to parse.
|
|
68
|
+
* @param {Encoding | Options | null | undefined} [encoding]
|
|
69
|
+
* Character encoding for when `value` is `Buffer`.
|
|
70
|
+
* @param {Options | null | undefined} [options]
|
|
71
|
+
* Configuration.
|
|
72
|
+
* @returns {Root}
|
|
73
|
+
* mdast tree.
|
|
74
|
+
*/
|
|
75
|
+
function fromMarkdown(value, encoding, options) {
|
|
76
|
+
if (encoding && typeof encoding === "object") {
|
|
77
|
+
options = encoding;
|
|
78
|
+
encoding = void 0;
|
|
79
|
+
}
|
|
80
|
+
return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Note this compiler only understand complete buffering, not streaming.
|
|
84
|
+
*
|
|
85
|
+
* @param {Options | null | undefined} [options]
|
|
86
|
+
*/
|
|
87
|
+
function compiler(options) {
|
|
88
|
+
/** @type {Config} */
|
|
89
|
+
const config = {
|
|
90
|
+
transforms: [],
|
|
91
|
+
canContainEols: [
|
|
92
|
+
"emphasis",
|
|
93
|
+
"fragment",
|
|
94
|
+
"heading",
|
|
95
|
+
"paragraph",
|
|
96
|
+
"strong"
|
|
97
|
+
],
|
|
98
|
+
enter: {
|
|
99
|
+
autolink: opener(link),
|
|
100
|
+
autolinkProtocol: onenterdata,
|
|
101
|
+
autolinkEmail: onenterdata,
|
|
102
|
+
atxHeading: opener(heading),
|
|
103
|
+
blockQuote: opener(blockQuote),
|
|
104
|
+
characterEscape: onenterdata,
|
|
105
|
+
characterReference: onenterdata,
|
|
106
|
+
codeFenced: opener(codeFlow),
|
|
107
|
+
codeFencedFenceInfo: buffer,
|
|
108
|
+
codeFencedFenceMeta: buffer,
|
|
109
|
+
codeIndented: opener(codeFlow, buffer),
|
|
110
|
+
codeText: opener(codeText, buffer),
|
|
111
|
+
codeTextData: onenterdata,
|
|
112
|
+
data: onenterdata,
|
|
113
|
+
codeFlowValue: onenterdata,
|
|
114
|
+
definition: opener(definition),
|
|
115
|
+
definitionDestinationString: buffer,
|
|
116
|
+
definitionLabelString: buffer,
|
|
117
|
+
definitionTitleString: buffer,
|
|
118
|
+
emphasis: opener(emphasis),
|
|
119
|
+
hardBreakEscape: opener(hardBreak),
|
|
120
|
+
hardBreakTrailing: opener(hardBreak),
|
|
121
|
+
htmlFlow: opener(html, buffer),
|
|
122
|
+
htmlFlowData: onenterdata,
|
|
123
|
+
htmlText: opener(html, buffer),
|
|
124
|
+
htmlTextData: onenterdata,
|
|
125
|
+
image: opener(image),
|
|
126
|
+
label: buffer,
|
|
127
|
+
link: opener(link),
|
|
128
|
+
listItem: opener(listItem),
|
|
129
|
+
listItemValue: onenterlistitemvalue,
|
|
130
|
+
listOrdered: opener(list, onenterlistordered),
|
|
131
|
+
listUnordered: opener(list),
|
|
132
|
+
paragraph: opener(paragraph),
|
|
133
|
+
reference: onenterreference,
|
|
134
|
+
referenceString: buffer,
|
|
135
|
+
resourceDestinationString: buffer,
|
|
136
|
+
resourceTitleString: buffer,
|
|
137
|
+
setextHeading: opener(heading),
|
|
138
|
+
strong: opener(strong),
|
|
139
|
+
thematicBreak: opener(thematicBreak)
|
|
140
|
+
},
|
|
141
|
+
exit: {
|
|
142
|
+
atxHeading: closer(),
|
|
143
|
+
atxHeadingSequence: onexitatxheadingsequence,
|
|
144
|
+
autolink: closer(),
|
|
145
|
+
autolinkEmail: onexitautolinkemail,
|
|
146
|
+
autolinkProtocol: onexitautolinkprotocol,
|
|
147
|
+
blockQuote: closer(),
|
|
148
|
+
characterEscapeValue: onexitdata,
|
|
149
|
+
characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
|
|
150
|
+
characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
|
|
151
|
+
characterReferenceValue: onexitcharacterreferencevalue,
|
|
152
|
+
characterReference: onexitcharacterreference,
|
|
153
|
+
codeFenced: closer(onexitcodefenced),
|
|
154
|
+
codeFencedFence: onexitcodefencedfence,
|
|
155
|
+
codeFencedFenceInfo: onexitcodefencedfenceinfo,
|
|
156
|
+
codeFencedFenceMeta: onexitcodefencedfencemeta,
|
|
157
|
+
codeFlowValue: onexitdata,
|
|
158
|
+
codeIndented: closer(onexitcodeindented),
|
|
159
|
+
codeText: closer(onexitcodetext),
|
|
160
|
+
codeTextData: onexitdata,
|
|
161
|
+
data: onexitdata,
|
|
162
|
+
definition: closer(),
|
|
163
|
+
definitionDestinationString: onexitdefinitiondestinationstring,
|
|
164
|
+
definitionLabelString: onexitdefinitionlabelstring,
|
|
165
|
+
definitionTitleString: onexitdefinitiontitlestring,
|
|
166
|
+
emphasis: closer(),
|
|
167
|
+
hardBreakEscape: closer(onexithardbreak),
|
|
168
|
+
hardBreakTrailing: closer(onexithardbreak),
|
|
169
|
+
htmlFlow: closer(onexithtmlflow),
|
|
170
|
+
htmlFlowData: onexitdata,
|
|
171
|
+
htmlText: closer(onexithtmltext),
|
|
172
|
+
htmlTextData: onexitdata,
|
|
173
|
+
image: closer(onexitimage),
|
|
174
|
+
label: onexitlabel,
|
|
175
|
+
labelText: onexitlabeltext,
|
|
176
|
+
lineEnding: onexitlineending,
|
|
177
|
+
link: closer(onexitlink),
|
|
178
|
+
listItem: closer(),
|
|
179
|
+
listOrdered: closer(),
|
|
180
|
+
listUnordered: closer(),
|
|
181
|
+
paragraph: closer(),
|
|
182
|
+
referenceString: onexitreferencestring,
|
|
183
|
+
resourceDestinationString: onexitresourcedestinationstring,
|
|
184
|
+
resourceTitleString: onexitresourcetitlestring,
|
|
185
|
+
resource: onexitresource,
|
|
186
|
+
setextHeading: closer(onexitsetextheading),
|
|
187
|
+
setextHeadingLineSequence: onexitsetextheadinglinesequence,
|
|
188
|
+
setextHeadingText: onexitsetextheadingtext,
|
|
189
|
+
strong: closer(),
|
|
190
|
+
thematicBreak: closer()
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
configure(config, (options || {}).mdastExtensions || []);
|
|
194
|
+
/** @type {CompileData} */
|
|
195
|
+
const data = {};
|
|
196
|
+
return compile;
|
|
197
|
+
/**
|
|
198
|
+
* Turn micromark events into an mdast tree.
|
|
199
|
+
*
|
|
200
|
+
* @param {Array<Event>} events
|
|
201
|
+
* Events.
|
|
202
|
+
* @returns {Root}
|
|
203
|
+
* mdast tree.
|
|
204
|
+
*/
|
|
205
|
+
function compile(events) {
|
|
206
|
+
/** @type {Root} */
|
|
207
|
+
let tree = {
|
|
208
|
+
type: "root",
|
|
209
|
+
children: []
|
|
210
|
+
};
|
|
211
|
+
/** @type {Omit<CompileContext, 'sliceSerialize'>} */
|
|
212
|
+
const context = {
|
|
213
|
+
stack: [tree],
|
|
214
|
+
tokenStack: [],
|
|
215
|
+
config,
|
|
216
|
+
enter,
|
|
217
|
+
exit,
|
|
218
|
+
buffer,
|
|
219
|
+
resume,
|
|
220
|
+
data
|
|
221
|
+
};
|
|
222
|
+
/** @type {Array<number>} */
|
|
223
|
+
const listStack = [];
|
|
224
|
+
let index = -1;
|
|
225
|
+
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") if (events[index][0] === "enter") listStack.push(index);
|
|
226
|
+
else index = prepareList(events, listStack.pop(), index);
|
|
227
|
+
index = -1;
|
|
228
|
+
while (++index < events.length) {
|
|
229
|
+
const handler = config[events[index][0]];
|
|
230
|
+
if (own.call(handler, events[index][1].type)) handler[events[index][1].type].call(Object.assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
|
|
231
|
+
}
|
|
232
|
+
if (context.tokenStack.length > 0) {
|
|
233
|
+
const tail = context.tokenStack[context.tokenStack.length - 1];
|
|
234
|
+
(tail[1] || defaultOnError).call(context, void 0, tail[0]);
|
|
235
|
+
}
|
|
236
|
+
tree.position = {
|
|
237
|
+
start: point(events.length > 0 ? events[0][1].start : {
|
|
238
|
+
line: 1,
|
|
239
|
+
column: 1,
|
|
240
|
+
offset: 0
|
|
241
|
+
}),
|
|
242
|
+
end: point(events.length > 0 ? events[events.length - 2][1].end : {
|
|
243
|
+
line: 1,
|
|
244
|
+
column: 1,
|
|
245
|
+
offset: 0
|
|
246
|
+
})
|
|
247
|
+
};
|
|
248
|
+
index = -1;
|
|
249
|
+
while (++index < config.transforms.length) tree = config.transforms[index](tree) || tree;
|
|
250
|
+
return tree;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @param {Array<Event>} events
|
|
254
|
+
* @param {number} start
|
|
255
|
+
* @param {number} length
|
|
256
|
+
* @returns {number}
|
|
257
|
+
*/
|
|
258
|
+
function prepareList(events, start, length) {
|
|
259
|
+
let index = start - 1;
|
|
260
|
+
let containerBalance = -1;
|
|
261
|
+
let listSpread = false;
|
|
262
|
+
/** @type {Token | undefined} */
|
|
263
|
+
let listItem;
|
|
264
|
+
/** @type {number | undefined} */
|
|
265
|
+
let lineIndex;
|
|
266
|
+
/** @type {number | undefined} */
|
|
267
|
+
let firstBlankLineIndex;
|
|
268
|
+
/** @type {boolean | undefined} */
|
|
269
|
+
let atMarker;
|
|
270
|
+
while (++index <= length) {
|
|
271
|
+
const event = events[index];
|
|
272
|
+
switch (event[1].type) {
|
|
273
|
+
case "listUnordered":
|
|
274
|
+
case "listOrdered":
|
|
275
|
+
case "blockQuote":
|
|
276
|
+
if (event[0] === "enter") containerBalance++;
|
|
277
|
+
else containerBalance--;
|
|
278
|
+
atMarker = void 0;
|
|
279
|
+
break;
|
|
280
|
+
case "lineEndingBlank":
|
|
281
|
+
if (event[0] === "enter") {
|
|
282
|
+
if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) firstBlankLineIndex = index;
|
|
283
|
+
atMarker = void 0;
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case "linePrefix":
|
|
287
|
+
case "listItemValue":
|
|
288
|
+
case "listItemMarker":
|
|
289
|
+
case "listItemPrefix":
|
|
290
|
+
case "listItemPrefixWhitespace": break;
|
|
291
|
+
default: atMarker = void 0;
|
|
292
|
+
}
|
|
293
|
+
if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
|
|
294
|
+
if (listItem) {
|
|
295
|
+
let tailIndex = index;
|
|
296
|
+
lineIndex = void 0;
|
|
297
|
+
while (tailIndex--) {
|
|
298
|
+
const tailEvent = events[tailIndex];
|
|
299
|
+
if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
|
|
300
|
+
if (tailEvent[0] === "exit") continue;
|
|
301
|
+
if (lineIndex) {
|
|
302
|
+
events[lineIndex][1].type = "lineEndingBlank";
|
|
303
|
+
listSpread = true;
|
|
304
|
+
}
|
|
305
|
+
tailEvent[1].type = "lineEnding";
|
|
306
|
+
lineIndex = tailIndex;
|
|
307
|
+
} else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {} else break;
|
|
308
|
+
}
|
|
309
|
+
if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) listItem._spread = true;
|
|
310
|
+
listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
|
|
311
|
+
events.splice(lineIndex || index, 0, [
|
|
312
|
+
"exit",
|
|
313
|
+
listItem,
|
|
314
|
+
event[2]
|
|
315
|
+
]);
|
|
316
|
+
index++;
|
|
317
|
+
length++;
|
|
318
|
+
}
|
|
319
|
+
if (event[1].type === "listItemPrefix") {
|
|
320
|
+
/** @type {Token} */
|
|
321
|
+
const item = {
|
|
322
|
+
type: "listItem",
|
|
323
|
+
_spread: false,
|
|
324
|
+
start: Object.assign({}, event[1].start),
|
|
325
|
+
end: void 0
|
|
326
|
+
};
|
|
327
|
+
listItem = item;
|
|
328
|
+
events.splice(index, 0, [
|
|
329
|
+
"enter",
|
|
330
|
+
item,
|
|
331
|
+
event[2]
|
|
332
|
+
]);
|
|
333
|
+
index++;
|
|
334
|
+
length++;
|
|
335
|
+
firstBlankLineIndex = void 0;
|
|
336
|
+
atMarker = true;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
events[start][1]._spread = listSpread;
|
|
341
|
+
return length;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Create an opener handle.
|
|
345
|
+
*
|
|
346
|
+
* @param {(token: Token) => Nodes} create
|
|
347
|
+
* Create a node.
|
|
348
|
+
* @param {Handle | undefined} [and]
|
|
349
|
+
* Optional function to also run.
|
|
350
|
+
* @returns {Handle}
|
|
351
|
+
* Handle.
|
|
352
|
+
*/
|
|
353
|
+
function opener(create, and) {
|
|
354
|
+
return open;
|
|
355
|
+
/**
|
|
356
|
+
* @this {CompileContext}
|
|
357
|
+
* @param {Token} token
|
|
358
|
+
* @returns {undefined}
|
|
359
|
+
*/
|
|
360
|
+
function open(token) {
|
|
361
|
+
enter.call(this, create(token), token);
|
|
362
|
+
if (and) and.call(this, token);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @type {CompileContext['buffer']}
|
|
367
|
+
*/
|
|
368
|
+
function buffer() {
|
|
369
|
+
this.stack.push({
|
|
370
|
+
type: "fragment",
|
|
371
|
+
children: []
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* @type {CompileContext['enter']}
|
|
376
|
+
*/
|
|
377
|
+
function enter(node, token, errorHandler) {
|
|
378
|
+
this.stack[this.stack.length - 1].children.push(node);
|
|
379
|
+
this.stack.push(node);
|
|
380
|
+
this.tokenStack.push([token, errorHandler || void 0]);
|
|
381
|
+
node.position = {
|
|
382
|
+
start: point(token.start),
|
|
383
|
+
end: void 0
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Create a closer handle.
|
|
388
|
+
*
|
|
389
|
+
* @param {Handle | undefined} [and]
|
|
390
|
+
* Optional function to also run.
|
|
391
|
+
* @returns {Handle}
|
|
392
|
+
* Handle.
|
|
393
|
+
*/
|
|
394
|
+
function closer(and) {
|
|
395
|
+
return close;
|
|
396
|
+
/**
|
|
397
|
+
* @this {CompileContext}
|
|
398
|
+
* @param {Token} token
|
|
399
|
+
* @returns {undefined}
|
|
400
|
+
*/
|
|
401
|
+
function close(token) {
|
|
402
|
+
if (and) and.call(this, token);
|
|
403
|
+
exit.call(this, token);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @type {CompileContext['exit']}
|
|
408
|
+
*/
|
|
409
|
+
function exit(token, onExitError) {
|
|
410
|
+
const node = this.stack.pop();
|
|
411
|
+
const open = this.tokenStack.pop();
|
|
412
|
+
if (!open) throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
|
|
413
|
+
start: token.start,
|
|
414
|
+
end: token.end
|
|
415
|
+
}) + "): it’s not open");
|
|
416
|
+
else if (open[0].type !== token.type) if (onExitError) onExitError.call(this, token, open[0]);
|
|
417
|
+
else (open[1] || defaultOnError).call(this, token, open[0]);
|
|
418
|
+
node.position.end = point(token.end);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* @type {CompileContext['resume']}
|
|
422
|
+
*/
|
|
423
|
+
function resume() {
|
|
424
|
+
return toString(this.stack.pop());
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* @this {CompileContext}
|
|
428
|
+
* @type {Handle}
|
|
429
|
+
*/
|
|
430
|
+
function onenterlistordered() {
|
|
431
|
+
this.data.expectingFirstListItemValue = true;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* @this {CompileContext}
|
|
435
|
+
* @type {Handle}
|
|
436
|
+
*/
|
|
437
|
+
function onenterlistitemvalue(token) {
|
|
438
|
+
if (this.data.expectingFirstListItemValue) {
|
|
439
|
+
const ancestor = this.stack[this.stack.length - 2];
|
|
440
|
+
ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
|
|
441
|
+
this.data.expectingFirstListItemValue = void 0;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* @this {CompileContext}
|
|
446
|
+
* @type {Handle}
|
|
447
|
+
*/
|
|
448
|
+
function onexitcodefencedfenceinfo() {
|
|
449
|
+
const data = this.resume();
|
|
450
|
+
const node = this.stack[this.stack.length - 1];
|
|
451
|
+
node.lang = data;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* @this {CompileContext}
|
|
455
|
+
* @type {Handle}
|
|
456
|
+
*/
|
|
457
|
+
function onexitcodefencedfencemeta() {
|
|
458
|
+
const data = this.resume();
|
|
459
|
+
const node = this.stack[this.stack.length - 1];
|
|
460
|
+
node.meta = data;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @this {CompileContext}
|
|
464
|
+
* @type {Handle}
|
|
465
|
+
*/
|
|
466
|
+
function onexitcodefencedfence() {
|
|
467
|
+
if (this.data.flowCodeInside) return;
|
|
468
|
+
this.buffer();
|
|
469
|
+
this.data.flowCodeInside = true;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* @this {CompileContext}
|
|
473
|
+
* @type {Handle}
|
|
474
|
+
*/
|
|
475
|
+
function onexitcodefenced() {
|
|
476
|
+
const data = this.resume();
|
|
477
|
+
const node = this.stack[this.stack.length - 1];
|
|
478
|
+
node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
|
|
479
|
+
this.data.flowCodeInside = void 0;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* @this {CompileContext}
|
|
483
|
+
* @type {Handle}
|
|
484
|
+
*/
|
|
485
|
+
function onexitcodeindented() {
|
|
486
|
+
const data = this.resume();
|
|
487
|
+
const node = this.stack[this.stack.length - 1];
|
|
488
|
+
node.value = data.replace(/(\r?\n|\r)$/g, "");
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @this {CompileContext}
|
|
492
|
+
* @type {Handle}
|
|
493
|
+
*/
|
|
494
|
+
function onexitdefinitionlabelstring(token) {
|
|
495
|
+
const label = this.resume();
|
|
496
|
+
const node = this.stack[this.stack.length - 1];
|
|
497
|
+
node.label = label;
|
|
498
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @this {CompileContext}
|
|
502
|
+
* @type {Handle}
|
|
503
|
+
*/
|
|
504
|
+
function onexitdefinitiontitlestring() {
|
|
505
|
+
const data = this.resume();
|
|
506
|
+
const node = this.stack[this.stack.length - 1];
|
|
507
|
+
node.title = data;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @this {CompileContext}
|
|
511
|
+
* @type {Handle}
|
|
512
|
+
*/
|
|
513
|
+
function onexitdefinitiondestinationstring() {
|
|
514
|
+
const data = this.resume();
|
|
515
|
+
const node = this.stack[this.stack.length - 1];
|
|
516
|
+
node.url = data;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* @this {CompileContext}
|
|
520
|
+
* @type {Handle}
|
|
521
|
+
*/
|
|
522
|
+
function onexitatxheadingsequence(token) {
|
|
523
|
+
const node = this.stack[this.stack.length - 1];
|
|
524
|
+
if (!node.depth) node.depth = this.sliceSerialize(token).length;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* @this {CompileContext}
|
|
528
|
+
* @type {Handle}
|
|
529
|
+
*/
|
|
530
|
+
function onexitsetextheadingtext() {
|
|
531
|
+
this.data.setextHeadingSlurpLineEnding = true;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* @this {CompileContext}
|
|
535
|
+
* @type {Handle}
|
|
536
|
+
*/
|
|
537
|
+
function onexitsetextheadinglinesequence(token) {
|
|
538
|
+
const node = this.stack[this.stack.length - 1];
|
|
539
|
+
node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* @this {CompileContext}
|
|
543
|
+
* @type {Handle}
|
|
544
|
+
*/
|
|
545
|
+
function onexitsetextheading() {
|
|
546
|
+
this.data.setextHeadingSlurpLineEnding = void 0;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* @this {CompileContext}
|
|
550
|
+
* @type {Handle}
|
|
551
|
+
*/
|
|
552
|
+
function onenterdata(token) {
|
|
553
|
+
/** @type {Array<Nodes>} */
|
|
554
|
+
const siblings = this.stack[this.stack.length - 1].children;
|
|
555
|
+
let tail = siblings[siblings.length - 1];
|
|
556
|
+
if (!tail || tail.type !== "text") {
|
|
557
|
+
tail = text();
|
|
558
|
+
tail.position = {
|
|
559
|
+
start: point(token.start),
|
|
560
|
+
end: void 0
|
|
561
|
+
};
|
|
562
|
+
siblings.push(tail);
|
|
563
|
+
}
|
|
564
|
+
this.stack.push(tail);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* @this {CompileContext}
|
|
568
|
+
* @type {Handle}
|
|
569
|
+
*/
|
|
570
|
+
function onexitdata(token) {
|
|
571
|
+
const tail = this.stack.pop();
|
|
572
|
+
tail.value += this.sliceSerialize(token);
|
|
573
|
+
tail.position.end = point(token.end);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* @this {CompileContext}
|
|
577
|
+
* @type {Handle}
|
|
578
|
+
*/
|
|
579
|
+
function onexitlineending(token) {
|
|
580
|
+
const context = this.stack[this.stack.length - 1];
|
|
581
|
+
if (this.data.atHardBreak) {
|
|
582
|
+
const tail = context.children[context.children.length - 1];
|
|
583
|
+
tail.position.end = point(token.end);
|
|
584
|
+
this.data.atHardBreak = void 0;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {
|
|
588
|
+
onenterdata.call(this, token);
|
|
589
|
+
onexitdata.call(this, token);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* @this {CompileContext}
|
|
594
|
+
* @type {Handle}
|
|
595
|
+
*/
|
|
596
|
+
function onexithardbreak() {
|
|
597
|
+
this.data.atHardBreak = true;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* @this {CompileContext}
|
|
601
|
+
* @type {Handle}
|
|
602
|
+
*/
|
|
603
|
+
function onexithtmlflow() {
|
|
604
|
+
const data = this.resume();
|
|
605
|
+
const node = this.stack[this.stack.length - 1];
|
|
606
|
+
node.value = data;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* @this {CompileContext}
|
|
610
|
+
* @type {Handle}
|
|
611
|
+
*/
|
|
612
|
+
function onexithtmltext() {
|
|
613
|
+
const data = this.resume();
|
|
614
|
+
const node = this.stack[this.stack.length - 1];
|
|
615
|
+
node.value = data;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @this {CompileContext}
|
|
619
|
+
* @type {Handle}
|
|
620
|
+
*/
|
|
621
|
+
function onexitcodetext() {
|
|
622
|
+
const data = this.resume();
|
|
623
|
+
const node = this.stack[this.stack.length - 1];
|
|
624
|
+
node.value = data;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* @this {CompileContext}
|
|
628
|
+
* @type {Handle}
|
|
629
|
+
*/
|
|
630
|
+
function onexitlink() {
|
|
631
|
+
const node = this.stack[this.stack.length - 1];
|
|
632
|
+
if (this.data.inReference) {
|
|
633
|
+
/** @type {ReferenceType} */
|
|
634
|
+
const referenceType = this.data.referenceType || "shortcut";
|
|
635
|
+
node.type += "Reference";
|
|
636
|
+
node.referenceType = referenceType;
|
|
637
|
+
delete node.url;
|
|
638
|
+
delete node.title;
|
|
639
|
+
} else {
|
|
640
|
+
delete node.identifier;
|
|
641
|
+
delete node.label;
|
|
642
|
+
}
|
|
643
|
+
this.data.referenceType = void 0;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* @this {CompileContext}
|
|
647
|
+
* @type {Handle}
|
|
648
|
+
*/
|
|
649
|
+
function onexitimage() {
|
|
650
|
+
const node = this.stack[this.stack.length - 1];
|
|
651
|
+
if (this.data.inReference) {
|
|
652
|
+
/** @type {ReferenceType} */
|
|
653
|
+
const referenceType = this.data.referenceType || "shortcut";
|
|
654
|
+
node.type += "Reference";
|
|
655
|
+
node.referenceType = referenceType;
|
|
656
|
+
delete node.url;
|
|
657
|
+
delete node.title;
|
|
658
|
+
} else {
|
|
659
|
+
delete node.identifier;
|
|
660
|
+
delete node.label;
|
|
661
|
+
}
|
|
662
|
+
this.data.referenceType = void 0;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* @this {CompileContext}
|
|
666
|
+
* @type {Handle}
|
|
667
|
+
*/
|
|
668
|
+
function onexitlabeltext(token) {
|
|
669
|
+
const string = this.sliceSerialize(token);
|
|
670
|
+
const ancestor = this.stack[this.stack.length - 2];
|
|
671
|
+
ancestor.label = decodeString(string);
|
|
672
|
+
ancestor.identifier = normalizeIdentifier(string).toLowerCase();
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* @this {CompileContext}
|
|
676
|
+
* @type {Handle}
|
|
677
|
+
*/
|
|
678
|
+
function onexitlabel() {
|
|
679
|
+
const fragment = this.stack[this.stack.length - 1];
|
|
680
|
+
const value = this.resume();
|
|
681
|
+
const node = this.stack[this.stack.length - 1];
|
|
682
|
+
this.data.inReference = true;
|
|
683
|
+
if (node.type === "link") node.children = fragment.children;
|
|
684
|
+
else node.alt = value;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* @this {CompileContext}
|
|
688
|
+
* @type {Handle}
|
|
689
|
+
*/
|
|
690
|
+
function onexitresourcedestinationstring() {
|
|
691
|
+
const data = this.resume();
|
|
692
|
+
const node = this.stack[this.stack.length - 1];
|
|
693
|
+
node.url = data;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* @this {CompileContext}
|
|
697
|
+
* @type {Handle}
|
|
698
|
+
*/
|
|
699
|
+
function onexitresourcetitlestring() {
|
|
700
|
+
const data = this.resume();
|
|
701
|
+
const node = this.stack[this.stack.length - 1];
|
|
702
|
+
node.title = data;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* @this {CompileContext}
|
|
706
|
+
* @type {Handle}
|
|
707
|
+
*/
|
|
708
|
+
function onexitresource() {
|
|
709
|
+
this.data.inReference = void 0;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* @this {CompileContext}
|
|
713
|
+
* @type {Handle}
|
|
714
|
+
*/
|
|
715
|
+
function onenterreference() {
|
|
716
|
+
this.data.referenceType = "collapsed";
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @this {CompileContext}
|
|
720
|
+
* @type {Handle}
|
|
721
|
+
*/
|
|
722
|
+
function onexitreferencestring(token) {
|
|
723
|
+
const label = this.resume();
|
|
724
|
+
const node = this.stack[this.stack.length - 1];
|
|
725
|
+
node.label = label;
|
|
726
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
727
|
+
this.data.referenceType = "full";
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* @this {CompileContext}
|
|
731
|
+
* @type {Handle}
|
|
732
|
+
*/
|
|
733
|
+
function onexitcharacterreferencemarker(token) {
|
|
734
|
+
this.data.characterReferenceType = token.type;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* @this {CompileContext}
|
|
738
|
+
* @type {Handle}
|
|
739
|
+
*/
|
|
740
|
+
function onexitcharacterreferencevalue(token) {
|
|
741
|
+
const data = this.sliceSerialize(token);
|
|
742
|
+
const type = this.data.characterReferenceType;
|
|
743
|
+
/** @type {string} */
|
|
744
|
+
let value;
|
|
745
|
+
if (type) {
|
|
746
|
+
value = decodeNumericCharacterReference(data, type === "characterReferenceMarkerNumeric" ? 10 : 16);
|
|
747
|
+
this.data.characterReferenceType = void 0;
|
|
748
|
+
} else value = decodeNamedCharacterReference(data);
|
|
749
|
+
const tail = this.stack[this.stack.length - 1];
|
|
750
|
+
tail.value += value;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* @this {CompileContext}
|
|
754
|
+
* @type {Handle}
|
|
755
|
+
*/
|
|
756
|
+
function onexitcharacterreference(token) {
|
|
757
|
+
const tail = this.stack.pop();
|
|
758
|
+
tail.position.end = point(token.end);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* @this {CompileContext}
|
|
762
|
+
* @type {Handle}
|
|
763
|
+
*/
|
|
764
|
+
function onexitautolinkprotocol(token) {
|
|
765
|
+
onexitdata.call(this, token);
|
|
766
|
+
const node = this.stack[this.stack.length - 1];
|
|
767
|
+
node.url = this.sliceSerialize(token);
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* @this {CompileContext}
|
|
771
|
+
* @type {Handle}
|
|
772
|
+
*/
|
|
773
|
+
function onexitautolinkemail(token) {
|
|
774
|
+
onexitdata.call(this, token);
|
|
775
|
+
const node = this.stack[this.stack.length - 1];
|
|
776
|
+
node.url = "mailto:" + this.sliceSerialize(token);
|
|
777
|
+
}
|
|
778
|
+
/** @returns {Blockquote} */
|
|
779
|
+
function blockQuote() {
|
|
780
|
+
return {
|
|
781
|
+
type: "blockquote",
|
|
782
|
+
children: []
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
/** @returns {Code} */
|
|
786
|
+
function codeFlow() {
|
|
787
|
+
return {
|
|
788
|
+
type: "code",
|
|
789
|
+
lang: null,
|
|
790
|
+
meta: null,
|
|
791
|
+
value: ""
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
/** @returns {InlineCode} */
|
|
795
|
+
function codeText() {
|
|
796
|
+
return {
|
|
797
|
+
type: "inlineCode",
|
|
798
|
+
value: ""
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
/** @returns {Definition} */
|
|
802
|
+
function definition() {
|
|
803
|
+
return {
|
|
804
|
+
type: "definition",
|
|
805
|
+
identifier: "",
|
|
806
|
+
label: null,
|
|
807
|
+
title: null,
|
|
808
|
+
url: ""
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
/** @returns {Emphasis} */
|
|
812
|
+
function emphasis() {
|
|
813
|
+
return {
|
|
814
|
+
type: "emphasis",
|
|
815
|
+
children: []
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
/** @returns {Heading} */
|
|
819
|
+
function heading() {
|
|
820
|
+
return {
|
|
821
|
+
type: "heading",
|
|
822
|
+
depth: 0,
|
|
823
|
+
children: []
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
/** @returns {Break} */
|
|
827
|
+
function hardBreak() {
|
|
828
|
+
return { type: "break" };
|
|
829
|
+
}
|
|
830
|
+
/** @returns {Html} */
|
|
831
|
+
function html() {
|
|
832
|
+
return {
|
|
833
|
+
type: "html",
|
|
834
|
+
value: ""
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
/** @returns {Image} */
|
|
838
|
+
function image() {
|
|
839
|
+
return {
|
|
840
|
+
type: "image",
|
|
841
|
+
title: null,
|
|
842
|
+
url: "",
|
|
843
|
+
alt: null
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
/** @returns {Link} */
|
|
847
|
+
function link() {
|
|
848
|
+
return {
|
|
849
|
+
type: "link",
|
|
850
|
+
title: null,
|
|
851
|
+
url: "",
|
|
852
|
+
children: []
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* @param {Token} token
|
|
857
|
+
* @returns {List}
|
|
858
|
+
*/
|
|
859
|
+
function list(token) {
|
|
860
|
+
return {
|
|
861
|
+
type: "list",
|
|
862
|
+
ordered: token.type === "listOrdered",
|
|
863
|
+
start: null,
|
|
864
|
+
spread: token._spread,
|
|
865
|
+
children: []
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* @param {Token} token
|
|
870
|
+
* @returns {ListItem}
|
|
871
|
+
*/
|
|
872
|
+
function listItem(token) {
|
|
873
|
+
return {
|
|
874
|
+
type: "listItem",
|
|
875
|
+
spread: token._spread,
|
|
876
|
+
checked: null,
|
|
877
|
+
children: []
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
/** @returns {Paragraph} */
|
|
881
|
+
function paragraph() {
|
|
882
|
+
return {
|
|
883
|
+
type: "paragraph",
|
|
884
|
+
children: []
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
/** @returns {Strong} */
|
|
888
|
+
function strong() {
|
|
889
|
+
return {
|
|
890
|
+
type: "strong",
|
|
891
|
+
children: []
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
/** @returns {Text} */
|
|
895
|
+
function text() {
|
|
896
|
+
return {
|
|
897
|
+
type: "text",
|
|
898
|
+
value: ""
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
/** @returns {ThematicBreak} */
|
|
902
|
+
function thematicBreak() {
|
|
903
|
+
return { type: "thematicBreak" };
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Copy a point-like value.
|
|
908
|
+
*
|
|
909
|
+
* @param {Point} d
|
|
910
|
+
* Point-like value.
|
|
911
|
+
* @returns {Point}
|
|
912
|
+
* unist point.
|
|
913
|
+
*/
|
|
914
|
+
function point(d) {
|
|
915
|
+
return {
|
|
916
|
+
line: d.line,
|
|
917
|
+
column: d.column,
|
|
918
|
+
offset: d.offset
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* @param {Config} combined
|
|
923
|
+
* @param {Array<Array<Extension> | Extension>} extensions
|
|
924
|
+
* @returns {undefined}
|
|
925
|
+
*/
|
|
926
|
+
function configure(combined, extensions) {
|
|
927
|
+
let index = -1;
|
|
928
|
+
while (++index < extensions.length) {
|
|
929
|
+
const value = extensions[index];
|
|
930
|
+
if (Array.isArray(value)) configure(combined, value);
|
|
931
|
+
else extension(combined, value);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* @param {Config} combined
|
|
936
|
+
* @param {Extension} extension
|
|
937
|
+
* @returns {undefined}
|
|
938
|
+
*/
|
|
939
|
+
function extension(combined, extension) {
|
|
940
|
+
/** @type {keyof Extension} */
|
|
941
|
+
let key;
|
|
942
|
+
for (key in extension) if (own.call(extension, key)) switch (key) {
|
|
943
|
+
case "canContainEols": {
|
|
944
|
+
const right = extension[key];
|
|
945
|
+
if (right) combined[key].push(...right);
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
case "transforms": {
|
|
949
|
+
const right = extension[key];
|
|
950
|
+
if (right) combined[key].push(...right);
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
case "enter":
|
|
954
|
+
case "exit": {
|
|
955
|
+
const right = extension[key];
|
|
956
|
+
if (right) Object.assign(combined[key], right);
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
/** @type {OnEnterError} */
|
|
962
|
+
function defaultOnError(left, right) {
|
|
963
|
+
if (left) throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({
|
|
964
|
+
start: left.start,
|
|
965
|
+
end: left.end
|
|
966
|
+
}) + "): a different token (`" + right.type + "`, " + stringifyPosition({
|
|
967
|
+
start: right.start,
|
|
968
|
+
end: right.end
|
|
969
|
+
}) + ") is open");
|
|
970
|
+
else throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
|
|
971
|
+
start: right.start,
|
|
972
|
+
end: right.end
|
|
973
|
+
}) + ") is still open");
|
|
974
|
+
}
|
|
975
|
+
//#endregion
|
|
976
|
+
export { fromMarkdown };
|