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.
Files changed (278) hide show
  1. package/LICENSE +201 -0
  2. package/dist/bin.mjs +24025 -0
  3. package/dist/src/_virtual/_rolldown/runtime.mjs +35 -0
  4. package/dist/src/changelog.d.mts +71 -0
  5. package/dist/src/changelog.mjs +92 -0
  6. package/dist/src/changenote.d.mts +41 -0
  7. package/dist/src/changenote.mjs +184 -0
  8. package/dist/src/cli/commands/change.d.mts +4 -0
  9. package/dist/src/cli/commands/change.mjs +75 -0
  10. package/dist/src/formatter.d.mts +31 -0
  11. package/dist/src/formatter.mjs +50 -0
  12. package/dist/src/git.d.mts +20 -0
  13. package/dist/src/git.mjs +121 -0
  14. package/dist/src/index.d.mts +19 -0
  15. package/dist/src/index.mjs +20 -0
  16. package/dist/src/node_modules/.pnpm/@clack_core@1.2.0/node_modules/@clack/core/dist/index.mjs +530 -0
  17. package/dist/src/node_modules/.pnpm/@clack_prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs +110 -0
  18. package/dist/src/node_modules/.pnpm/@kwsites_file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.mjs +13 -0
  19. package/dist/src/node_modules/.pnpm/@kwsites_file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.mjs +59 -0
  20. package/dist/src/node_modules/.pnpm/@kwsites_promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.mjs +55 -0
  21. package/dist/src/node_modules/.pnpm/@octokit_auth-token@6.0.0/node_modules/@octokit/auth-token/dist-bundle/index.mjs +32 -0
  22. package/dist/src/node_modules/.pnpm/@octokit_core@7.0.6/node_modules/@octokit/core/dist-src/index.mjs +94 -0
  23. package/dist/src/node_modules/.pnpm/@octokit_core@7.0.6/node_modules/@octokit/core/dist-src/version.mjs +4 -0
  24. package/dist/src/node_modules/.pnpm/@octokit_endpoint@11.0.3/node_modules/@octokit/endpoint/dist-bundle/index.mjs +223 -0
  25. package/dist/src/node_modules/.pnpm/@octokit_graphql@9.0.3/node_modules/@octokit/graphql/dist-bundle/index.mjs +90 -0
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. package/dist/src/node_modules/.pnpm/@octokit_request-error@7.1.0/node_modules/@octokit/request-error/dist-src/index.mjs +30 -0
  34. package/dist/src/node_modules/.pnpm/@octokit_request@10.0.8/node_modules/@octokit/request/dist-bundle/index.mjs +146 -0
  35. package/dist/src/node_modules/.pnpm/@octokit_rest@22.0.1/node_modules/@octokit/rest/dist-src/index.mjs +9 -0
  36. package/dist/src/node_modules/.pnpm/@octokit_rest@22.0.1/node_modules/@octokit/rest/dist-src/version.mjs +4 -0
  37. package/dist/src/node_modules/.pnpm/@simple-git_args-pathspec@1.0.2/node_modules/@simple-git/args-pathspec/dist/index.mjs +14 -0
  38. package/dist/src/node_modules/.pnpm/@simple-git_argv-parser@1.0.3/node_modules/@simple-git/argv-parser/dist/index.mjs +369 -0
  39. package/dist/src/node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.mjs +13 -0
  40. package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/index.mjs +43 -0
  41. package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/add.mjs +28 -0
  42. package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/register.mjs +16 -0
  43. package/dist/src/node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/remove.mjs +11 -0
  44. package/dist/src/node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.mjs +2135 -0
  45. package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.mjs +200 -0
  46. package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.mjs +206 -0
  47. package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.mjs +15 -0
  48. package/dist/src/node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.mjs +212 -0
  49. package/dist/src/node_modules/.pnpm/decode-named-character-reference@1.3.0/node_modules/decode-named-character-reference/index.mjs +19 -0
  50. package/dist/src/node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.mjs +4 -0
  51. package/dist/src/node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.mjs +7 -0
  52. package/dist/src/node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.mjs +76 -0
  53. package/dist/src/node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.mjs +115 -0
  54. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.mjs +138 -0
  55. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.mjs +12 -0
  56. package/dist/src/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.mjs +12 -0
  57. package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.mjs +165 -0
  58. package/dist/src/node_modules/.pnpm/fault@2.0.1/node_modules/fault/index.mjs +38 -0
  59. package/dist/src/node_modules/.pnpm/format@0.2.2/node_modules/format/format.mjs +87 -0
  60. package/dist/src/node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.mjs +3125 -0
  61. package/dist/src/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.mjs +13 -0
  62. package/dist/src/node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.mjs +8 -0
  63. package/dist/src/node_modules/.pnpm/json-with-bigint@3.5.8/node_modules/json-with-bigint/json-with-bigint.mjs +137 -0
  64. package/dist/src/node_modules/.pnpm/localstorage-polyfill@1.0.1/node_modules/localstorage-polyfill/localStorage.mjs +39 -0
  65. package/dist/src/node_modules/.pnpm/longest-streak@3.1.0/node_modules/longest-streak/index.mjs +29 -0
  66. package/dist/src/node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/index.mjs +976 -0
  67. package/dist/src/node_modules/.pnpm/mdast-util-frontmatter@2.0.1/node_modules/mdast-util-frontmatter/lib/index.mjs +162 -0
  68. package/dist/src/node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.mjs +36 -0
  69. package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/configure.mjs +48 -0
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. 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
  83. 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
  84. 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
  85. 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
  86. 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
  87. 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
  88. 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
  89. 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
  90. package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/index.mjs +161 -0
  91. package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/join.mjs +18 -0
  92. package/dist/src/node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/unsafe.mjs +223 -0
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. 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
  102. 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
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. 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
  110. 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
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. package/dist/src/node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.mjs +83 -0
  117. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/attention.mjs +224 -0
  118. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/autolink.mjs +213 -0
  119. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.mjs +60 -0
  120. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/block-quote.mjs +130 -0
  121. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-escape.mjs +62 -0
  122. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-reference.mjs +141 -0
  123. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-fenced.mjs +418 -0
  124. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-indented.mjs +147 -0
  125. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-text.mjs +187 -0
  126. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/content.mjs +137 -0
  127. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/definition.mjs +223 -0
  128. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/hard-break-escape.mjs +59 -0
  129. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/heading-atx.mjs +189 -0
  130. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-flow.mjs +777 -0
  131. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-text.mjs +617 -0
  132. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-end.mjs +479 -0
  133. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-image.mjs +95 -0
  134. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-link.mjs +50 -0
  135. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/line-ending.mjs +32 -0
  136. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/list.mjs +177 -0
  137. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/setext-underline.mjs +155 -0
  138. package/dist/src/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/thematic-break.mjs +98 -0
  139. package/dist/src/node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/syntax.mjs +352 -0
  140. package/dist/src/node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/to-matters.mjs +109 -0
  141. package/dist/src/node_modules/.pnpm/micromark-factory-destination@2.0.1/node_modules/micromark-factory-destination/index.mjs +186 -0
  142. package/dist/src/node_modules/.pnpm/micromark-factory-label@2.0.1/node_modules/micromark-factory-label/index.mjs +134 -0
  143. package/dist/src/node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.mjs +61 -0
  144. package/dist/src/node_modules/.pnpm/micromark-factory-title@2.0.1/node_modules/micromark-factory-title/index.mjs +148 -0
  145. package/dist/src/node_modules/.pnpm/micromark-factory-whitespace@2.0.1/node_modules/micromark-factory-whitespace/index.mjs +43 -0
  146. package/dist/src/node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.mjs +229 -0
  147. package/dist/src/node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.mjs +71 -0
  148. package/dist/src/node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.mjs +25 -0
  149. package/dist/src/node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.mjs +73 -0
  150. 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
  151. package/dist/src/node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.mjs +40 -0
  152. 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
  153. package/dist/src/node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.mjs +25 -0
  154. package/dist/src/node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.mjs +31 -0
  155. package/dist/src/node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/index.mjs +158 -0
  156. package/dist/src/node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/lib/splice-buffer.mjs +231 -0
  157. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/constructs.mjs +101 -0
  158. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/create-tokenizer.mjs +473 -0
  159. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/content.mjs +70 -0
  160. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/document.mjs +220 -0
  161. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/flow.mjs +51 -0
  162. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/text.mjs +178 -0
  163. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/parse.mjs +52 -0
  164. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/postprocess.mjs +17 -0
  165. package/dist/src/node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/preprocess.mjs +102 -0
  166. package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.mjs +121 -0
  167. package/dist/src/node_modules/.pnpm/remark-frontmatter@5.0.0/node_modules/remark-frontmatter/lib/index.mjs +35 -0
  168. package/dist/src/node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.mjs +37 -0
  169. package/dist/src/node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.mjs +36 -0
  170. package/dist/src/node_modules/.pnpm/simple-git@3.35.2/node_modules/simple-git/dist/esm/index.mjs +3563 -0
  171. package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.mjs +57 -0
  172. package/dist/src/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.mjs +72 -0
  173. package/dist/src/node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.mjs +157 -0
  174. package/dist/src/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.mjs +13 -0
  175. package/dist/src/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.mjs +1088 -0
  176. package/dist/src/node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.mjs +110 -0
  177. package/dist/src/node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.mjs +65 -0
  178. 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
  179. package/dist/src/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.mjs +328 -0
  180. package/dist/src/node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.mjs +287 -0
  181. package/dist/src/node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.mjs +8 -0
  182. package/dist/src/node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/lib/index.mjs +247 -0
  183. package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.mjs +525 -0
  184. package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minpath.mjs +2 -0
  185. package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minproc.mjs +2 -0
  186. package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.mjs +3 -0
  187. package/dist/src/node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.shared.mjs +24 -0
  188. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.mjs +62 -0
  189. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.mjs +49 -0
  190. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.mjs +98 -0
  191. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.mjs +66 -0
  192. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/composer.mjs +207 -0
  193. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.mjs +93 -0
  194. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.mjs +179 -0
  195. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.mjs +48 -0
  196. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.mjs +41 -0
  197. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.mjs +166 -0
  198. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.mjs +211 -0
  199. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.mjs +110 -0
  200. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.mjs +32 -0
  201. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.mjs +30 -0
  202. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.mjs +16 -0
  203. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.mjs +16 -0
  204. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/Document.mjs +295 -0
  205. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.mjs +67 -0
  206. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.mjs +43 -0
  207. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.mjs +69 -0
  208. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/doc/directives.mjs +170 -0
  209. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/errors.mjs +56 -0
  210. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/index.mjs +67 -0
  211. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/log.mjs +17 -0
  212. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.mjs +101 -0
  213. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.mjs +127 -0
  214. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.mjs +40 -0
  215. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.mjs +40 -0
  216. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.mjs +33 -0
  217. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.mjs +118 -0
  218. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.mjs +115 -0
  219. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.mjs +59 -0
  220. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.mjs +53 -0
  221. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.mjs +41 -0
  222. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.mjs +274 -0
  223. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.mjs +54 -0
  224. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.mjs +94 -0
  225. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/cst.mjs +85 -0
  226. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.mjs +523 -0
  227. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.mjs +50 -0
  228. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/parse/parser.mjs +861 -0
  229. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/public-api.mjs +97 -0
  230. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.mjs +36 -0
  231. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.mjs +22 -0
  232. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.mjs +19 -0
  233. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.mjs +22 -0
  234. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.mjs +19 -0
  235. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.mjs +23 -0
  236. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.mjs +46 -0
  237. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.mjs +45 -0
  238. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.mjs +34 -0
  239. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.mjs +68 -0
  240. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/tags.mjs +103 -0
  241. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.mjs +53 -0
  242. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.mjs +31 -0
  243. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.mjs +49 -0
  244. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.mjs +79 -0
  245. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.mjs +45 -0
  246. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.mjs +71 -0
  247. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.mjs +67 -0
  248. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.mjs +56 -0
  249. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.mjs +74 -0
  250. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.mjs +87 -0
  251. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.mjs +119 -0
  252. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.mjs +115 -0
  253. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.mjs +124 -0
  254. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.mjs +23 -0
  255. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.mjs +67 -0
  256. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.mjs +24 -0
  257. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.mjs +104 -0
  258. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.mjs +229 -0
  259. package/dist/src/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/visit.mjs +194 -0
  260. package/dist/src/node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.mjs +106 -0
  261. package/dist/src/pkg.d.mts +24 -0
  262. package/dist/src/pkg.mjs +39 -0
  263. package/dist/src/prepare.d.mts +14 -0
  264. package/dist/src/prepare.mjs +41 -0
  265. package/dist/src/publishers/npm.d.mts +21 -0
  266. package/dist/src/publishers/npm.mjs +42 -0
  267. package/dist/src/releasers/github.d.mts +10 -0
  268. package/dist/src/releasers/github.mjs +20 -0
  269. package/dist/src/saver.d.mts +42 -0
  270. package/dist/src/saver.mjs +39 -0
  271. package/dist/src/types.d.mts +150 -0
  272. package/dist/src/utils.d.mts +7 -0
  273. package/dist/src/utils.mjs +47 -0
  274. package/dist/src/version.d.mts +9 -0
  275. package/dist/src/version.mjs +18 -0
  276. package/package.json +156 -0
  277. package/templates/cngpac.config.ts +33 -0
  278. package/templates/version.yml +30 -0
@@ -0,0 +1,1088 @@
1
+ import { __toESM } from "../../../../../../_virtual/_rolldown/runtime.mjs";
2
+ import "../../../../devlop@1.1.0/node_modules/devlop/lib/default.mjs";
3
+ import { bail } from "../../../../bail@2.0.2/node_modules/bail/index.mjs";
4
+ import { require_extend } from "../../../../extend@3.0.2/node_modules/extend/index.mjs";
5
+ import isPlainObject from "../../../../is-plain-obj@4.1.0/node_modules/is-plain-obj/index.mjs";
6
+ import { trough } from "../../../../trough@2.2.0/node_modules/trough/lib/index.mjs";
7
+ import { VFile } from "../../../../vfile@6.0.3/node_modules/vfile/lib/index.mjs";
8
+ import { CallableInstance } from "./callable-instance.mjs";
9
+ //#region node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js
10
+ /**
11
+ * @typedef {import('trough').Pipeline} Pipeline
12
+ *
13
+ * @typedef {import('unist').Node} Node
14
+ *
15
+ * @typedef {import('vfile').Compatible} Compatible
16
+ * @typedef {import('vfile').Value} Value
17
+ *
18
+ * @typedef {import('../index.js').CompileResultMap} CompileResultMap
19
+ * @typedef {import('../index.js').Data} Data
20
+ * @typedef {import('../index.js').Settings} Settings
21
+ */
22
+ /**
23
+ * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults
24
+ * Acceptable results from compilers.
25
+ *
26
+ * To register custom results, add them to
27
+ * {@linkcode CompileResultMap}.
28
+ */
29
+ /**
30
+ * @template {Node} [Tree=Node]
31
+ * The node that the compiler receives (default: `Node`).
32
+ * @template {CompileResults} [Result=CompileResults]
33
+ * The thing that the compiler yields (default: `CompileResults`).
34
+ * @callback Compiler
35
+ * A **compiler** handles the compiling of a syntax tree to something else
36
+ * (in most cases, text) (TypeScript type).
37
+ *
38
+ * It is used in the stringify phase and called with a {@linkcode Node}
39
+ * and {@linkcode VFile} representation of the document to compile.
40
+ * It should return the textual representation of the given tree (typically
41
+ * `string`).
42
+ *
43
+ * > **Note**: unified typically compiles by serializing: most compilers
44
+ * > return `string` (or `Uint8Array`).
45
+ * > Some compilers, such as the one configured with
46
+ * > [`rehype-react`][rehype-react], return other values (in this case, a
47
+ * > React tree).
48
+ * > If you’re using a compiler that doesn’t serialize, expect different
49
+ * > result values.
50
+ * >
51
+ * > To register custom results in TypeScript, add them to
52
+ * > {@linkcode CompileResultMap}.
53
+ *
54
+ * [rehype-react]: https://github.com/rehypejs/rehype-react
55
+ * @param {Tree} tree
56
+ * Tree to compile.
57
+ * @param {VFile} file
58
+ * File associated with `tree`.
59
+ * @returns {Result}
60
+ * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or
61
+ * something else (for `file.result`).
62
+ */
63
+ /**
64
+ * @template {Node} [Tree=Node]
65
+ * The node that the parser yields (default: `Node`)
66
+ * @callback Parser
67
+ * A **parser** handles the parsing of text to a syntax tree.
68
+ *
69
+ * It is used in the parse phase and is called with a `string` and
70
+ * {@linkcode VFile} of the document to parse.
71
+ * It must return the syntax tree representation of the given file
72
+ * ({@linkcode Node}).
73
+ * @param {string} document
74
+ * Document to parse.
75
+ * @param {VFile} file
76
+ * File associated with `document`.
77
+ * @returns {Tree}
78
+ * Node representing the given file.
79
+ */
80
+ /**
81
+ * @typedef {(
82
+ * Plugin<Array<any>, any, any> |
83
+ * PluginTuple<Array<any>, any, any> |
84
+ * Preset
85
+ * )} Pluggable
86
+ * Union of the different ways to add plugins and settings.
87
+ */
88
+ /**
89
+ * @typedef {Array<Pluggable>} PluggableList
90
+ * List of plugins and presets.
91
+ */
92
+ /**
93
+ * @template {Array<unknown>} [PluginParameters=[]]
94
+ * Arguments passed to the plugin (default: `[]`, the empty tuple).
95
+ * @template {Node | string | undefined} [Input=Node]
96
+ * Value that is expected as input (default: `Node`).
97
+ *
98
+ * * If the plugin returns a {@linkcode Transformer}, this
99
+ * should be the node it expects.
100
+ * * If the plugin sets a {@linkcode Parser}, this should be
101
+ * `string`.
102
+ * * If the plugin sets a {@linkcode Compiler}, this should be the
103
+ * node it expects.
104
+ * @template [Output=Input]
105
+ * Value that is yielded as output (default: `Input`).
106
+ *
107
+ * * If the plugin returns a {@linkcode Transformer}, this
108
+ * should be the node that that yields.
109
+ * * If the plugin sets a {@linkcode Parser}, this should be the
110
+ * node that it yields.
111
+ * * If the plugin sets a {@linkcode Compiler}, this should be
112
+ * result it yields.
113
+ * @typedef {(
114
+ * (this: Processor, ...parameters: PluginParameters) =>
115
+ * Input extends string ? // Parser.
116
+ * Output extends Node | undefined ? undefined | void : never :
117
+ * Output extends CompileResults ? // Compiler.
118
+ * Input extends Node | undefined ? undefined | void : never :
119
+ * Transformer<
120
+ * Input extends Node ? Input : Node,
121
+ * Output extends Node ? Output : Node
122
+ * > | undefined | void
123
+ * )} Plugin
124
+ * Single plugin.
125
+ *
126
+ * Plugins configure the processors they are applied on in the following
127
+ * ways:
128
+ *
129
+ * * they change the processor, such as the parser, the compiler, or by
130
+ * configuring data
131
+ * * they specify how to handle trees and files
132
+ *
133
+ * In practice, they are functions that can receive options and configure the
134
+ * processor (`this`).
135
+ *
136
+ * > **Note**: plugins are called when the processor is *frozen*, not when
137
+ * > they are applied.
138
+ */
139
+ /**
140
+ * Tuple of a plugin and its configuration.
141
+ *
142
+ * The first item is a plugin, the rest are its parameters.
143
+ *
144
+ * @template {Array<unknown>} [TupleParameters=[]]
145
+ * Arguments passed to the plugin (default: `[]`, the empty tuple).
146
+ * @template {Node | string | undefined} [Input=undefined]
147
+ * Value that is expected as input (optional).
148
+ *
149
+ * * If the plugin returns a {@linkcode Transformer}, this
150
+ * should be the node it expects.
151
+ * * If the plugin sets a {@linkcode Parser}, this should be
152
+ * `string`.
153
+ * * If the plugin sets a {@linkcode Compiler}, this should be the
154
+ * node it expects.
155
+ * @template [Output=undefined] (optional).
156
+ * Value that is yielded as output.
157
+ *
158
+ * * If the plugin returns a {@linkcode Transformer}, this
159
+ * should be the node that that yields.
160
+ * * If the plugin sets a {@linkcode Parser}, this should be the
161
+ * node that it yields.
162
+ * * If the plugin sets a {@linkcode Compiler}, this should be
163
+ * result it yields.
164
+ * @typedef {(
165
+ * [
166
+ * plugin: Plugin<TupleParameters, Input, Output>,
167
+ * ...parameters: TupleParameters
168
+ * ]
169
+ * )} PluginTuple
170
+ */
171
+ /**
172
+ * @typedef Preset
173
+ * Sharable configuration.
174
+ *
175
+ * They can contain plugins and settings.
176
+ * @property {PluggableList | undefined} [plugins]
177
+ * List of plugins and presets (optional).
178
+ * @property {Settings | undefined} [settings]
179
+ * Shared settings for parsers and compilers (optional).
180
+ */
181
+ /**
182
+ * @template {VFile} [File=VFile]
183
+ * The file that the callback receives (default: `VFile`).
184
+ * @callback ProcessCallback
185
+ * Callback called when the process is done.
186
+ *
187
+ * Called with either an error or a result.
188
+ * @param {Error | undefined} [error]
189
+ * Fatal error (optional).
190
+ * @param {File | undefined} [file]
191
+ * Processed file (optional).
192
+ * @returns {undefined}
193
+ * Nothing.
194
+ */
195
+ /**
196
+ * @template {Node} [Tree=Node]
197
+ * The tree that the callback receives (default: `Node`).
198
+ * @callback RunCallback
199
+ * Callback called when transformers are done.
200
+ *
201
+ * Called with either an error or results.
202
+ * @param {Error | undefined} [error]
203
+ * Fatal error (optional).
204
+ * @param {Tree | undefined} [tree]
205
+ * Transformed tree (optional).
206
+ * @param {VFile | undefined} [file]
207
+ * File (optional).
208
+ * @returns {undefined}
209
+ * Nothing.
210
+ */
211
+ /**
212
+ * @template {Node} [Output=Node]
213
+ * Node type that the transformer yields (default: `Node`).
214
+ * @callback TransformCallback
215
+ * Callback passed to transforms.
216
+ *
217
+ * If the signature of a `transformer` accepts a third argument, the
218
+ * transformer may perform asynchronous operations, and must call it.
219
+ * @param {Error | undefined} [error]
220
+ * Fatal error to stop the process (optional).
221
+ * @param {Output | undefined} [tree]
222
+ * New, changed, tree (optional).
223
+ * @param {VFile | undefined} [file]
224
+ * New, changed, file (optional).
225
+ * @returns {undefined}
226
+ * Nothing.
227
+ */
228
+ /**
229
+ * @template {Node} [Input=Node]
230
+ * Node type that the transformer expects (default: `Node`).
231
+ * @template {Node} [Output=Input]
232
+ * Node type that the transformer yields (default: `Input`).
233
+ * @callback Transformer
234
+ * Transformers handle syntax trees and files.
235
+ *
236
+ * They are functions that are called each time a syntax tree and file are
237
+ * passed through the run phase.
238
+ * When an error occurs in them (either because it’s thrown, returned,
239
+ * rejected, or passed to `next`), the process stops.
240
+ *
241
+ * The run phase is handled by [`trough`][trough], see its documentation for
242
+ * the exact semantics of these functions.
243
+ *
244
+ * > **Note**: you should likely ignore `next`: don’t accept it.
245
+ * > it supports callback-style async work.
246
+ * > But promises are likely easier to reason about.
247
+ *
248
+ * [trough]: https://github.com/wooorm/trough#function-fninput-next
249
+ * @param {Input} tree
250
+ * Tree to handle.
251
+ * @param {VFile} file
252
+ * File to handle.
253
+ * @param {TransformCallback<Output>} next
254
+ * Callback.
255
+ * @returns {(
256
+ * Promise<Output | undefined | void> |
257
+ * Promise<never> | // For some reason this is needed separately.
258
+ * Output |
259
+ * Error |
260
+ * undefined |
261
+ * void
262
+ * )}
263
+ * If you accept `next`, nothing.
264
+ * Otherwise:
265
+ *
266
+ * * `Error` — fatal error to stop the process
267
+ * * `Promise<undefined>` or `undefined` — the next transformer keeps using
268
+ * same tree
269
+ * * `Promise<Node>` or `Node` — new, changed, tree
270
+ */
271
+ /**
272
+ * @template {Node | undefined} ParseTree
273
+ * Output of `parse`.
274
+ * @template {Node | undefined} HeadTree
275
+ * Input for `run`.
276
+ * @template {Node | undefined} TailTree
277
+ * Output for `run`.
278
+ * @template {Node | undefined} CompileTree
279
+ * Input of `stringify`.
280
+ * @template {CompileResults | undefined} CompileResult
281
+ * Output of `stringify`.
282
+ * @template {Node | string | undefined} Input
283
+ * Input of plugin.
284
+ * @template Output
285
+ * Output of plugin (optional).
286
+ * @typedef {(
287
+ * Input extends string
288
+ * ? Output extends Node | undefined
289
+ * ? // Parser.
290
+ * Processor<
291
+ * Output extends undefined ? ParseTree : Output,
292
+ * HeadTree,
293
+ * TailTree,
294
+ * CompileTree,
295
+ * CompileResult
296
+ * >
297
+ * : // Unknown.
298
+ * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
299
+ * : Output extends CompileResults
300
+ * ? Input extends Node | undefined
301
+ * ? // Compiler.
302
+ * Processor<
303
+ * ParseTree,
304
+ * HeadTree,
305
+ * TailTree,
306
+ * Input extends undefined ? CompileTree : Input,
307
+ * Output extends undefined ? CompileResult : Output
308
+ * >
309
+ * : // Unknown.
310
+ * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
311
+ * : Input extends Node | undefined
312
+ * ? Output extends Node | undefined
313
+ * ? // Transform.
314
+ * Processor<
315
+ * ParseTree,
316
+ * HeadTree extends undefined ? Input : HeadTree,
317
+ * Output extends undefined ? TailTree : Output,
318
+ * CompileTree,
319
+ * CompileResult
320
+ * >
321
+ * : // Unknown.
322
+ * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
323
+ * : // Unknown.
324
+ * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
325
+ * )} UsePlugin
326
+ * Create a processor based on the input/output of a {@link Plugin plugin}.
327
+ */
328
+ /**
329
+ * @template {CompileResults | undefined} Result
330
+ * Node type that the transformer yields.
331
+ * @typedef {(
332
+ * Result extends Value | undefined ?
333
+ * VFile :
334
+ * VFile & {result: Result}
335
+ * )} VFileWithOutput
336
+ * Type to generate a {@linkcode VFile} corresponding to a compiler result.
337
+ *
338
+ * If a result that is not acceptable on a `VFile` is used, that will
339
+ * be stored on the `result` field of {@linkcode VFile}.
340
+ */
341
+ var import_extend = /* @__PURE__ */ __toESM(require_extend(), 1);
342
+ const own = {}.hasOwnProperty;
343
+ /**
344
+ * Create a new processor.
345
+ *
346
+ * @example
347
+ * This example shows how a new processor can be created (from `remark`) and linked
348
+ * to **stdin**(4) and **stdout**(4).
349
+ *
350
+ * ```js
351
+ * import process from 'node:process'
352
+ * import concatStream from 'concat-stream'
353
+ * import {remark} from 'remark'
354
+ *
355
+ * process.stdin.pipe(
356
+ * concatStream(function (buf) {
357
+ * process.stdout.write(String(remark().processSync(buf)))
358
+ * })
359
+ * )
360
+ * ```
361
+ *
362
+ * @returns
363
+ * New *unfrozen* processor (`processor`).
364
+ *
365
+ * This processor is configured to work the same as its ancestor.
366
+ * When the descendant processor is configured in the future it does not
367
+ * affect the ancestral processor.
368
+ */
369
+ const unified = new class Processor extends CallableInstance {
370
+ /**
371
+ * Create a processor.
372
+ */
373
+ constructor() {
374
+ super("copy");
375
+ /**
376
+ * Compiler to use (deprecated).
377
+ *
378
+ * @deprecated
379
+ * Use `compiler` instead.
380
+ * @type {(
381
+ * Compiler<
382
+ * CompileTree extends undefined ? Node : CompileTree,
383
+ * CompileResult extends undefined ? CompileResults : CompileResult
384
+ * > |
385
+ * undefined
386
+ * )}
387
+ */
388
+ this.Compiler = void 0;
389
+ /**
390
+ * Parser to use (deprecated).
391
+ *
392
+ * @deprecated
393
+ * Use `parser` instead.
394
+ * @type {(
395
+ * Parser<ParseTree extends undefined ? Node : ParseTree> |
396
+ * undefined
397
+ * )}
398
+ */
399
+ this.Parser = void 0;
400
+ /**
401
+ * Internal list of configured plugins.
402
+ *
403
+ * @deprecated
404
+ * This is a private internal property and should not be used.
405
+ * @type {Array<PluginTuple<Array<unknown>>>}
406
+ */
407
+ this.attachers = [];
408
+ /**
409
+ * Compiler to use.
410
+ *
411
+ * @type {(
412
+ * Compiler<
413
+ * CompileTree extends undefined ? Node : CompileTree,
414
+ * CompileResult extends undefined ? CompileResults : CompileResult
415
+ * > |
416
+ * undefined
417
+ * )}
418
+ */
419
+ this.compiler = void 0;
420
+ /**
421
+ * Internal state to track where we are while freezing.
422
+ *
423
+ * @deprecated
424
+ * This is a private internal property and should not be used.
425
+ * @type {number}
426
+ */
427
+ this.freezeIndex = -1;
428
+ /**
429
+ * Internal state to track whether we’re frozen.
430
+ *
431
+ * @deprecated
432
+ * This is a private internal property and should not be used.
433
+ * @type {boolean | undefined}
434
+ */
435
+ this.frozen = void 0;
436
+ /**
437
+ * Internal state.
438
+ *
439
+ * @deprecated
440
+ * This is a private internal property and should not be used.
441
+ * @type {Data}
442
+ */
443
+ this.namespace = {};
444
+ /**
445
+ * Parser to use.
446
+ *
447
+ * @type {(
448
+ * Parser<ParseTree extends undefined ? Node : ParseTree> |
449
+ * undefined
450
+ * )}
451
+ */
452
+ this.parser = void 0;
453
+ /**
454
+ * Internal list of configured transformers.
455
+ *
456
+ * @deprecated
457
+ * This is a private internal property and should not be used.
458
+ * @type {Pipeline}
459
+ */
460
+ this.transformers = trough();
461
+ }
462
+ /**
463
+ * Copy a processor.
464
+ *
465
+ * @deprecated
466
+ * This is a private internal method and should not be used.
467
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
468
+ * New *unfrozen* processor ({@linkcode Processor}) that is
469
+ * configured to work the same as its ancestor.
470
+ * When the descendant processor is configured in the future it does not
471
+ * affect the ancestral processor.
472
+ */
473
+ copy() {
474
+ const destination = new Processor();
475
+ let index = -1;
476
+ while (++index < this.attachers.length) {
477
+ const attacher = this.attachers[index];
478
+ destination.use(...attacher);
479
+ }
480
+ destination.data((0, import_extend.default)(true, {}, this.namespace));
481
+ return destination;
482
+ }
483
+ /**
484
+ * Configure the processor with info available to all plugins.
485
+ * Information is stored in an object.
486
+ *
487
+ * Typically, options can be given to a specific plugin, but sometimes it
488
+ * makes sense to have information shared with several plugins.
489
+ * For example, a list of HTML elements that are self-closing, which is
490
+ * needed during all phases.
491
+ *
492
+ * > **Note**: setting information cannot occur on *frozen* processors.
493
+ * > Call the processor first to create a new unfrozen processor.
494
+ *
495
+ * > **Note**: to register custom data in TypeScript, augment the
496
+ * > {@linkcode Data} interface.
497
+ *
498
+ * @example
499
+ * This example show how to get and set info:
500
+ *
501
+ * ```js
502
+ * import {unified} from 'unified'
503
+ *
504
+ * const processor = unified().data('alpha', 'bravo')
505
+ *
506
+ * processor.data('alpha') // => 'bravo'
507
+ *
508
+ * processor.data() // => {alpha: 'bravo'}
509
+ *
510
+ * processor.data({charlie: 'delta'})
511
+ *
512
+ * processor.data() // => {charlie: 'delta'}
513
+ * ```
514
+ *
515
+ * @template {keyof Data} Key
516
+ *
517
+ * @overload
518
+ * @returns {Data}
519
+ *
520
+ * @overload
521
+ * @param {Data} dataset
522
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
523
+ *
524
+ * @overload
525
+ * @param {Key} key
526
+ * @returns {Data[Key]}
527
+ *
528
+ * @overload
529
+ * @param {Key} key
530
+ * @param {Data[Key]} value
531
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
532
+ *
533
+ * @param {Data | Key} [key]
534
+ * Key to get or set, or entire dataset to set, or nothing to get the
535
+ * entire dataset (optional).
536
+ * @param {Data[Key]} [value]
537
+ * Value to set (optional).
538
+ * @returns {unknown}
539
+ * The current processor when setting, the value at `key` when getting, or
540
+ * the entire dataset when getting without key.
541
+ */
542
+ data(key, value) {
543
+ if (typeof key === "string") {
544
+ if (arguments.length === 2) {
545
+ assertUnfrozen("data", this.frozen);
546
+ this.namespace[key] = value;
547
+ return this;
548
+ }
549
+ return own.call(this.namespace, key) && this.namespace[key] || void 0;
550
+ }
551
+ if (key) {
552
+ assertUnfrozen("data", this.frozen);
553
+ this.namespace = key;
554
+ return this;
555
+ }
556
+ return this.namespace;
557
+ }
558
+ /**
559
+ * Freeze a processor.
560
+ *
561
+ * Frozen processors are meant to be extended and not to be configured
562
+ * directly.
563
+ *
564
+ * When a processor is frozen it cannot be unfrozen.
565
+ * New processors working the same way can be created by calling the
566
+ * processor.
567
+ *
568
+ * It’s possible to freeze processors explicitly by calling `.freeze()`.
569
+ * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
570
+ * `.stringify()`, `.process()`, or `.processSync()` are called.
571
+ *
572
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
573
+ * The current processor.
574
+ */
575
+ freeze() {
576
+ if (this.frozen) return this;
577
+ const self = this;
578
+ while (++this.freezeIndex < this.attachers.length) {
579
+ const [attacher, ...options] = this.attachers[this.freezeIndex];
580
+ if (options[0] === false) continue;
581
+ if (options[0] === true) options[0] = void 0;
582
+ const transformer = attacher.call(self, ...options);
583
+ if (typeof transformer === "function") this.transformers.use(transformer);
584
+ }
585
+ this.frozen = true;
586
+ this.freezeIndex = Number.POSITIVE_INFINITY;
587
+ return this;
588
+ }
589
+ /**
590
+ * Parse text to a syntax tree.
591
+ *
592
+ * > **Note**: `parse` freezes the processor if not already *frozen*.
593
+ *
594
+ * > **Note**: `parse` performs the parse phase, not the run phase or other
595
+ * > phases.
596
+ *
597
+ * @param {Compatible | undefined} [file]
598
+ * file to parse (optional); typically `string` or `VFile`; any value
599
+ * accepted as `x` in `new VFile(x)`.
600
+ * @returns {ParseTree extends undefined ? Node : ParseTree}
601
+ * Syntax tree representing `file`.
602
+ */
603
+ parse(file) {
604
+ this.freeze();
605
+ const realFile = vfile(file);
606
+ const parser = this.parser || this.Parser;
607
+ assertParser("parse", parser);
608
+ return parser(String(realFile), realFile);
609
+ }
610
+ /**
611
+ * Process the given file as configured on the processor.
612
+ *
613
+ * > **Note**: `process` freezes the processor if not already *frozen*.
614
+ *
615
+ * > **Note**: `process` performs the parse, run, and stringify phases.
616
+ *
617
+ * @overload
618
+ * @param {Compatible | undefined} file
619
+ * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
620
+ * @returns {undefined}
621
+ *
622
+ * @overload
623
+ * @param {Compatible | undefined} [file]
624
+ * @returns {Promise<VFileWithOutput<CompileResult>>}
625
+ *
626
+ * @param {Compatible | undefined} [file]
627
+ * File (optional); typically `string` or `VFile`]; any value accepted as
628
+ * `x` in `new VFile(x)`.
629
+ * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
630
+ * Callback (optional).
631
+ * @returns {Promise<VFile> | undefined}
632
+ * Nothing if `done` is given.
633
+ * Otherwise a promise, rejected with a fatal error or resolved with the
634
+ * processed file.
635
+ *
636
+ * The parsed, transformed, and compiled value is available at
637
+ * `file.value` (see note).
638
+ *
639
+ * > **Note**: unified typically compiles by serializing: most
640
+ * > compilers return `string` (or `Uint8Array`).
641
+ * > Some compilers, such as the one configured with
642
+ * > [`rehype-react`][rehype-react], return other values (in this case, a
643
+ * > React tree).
644
+ * > If you’re using a compiler that doesn’t serialize, expect different
645
+ * > result values.
646
+ * >
647
+ * > To register custom results in TypeScript, add them to
648
+ * > {@linkcode CompileResultMap}.
649
+ *
650
+ * [rehype-react]: https://github.com/rehypejs/rehype-react
651
+ */
652
+ process(file, done) {
653
+ const self = this;
654
+ this.freeze();
655
+ assertParser("process", this.parser || this.Parser);
656
+ assertCompiler("process", this.compiler || this.Compiler);
657
+ return done ? executor(void 0, done) : new Promise(executor);
658
+ /**
659
+ * @param {((file: VFileWithOutput<CompileResult>) => undefined | void) | undefined} resolve
660
+ * @param {(error: Error | undefined) => undefined | void} reject
661
+ * @returns {undefined}
662
+ */
663
+ function executor(resolve, reject) {
664
+ const realFile = vfile(file);
665
+ const parseTree = self.parse(realFile);
666
+ self.run(parseTree, realFile, function(error, tree, file) {
667
+ if (error || !tree || !file) return realDone(error);
668
+ const compileTree = tree;
669
+ const compileResult = self.stringify(compileTree, file);
670
+ if (looksLikeAValue(compileResult)) file.value = compileResult;
671
+ else file.result = compileResult;
672
+ realDone(error, file);
673
+ });
674
+ /**
675
+ * @param {Error | undefined} error
676
+ * @param {VFileWithOutput<CompileResult> | undefined} [file]
677
+ * @returns {undefined}
678
+ */
679
+ function realDone(error, file) {
680
+ if (error || !file) reject(error);
681
+ else if (resolve) resolve(file);
682
+ else done(void 0, file);
683
+ }
684
+ }
685
+ }
686
+ /**
687
+ * Process the given file as configured on the processor.
688
+ *
689
+ * An error is thrown if asynchronous transforms are configured.
690
+ *
691
+ * > **Note**: `processSync` freezes the processor if not already *frozen*.
692
+ *
693
+ * > **Note**: `processSync` performs the parse, run, and stringify phases.
694
+ *
695
+ * @param {Compatible | undefined} [file]
696
+ * File (optional); typically `string` or `VFile`; any value accepted as
697
+ * `x` in `new VFile(x)`.
698
+ * @returns {VFileWithOutput<CompileResult>}
699
+ * The processed file.
700
+ *
701
+ * The parsed, transformed, and compiled value is available at
702
+ * `file.value` (see note).
703
+ *
704
+ * > **Note**: unified typically compiles by serializing: most
705
+ * > compilers return `string` (or `Uint8Array`).
706
+ * > Some compilers, such as the one configured with
707
+ * > [`rehype-react`][rehype-react], return other values (in this case, a
708
+ * > React tree).
709
+ * > If you’re using a compiler that doesn’t serialize, expect different
710
+ * > result values.
711
+ * >
712
+ * > To register custom results in TypeScript, add them to
713
+ * > {@linkcode CompileResultMap}.
714
+ *
715
+ * [rehype-react]: https://github.com/rehypejs/rehype-react
716
+ */
717
+ processSync(file) {
718
+ /** @type {boolean} */
719
+ let complete = false;
720
+ /** @type {VFileWithOutput<CompileResult> | undefined} */
721
+ let result;
722
+ this.freeze();
723
+ assertParser("processSync", this.parser || this.Parser);
724
+ assertCompiler("processSync", this.compiler || this.Compiler);
725
+ this.process(file, realDone);
726
+ assertDone("processSync", "process", complete);
727
+ return result;
728
+ /**
729
+ * @type {ProcessCallback<VFileWithOutput<CompileResult>>}
730
+ */
731
+ function realDone(error, file) {
732
+ complete = true;
733
+ bail(error);
734
+ result = file;
735
+ }
736
+ }
737
+ /**
738
+ * Run *transformers* on a syntax tree.
739
+ *
740
+ * > **Note**: `run` freezes the processor if not already *frozen*.
741
+ *
742
+ * > **Note**: `run` performs the run phase, not other phases.
743
+ *
744
+ * @overload
745
+ * @param {HeadTree extends undefined ? Node : HeadTree} tree
746
+ * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
747
+ * @returns {undefined}
748
+ *
749
+ * @overload
750
+ * @param {HeadTree extends undefined ? Node : HeadTree} tree
751
+ * @param {Compatible | undefined} file
752
+ * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
753
+ * @returns {undefined}
754
+ *
755
+ * @overload
756
+ * @param {HeadTree extends undefined ? Node : HeadTree} tree
757
+ * @param {Compatible | undefined} [file]
758
+ * @returns {Promise<TailTree extends undefined ? Node : TailTree>}
759
+ *
760
+ * @param {HeadTree extends undefined ? Node : HeadTree} tree
761
+ * Tree to transform and inspect.
762
+ * @param {(
763
+ * RunCallback<TailTree extends undefined ? Node : TailTree> |
764
+ * Compatible
765
+ * )} [file]
766
+ * File associated with `node` (optional); any value accepted as `x` in
767
+ * `new VFile(x)`.
768
+ * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
769
+ * Callback (optional).
770
+ * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
771
+ * Nothing if `done` is given.
772
+ * Otherwise, a promise rejected with a fatal error or resolved with the
773
+ * transformed tree.
774
+ */
775
+ run(tree, file, done) {
776
+ assertNode(tree);
777
+ this.freeze();
778
+ const transformers = this.transformers;
779
+ if (!done && typeof file === "function") {
780
+ done = file;
781
+ file = void 0;
782
+ }
783
+ return done ? executor(void 0, done) : new Promise(executor);
784
+ /**
785
+ * @param {(
786
+ * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |
787
+ * undefined
788
+ * )} resolve
789
+ * @param {(error: Error) => undefined | void} reject
790
+ * @returns {undefined}
791
+ */
792
+ function executor(resolve, reject) {
793
+ const realFile = vfile(file);
794
+ transformers.run(tree, realFile, realDone);
795
+ /**
796
+ * @param {Error | undefined} error
797
+ * @param {Node} outputTree
798
+ * @param {VFile} file
799
+ * @returns {undefined}
800
+ */
801
+ function realDone(error, outputTree, file) {
802
+ const resultingTree = outputTree || tree;
803
+ if (error) reject(error);
804
+ else if (resolve) resolve(resultingTree);
805
+ else done(void 0, resultingTree, file);
806
+ }
807
+ }
808
+ }
809
+ /**
810
+ * Run *transformers* on a syntax tree.
811
+ *
812
+ * An error is thrown if asynchronous transforms are configured.
813
+ *
814
+ * > **Note**: `runSync` freezes the processor if not already *frozen*.
815
+ *
816
+ * > **Note**: `runSync` performs the run phase, not other phases.
817
+ *
818
+ * @param {HeadTree extends undefined ? Node : HeadTree} tree
819
+ * Tree to transform and inspect.
820
+ * @param {Compatible | undefined} [file]
821
+ * File associated with `node` (optional); any value accepted as `x` in
822
+ * `new VFile(x)`.
823
+ * @returns {TailTree extends undefined ? Node : TailTree}
824
+ * Transformed tree.
825
+ */
826
+ runSync(tree, file) {
827
+ /** @type {boolean} */
828
+ let complete = false;
829
+ /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */
830
+ let result;
831
+ this.run(tree, file, realDone);
832
+ assertDone("runSync", "run", complete);
833
+ return result;
834
+ /**
835
+ * @type {RunCallback<TailTree extends undefined ? Node : TailTree>}
836
+ */
837
+ function realDone(error, tree) {
838
+ bail(error);
839
+ result = tree;
840
+ complete = true;
841
+ }
842
+ }
843
+ /**
844
+ * Compile a syntax tree.
845
+ *
846
+ * > **Note**: `stringify` freezes the processor if not already *frozen*.
847
+ *
848
+ * > **Note**: `stringify` performs the stringify phase, not the run phase
849
+ * > or other phases.
850
+ *
851
+ * @param {CompileTree extends undefined ? Node : CompileTree} tree
852
+ * Tree to compile.
853
+ * @param {Compatible | undefined} [file]
854
+ * File associated with `node` (optional); any value accepted as `x` in
855
+ * `new VFile(x)`.
856
+ * @returns {CompileResult extends undefined ? Value : CompileResult}
857
+ * Textual representation of the tree (see note).
858
+ *
859
+ * > **Note**: unified typically compiles by serializing: most compilers
860
+ * > return `string` (or `Uint8Array`).
861
+ * > Some compilers, such as the one configured with
862
+ * > [`rehype-react`][rehype-react], return other values (in this case, a
863
+ * > React tree).
864
+ * > If you’re using a compiler that doesn’t serialize, expect different
865
+ * > result values.
866
+ * >
867
+ * > To register custom results in TypeScript, add them to
868
+ * > {@linkcode CompileResultMap}.
869
+ *
870
+ * [rehype-react]: https://github.com/rehypejs/rehype-react
871
+ */
872
+ stringify(tree, file) {
873
+ this.freeze();
874
+ const realFile = vfile(file);
875
+ const compiler = this.compiler || this.Compiler;
876
+ assertCompiler("stringify", compiler);
877
+ assertNode(tree);
878
+ return compiler(tree, realFile);
879
+ }
880
+ /**
881
+ * Configure the processor to use a plugin, a list of usable values, or a
882
+ * preset.
883
+ *
884
+ * If the processor is already using a plugin, the previous plugin
885
+ * configuration is changed based on the options that are passed in.
886
+ * In other words, the plugin is not added a second time.
887
+ *
888
+ * > **Note**: `use` cannot be called on *frozen* processors.
889
+ * > Call the processor first to create a new unfrozen processor.
890
+ *
891
+ * @example
892
+ * There are many ways to pass plugins to `.use()`.
893
+ * This example gives an overview:
894
+ *
895
+ * ```js
896
+ * import {unified} from 'unified'
897
+ *
898
+ * unified()
899
+ * // Plugin with options:
900
+ * .use(pluginA, {x: true, y: true})
901
+ * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
902
+ * .use(pluginA, {y: false, z: true})
903
+ * // Plugins:
904
+ * .use([pluginB, pluginC])
905
+ * // Two plugins, the second with options:
906
+ * .use([pluginD, [pluginE, {}]])
907
+ * // Preset with plugins and settings:
908
+ * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
909
+ * // Settings only:
910
+ * .use({settings: {position: false}})
911
+ * ```
912
+ *
913
+ * @template {Array<unknown>} [Parameters=[]]
914
+ * @template {Node | string | undefined} [Input=undefined]
915
+ * @template [Output=Input]
916
+ *
917
+ * @overload
918
+ * @param {Preset | null | undefined} [preset]
919
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
920
+ *
921
+ * @overload
922
+ * @param {PluggableList} list
923
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
924
+ *
925
+ * @overload
926
+ * @param {Plugin<Parameters, Input, Output>} plugin
927
+ * @param {...(Parameters | [boolean])} parameters
928
+ * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
929
+ *
930
+ * @param {PluggableList | Plugin | Preset | null | undefined} value
931
+ * Usable value.
932
+ * @param {...unknown} parameters
933
+ * Parameters, when a plugin is given as a usable value.
934
+ * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
935
+ * Current processor.
936
+ */
937
+ use(value, ...parameters) {
938
+ const attachers = this.attachers;
939
+ const namespace = this.namespace;
940
+ assertUnfrozen("use", this.frozen);
941
+ if (value === null || value === void 0) {} else if (typeof value === "function") addPlugin(value, parameters);
942
+ else if (typeof value === "object") if (Array.isArray(value)) addList(value);
943
+ else addPreset(value);
944
+ else throw new TypeError("Expected usable value, not `" + value + "`");
945
+ return this;
946
+ /**
947
+ * @param {Pluggable} value
948
+ * @returns {undefined}
949
+ */
950
+ function add(value) {
951
+ if (typeof value === "function") addPlugin(value, []);
952
+ else if (typeof value === "object") if (Array.isArray(value)) {
953
+ const [plugin, ...parameters] = value;
954
+ addPlugin(plugin, parameters);
955
+ } else addPreset(value);
956
+ else throw new TypeError("Expected usable value, not `" + value + "`");
957
+ }
958
+ /**
959
+ * @param {Preset} result
960
+ * @returns {undefined}
961
+ */
962
+ function addPreset(result) {
963
+ if (!("plugins" in result) && !("settings" in result)) throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");
964
+ addList(result.plugins);
965
+ if (result.settings) namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings);
966
+ }
967
+ /**
968
+ * @param {PluggableList | null | undefined} plugins
969
+ * @returns {undefined}
970
+ */
971
+ function addList(plugins) {
972
+ let index = -1;
973
+ if (plugins === null || plugins === void 0) {} else if (Array.isArray(plugins)) while (++index < plugins.length) {
974
+ const thing = plugins[index];
975
+ add(thing);
976
+ }
977
+ else throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
978
+ }
979
+ /**
980
+ * @param {Plugin} plugin
981
+ * @param {Array<unknown>} parameters
982
+ * @returns {undefined}
983
+ */
984
+ function addPlugin(plugin, parameters) {
985
+ let index = -1;
986
+ let entryIndex = -1;
987
+ while (++index < attachers.length) if (attachers[index][0] === plugin) {
988
+ entryIndex = index;
989
+ break;
990
+ }
991
+ if (entryIndex === -1) attachers.push([plugin, ...parameters]);
992
+ else if (parameters.length > 0) {
993
+ let [primary, ...rest] = parameters;
994
+ const currentPrimary = attachers[entryIndex][1];
995
+ if (isPlainObject(currentPrimary) && isPlainObject(primary)) primary = (0, import_extend.default)(true, currentPrimary, primary);
996
+ attachers[entryIndex] = [
997
+ plugin,
998
+ primary,
999
+ ...rest
1000
+ ];
1001
+ }
1002
+ }
1003
+ }
1004
+ }().freeze();
1005
+ /**
1006
+ * Assert a parser is available.
1007
+ *
1008
+ * @param {string} name
1009
+ * @param {unknown} value
1010
+ * @returns {asserts value is Parser}
1011
+ */
1012
+ function assertParser(name, value) {
1013
+ if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `parser`");
1014
+ }
1015
+ /**
1016
+ * Assert a compiler is available.
1017
+ *
1018
+ * @param {string} name
1019
+ * @param {unknown} value
1020
+ * @returns {asserts value is Compiler}
1021
+ */
1022
+ function assertCompiler(name, value) {
1023
+ if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `compiler`");
1024
+ }
1025
+ /**
1026
+ * Assert the processor is not frozen.
1027
+ *
1028
+ * @param {string} name
1029
+ * @param {unknown} frozen
1030
+ * @returns {asserts frozen is false}
1031
+ */
1032
+ function assertUnfrozen(name, frozen) {
1033
+ if (frozen) throw new Error("Cannot call `" + name + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.");
1034
+ }
1035
+ /**
1036
+ * Assert `node` is a unist node.
1037
+ *
1038
+ * @param {unknown} node
1039
+ * @returns {asserts node is Node}
1040
+ */
1041
+ function assertNode(node) {
1042
+ if (!isPlainObject(node) || typeof node.type !== "string") throw new TypeError("Expected node, got `" + node + "`");
1043
+ }
1044
+ /**
1045
+ * Assert that `complete` is `true`.
1046
+ *
1047
+ * @param {string} name
1048
+ * @param {string} asyncName
1049
+ * @param {unknown} complete
1050
+ * @returns {asserts complete is true}
1051
+ */
1052
+ function assertDone(name, asyncName, complete) {
1053
+ if (!complete) throw new Error("`" + name + "` finished async. Use `" + asyncName + "` instead");
1054
+ }
1055
+ /**
1056
+ * @param {Compatible | undefined} [value]
1057
+ * @returns {VFile}
1058
+ */
1059
+ function vfile(value) {
1060
+ return looksLikeAVFile(value) ? value : new VFile(value);
1061
+ }
1062
+ /**
1063
+ * @param {Compatible | undefined} [value]
1064
+ * @returns {value is VFile}
1065
+ */
1066
+ function looksLikeAVFile(value) {
1067
+ return Boolean(value && typeof value === "object" && "message" in value && "messages" in value);
1068
+ }
1069
+ /**
1070
+ * @param {unknown} [value]
1071
+ * @returns {value is Value}
1072
+ */
1073
+ function looksLikeAValue(value) {
1074
+ return typeof value === "string" || isUint8Array(value);
1075
+ }
1076
+ /**
1077
+ * Assert `value` is an `Uint8Array`.
1078
+ *
1079
+ * @param {unknown} value
1080
+ * thing.
1081
+ * @returns {value is Uint8Array}
1082
+ * Whether `value` is an `Uint8Array`.
1083
+ */
1084
+ function isUint8Array(value) {
1085
+ return Boolean(value && typeof value === "object" && "byteLength" in value && "byteOffset" in value);
1086
+ }
1087
+ //#endregion
1088
+ export { unified };