From f78547e51b5fcef9cee76be991868dd724af913c Mon Sep 17 00:00:00 2001 From: Ida Dittrich Date: Mon, 5 Jan 2026 06:40:09 +0100 Subject: [PATCH] fix:constant reload --- app.py | 3 + modules/connectors/connectorPreprocessor.py | 169 + modules/datamodels/datamodelChat.py | 7 + modules/features/chatbot/__init__.py | 7 + modules/features/chatbot/eventManager.py | 152 + modules/features/chatbot/mainChatbot.py | 1352 + modules/interfaces/interfaceDbChatObjects.py | 41 +- modules/routes/routeChatbot.py | 444 + .../methods/methodChatbot/__init__.py | 6 + .../methods/methodChatbot/actions/__init__.py | 3 + .../methodChatbot/actions/queryDatabase.py | 146 + .../methods/methodChatbot/methodChatbot.py | 52 + node_modules/.package-lock.json | 1530 ++ node_modules/@types/debug/LICENSE | 21 + node_modules/@types/debug/README.md | 69 + node_modules/@types/debug/index.d.ts | 50 + node_modules/@types/debug/package.json | 57 + node_modules/@types/estree-jsx/LICENSE | 21 + node_modules/@types/estree-jsx/README.md | 15 + node_modules/@types/estree-jsx/index.d.ts | 114 + node_modules/@types/estree-jsx/package.json | 27 + node_modules/@types/estree/LICENSE | 21 + node_modules/@types/estree/README.md | 15 + node_modules/@types/estree/flow.d.ts | 167 + node_modules/@types/estree/index.d.ts | 694 + node_modules/@types/estree/package.json | 27 + node_modules/@types/hast/LICENSE | 21 + node_modules/@types/hast/README.md | 15 + node_modules/@types/hast/index.d.ts | 282 + node_modules/@types/hast/package.json | 42 + node_modules/@types/mdast/LICENSE | 21 + node_modules/@types/mdast/README.md | 15 + node_modules/@types/mdast/index.d.ts | 1123 + node_modules/@types/mdast/package.json | 47 + node_modules/@types/ms/LICENSE | 21 + node_modules/@types/ms/README.md | 82 + node_modules/@types/ms/index.d.ts | 63 + node_modules/@types/ms/package.json | 26 + node_modules/@types/react/LICENSE | 21 + node_modules/@types/react/README.md | 15 + node_modules/@types/react/canary.d.ts | 120 + .../@types/react/compiler-runtime.d.ts | 4 + node_modules/@types/react/experimental.d.ts | 147 + node_modules/@types/react/global.d.ts | 165 + node_modules/@types/react/index.d.ts | 4324 +++ .../@types/react/jsx-dev-runtime.d.ts | 45 + node_modules/@types/react/jsx-runtime.d.ts | 36 + node_modules/@types/react/package.json | 210 + node_modules/@types/react/ts5.0/canary.d.ts | 120 + .../@types/react/ts5.0/experimental.d.ts | 147 + node_modules/@types/react/ts5.0/global.d.ts | 165 + node_modules/@types/react/ts5.0/index.d.ts | 4311 +++ .../@types/react/ts5.0/jsx-dev-runtime.d.ts | 44 + .../@types/react/ts5.0/jsx-runtime.d.ts | 35 + node_modules/@types/unist/LICENSE | 21 + node_modules/@types/unist/README.md | 15 + node_modules/@types/unist/index.d.ts | 119 + node_modules/@types/unist/package.json | 60 + .../.github/workflows/node.js.yml | 31 + node_modules/@ungap/structured-clone/LICENSE | 15 + .../@ungap/structured-clone/README.md | 95 + .../structured-clone/cjs/deserialize.js | 84 + .../@ungap/structured-clone/cjs/index.js | 27 + .../@ungap/structured-clone/cjs/json.js | 24 + .../@ungap/structured-clone/cjs/package.json | 1 + .../@ungap/structured-clone/cjs/serialize.js | 170 + .../@ungap/structured-clone/cjs/types.js | 22 + .../structured-clone/esm/deserialize.js | 85 + .../@ungap/structured-clone/esm/index.js | 25 + .../@ungap/structured-clone/esm/json.js | 21 + .../@ungap/structured-clone/esm/serialize.js | 171 + .../@ungap/structured-clone/esm/types.js | 11 + .../@ungap/structured-clone/package.json | 54 + .../structured-clone/structured-json.js | 1 + node_modules/bail/index.d.ts | 10 + node_modules/bail/index.js | 12 + node_modules/bail/license | 22 + node_modules/bail/package.json | 73 + node_modules/bail/readme.md | 147 + node_modules/ccount/index.d.ts | 11 + node_modules/ccount/index.js | 27 + node_modules/ccount/license | 22 + node_modules/ccount/package.json | 71 + node_modules/ccount/readme.md | 149 + .../character-entities-html4/index.d.ts | 6 + .../character-entities-html4/index.js | 259 + node_modules/character-entities-html4/license | 22 + .../character-entities-html4/package.json | 79 + .../character-entities-html4/readme.md | 153 + .../character-entities-legacy/index.d.ts | 6 + .../character-entities-legacy/index.js | 113 + .../character-entities-legacy/license | 22 + .../character-entities-legacy/package.json | 77 + .../character-entities-legacy/readme.md | 157 + node_modules/character-entities/index.d.ts | 6 + node_modules/character-entities/index.js | 2132 ++ node_modules/character-entities/license | 22 + node_modules/character-entities/package.json | 78 + node_modules/character-entities/readme.md | 152 + .../character-reference-invalid/index.d.ts | 6 + .../character-reference-invalid/index.js | 35 + .../character-reference-invalid/license | 22 + .../character-reference-invalid/package.json | 83 + .../character-reference-invalid/readme.md | 156 + .../comma-separated-tokens/index.d.ts | 52 + node_modules/comma-separated-tokens/index.js | 74 + node_modules/comma-separated-tokens/license | 22 + .../comma-separated-tokens/package.json | 72 + node_modules/comma-separated-tokens/readme.md | 167 + node_modules/csstype/LICENSE | 19 + node_modules/csstype/README.md | 291 + node_modules/csstype/index.d.ts | 22569 ++++++++++++++++ node_modules/csstype/index.js.flow | 6863 +++++ node_modules/csstype/package.json | 70 + node_modules/debug/LICENSE | 20 + node_modules/debug/README.md | 481 + node_modules/debug/package.json | 64 + node_modules/debug/src/browser.js | 272 + node_modules/debug/src/common.js | 292 + node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 263 + .../index.d.ts | 13 + .../index.d.ts.map | 1 + .../index.dom.d.ts | 6 + .../index.dom.d.ts.map | 1 + .../index.dom.js | 36 + .../decode-named-character-reference/index.js | 19 + .../decode-named-character-reference/license | 22 + .../package.json | 89 + .../readme.md | 136 + node_modules/dequal/index.d.ts | 1 + node_modules/dequal/license | 21 + node_modules/dequal/lite/index.d.ts | 1 + node_modules/dequal/lite/index.js | 31 + node_modules/dequal/lite/index.min.js | 1 + node_modules/dequal/lite/index.mjs | 29 + node_modules/dequal/package.json | 57 + node_modules/dequal/readme.md | 112 + node_modules/devlop/license | 22 + node_modules/devlop/package.json | 80 + node_modules/devlop/readme.md | 360 + node_modules/escape-string-regexp/index.d.ts | 16 + node_modules/escape-string-regexp/index.js | 11 + node_modules/escape-string-regexp/license | 9 + .../escape-string-regexp/package.json | 40 + node_modules/escape-string-regexp/readme.md | 34 + .../estree-util-is-identifier-name/index.d.ts | 2 + .../estree-util-is-identifier-name/index.js | 5 + .../estree-util-is-identifier-name/license | 22 + .../package.json | 73 + .../estree-util-is-identifier-name/readme.md | 225 + node_modules/extend/.editorconfig | 20 + node_modules/extend/.eslintrc | 17 + node_modules/extend/.jscs.json | 175 + node_modules/extend/.travis.yml | 230 + node_modules/extend/CHANGELOG.md | 83 + node_modules/extend/LICENSE | 23 + node_modules/extend/README.md | 81 + node_modules/extend/component.json | 32 + node_modules/extend/index.js | 117 + node_modules/extend/package.json | 42 + .../hast-util-to-jsx-runtime/index.d.ts | 18 + .../hast-util-to-jsx-runtime/index.js | 2 + node_modules/hast-util-to-jsx-runtime/license | 22 + .../hast-util-to-jsx-runtime/package.json | 138 + .../hast-util-to-jsx-runtime/readme.md | 886 + node_modules/hast-util-whitespace/index.d.ts | 1 + node_modules/hast-util-whitespace/index.js | 1 + node_modules/hast-util-whitespace/license | 22 + .../hast-util-whitespace/package.json | 83 + node_modules/hast-util-whitespace/readme.md | 231 + node_modules/html-url-attributes/index.d.ts | 2 + .../html-url-attributes/index.d.ts.map | 1 + node_modules/html-url-attributes/index.js | 33 + node_modules/html-url-attributes/license | 21 + node_modules/html-url-attributes/package.json | 45 + node_modules/html-url-attributes/readme.md | 180 + node_modules/inline-style-parser/LICENSE | 9 + node_modules/inline-style-parser/README.md | 229 + .../inline-style-parser/cjs/index.d.cts | 34 + node_modules/inline-style-parser/cjs/index.js | 262 + .../inline-style-parser/cjs/index.js.map | 1 + .../inline-style-parser/esm/index.d.mts | 34 + .../inline-style-parser/esm/index.mjs | 260 + .../inline-style-parser/esm/index.mjs.map | 1 + node_modules/inline-style-parser/index.d.ts | 34 + node_modules/inline-style-parser/package.json | 77 + node_modules/is-alphabetical/index.d.ts | 8 + node_modules/is-alphabetical/index.js | 16 + node_modules/is-alphabetical/license | 22 + node_modules/is-alphabetical/package.json | 73 + node_modules/is-alphabetical/readme.md | 141 + node_modules/is-alphanumerical/index.d.ts | 8 + node_modules/is-alphanumerical/index.js | 13 + node_modules/is-alphanumerical/license | 22 + node_modules/is-alphanumerical/package.json | 79 + node_modules/is-alphanumerical/readme.md | 142 + node_modules/is-decimal/index.d.ts | 8 + node_modules/is-decimal/index.js | 13 + node_modules/is-decimal/license | 22 + node_modules/is-decimal/package.json | 73 + node_modules/is-decimal/readme.md | 139 + node_modules/is-hexadecimal/index.d.ts | 8 + node_modules/is-hexadecimal/index.js | 17 + node_modules/is-hexadecimal/license | 22 + node_modules/is-hexadecimal/package.json | 73 + node_modules/is-hexadecimal/readme.md | 141 + node_modules/is-plain-obj/index.d.ts | 35 + node_modules/is-plain-obj/index.js | 8 + node_modules/is-plain-obj/license | 9 + node_modules/is-plain-obj/package.json | 41 + node_modules/is-plain-obj/readme.md | 58 + node_modules/longest-streak/index.d.ts | 11 + node_modules/longest-streak/index.js | 36 + node_modules/longest-streak/license | 22 + node_modules/longest-streak/package.json | 73 + node_modules/longest-streak/readme.md | 150 + node_modules/markdown-table/index.d.ts | 171 + node_modules/markdown-table/index.d.ts.map | 1 + node_modules/markdown-table/index.js | 393 + node_modules/markdown-table/license | 22 + node_modules/markdown-table/package.json | 77 + node_modules/markdown-table/readme.md | 344 + .../mdast-util-find-and-replace/index.d.ts | 9 + .../index.d.ts.map | 1 + .../mdast-util-find-and-replace/index.js | 11 + .../mdast-util-find-and-replace/license | 22 + .../mdast-util-find-and-replace/package.json | 85 + .../mdast-util-find-and-replace/readme.md | 368 + .../mdast-util-from-markdown/dev/index.d.ts | 23 + .../mdast-util-from-markdown/dev/index.js | 2 + .../mdast-util-from-markdown/index.d.ts | 23 + .../mdast-util-from-markdown/index.js | 2 + node_modules/mdast-util-from-markdown/license | 22 + .../mdast-util-from-markdown/package.json | 139 + .../mdast-util-from-markdown/readme.md | 537 + .../index.d.ts | 1 + .../mdast-util-gfm-autolink-literal/index.js | 4 + .../mdast-util-gfm-autolink-literal/license | 22 + .../package.json | 106 + .../mdast-util-gfm-autolink-literal/readme.md | 334 + .../mdast-util-gfm-footnote/index.d.ts | 34 + node_modules/mdast-util-gfm-footnote/index.js | 2 + node_modules/mdast-util-gfm-footnote/license | 22 + .../mdast-util-gfm-footnote/package.json | 111 + .../mdast-util-gfm-footnote/readme.md | 494 + .../mdast-util-gfm-strikethrough/index.d.ts | 19 + .../mdast-util-gfm-strikethrough/index.js | 5 + .../mdast-util-gfm-strikethrough/license | 22 + .../mdast-util-gfm-strikethrough/package.json | 99 + .../mdast-util-gfm-strikethrough/readme.md | 350 + node_modules/mdast-util-gfm-table/index.d.ts | 54 + node_modules/mdast-util-gfm-table/index.js | 2 + node_modules/mdast-util-gfm-table/license | 22 + .../mdast-util-gfm-table/package.json | 101 + node_modules/mdast-util-gfm-table/readme.md | 605 + .../mdast-util-gfm-task-list-item/index.d.ts | 4 + .../mdast-util-gfm-task-list-item/index.js | 4 + .../mdast-util-gfm-task-list-item/license | 22 + .../package.json | 90 + .../mdast-util-gfm-task-list-item/readme.md | 366 + node_modules/mdast-util-gfm/index.d.ts | 12 + node_modules/mdast-util-gfm/index.js | 2 + node_modules/mdast-util-gfm/license | 22 + node_modules/mdast-util-gfm/package.json | 125 + node_modules/mdast-util-gfm/readme.md | 497 + .../mdast-util-mdx-expression/index.d.ts | 161 + .../mdast-util-mdx-expression/index.js | 5 + .../mdast-util-mdx-expression/license | 22 + .../mdast-util-mdx-expression/package.json | 106 + .../mdast-util-mdx-expression/readme.md | 531 + node_modules/mdast-util-mdx-jsx/index.d.ts | 344 + node_modules/mdast-util-mdx-jsx/index.js | 2 + node_modules/mdast-util-mdx-jsx/license | 22 + node_modules/mdast-util-mdx-jsx/package.json | 113 + node_modules/mdast-util-mdx-jsx/readme.md | 719 + node_modules/mdast-util-mdxjs-esm/index.d.ts | 82 + node_modules/mdast-util-mdxjs-esm/index.js | 2 + node_modules/mdast-util-mdxjs-esm/license | 22 + .../mdast-util-mdxjs-esm/package.json | 106 + node_modules/mdast-util-mdxjs-esm/readme.md | 448 + node_modules/mdast-util-phrasing/index.d.ts | 1 + node_modules/mdast-util-phrasing/index.js | 1 + node_modules/mdast-util-phrasing/license | 23 + node_modules/mdast-util-phrasing/package.json | 78 + node_modules/mdast-util-phrasing/readme.md | 200 + node_modules/mdast-util-to-hast/index.d.ts | 94 + node_modules/mdast-util-to-hast/index.js | 7 + node_modules/mdast-util-to-hast/license | 22 + node_modules/mdast-util-to-hast/package.json | 119 + node_modules/mdast-util-to-hast/readme.md | 1725 ++ .../mdast-util-to-markdown/index.d.ts | 16 + node_modules/mdast-util-to-markdown/index.js | 3 + node_modules/mdast-util-to-markdown/license | 22 + .../mdast-util-to-markdown/package.json | 132 + node_modules/mdast-util-to-markdown/readme.md | 750 + node_modules/mdast-util-to-string/index.d.ts | 2 + node_modules/mdast-util-to-string/index.js | 5 + node_modules/mdast-util-to-string/license | 22 + .../mdast-util-to-string/package.json | 78 + node_modules/mdast-util-to-string/readme.md | 218 + .../micromark-core-commonmark/dev/index.d.ts | 23 + .../dev/index.d.ts.map | 1 + .../micromark-core-commonmark/dev/index.js | 22 + .../micromark-core-commonmark/index.d.ts | 23 + .../micromark-core-commonmark/index.d.ts.map | 1 + .../micromark-core-commonmark/index.js | 22 + .../micromark-core-commonmark/license | 22 + .../micromark-core-commonmark/package.json | 74 + .../micromark-core-commonmark/readme.md | 171 + .../dev/index.d.ts | 24 + .../dev/index.js | 2 + .../index.d.ts | 24 + .../index.js | 2 + .../license | 22 + .../package.json | 116 + .../readme.md | 422 + .../dev/index.d.ts | 164 + .../dev/index.js | 3 + .../index.d.ts | 164 + .../micromark-extension-gfm-footnote/index.js | 3 + .../micromark-extension-gfm-footnote/license | 22 + .../package.json | 132 + .../readme.md | 656 + .../dev/index.d.ts | 30 + .../dev/index.js | 3 + .../index.d.ts | 24 + .../index.js | 3 + .../license | 22 + .../package.json | 129 + .../readme.md | 304 + .../dev/index.d.ts | 55 + .../dev/index.js | 2 + .../micromark-extension-gfm-table/index.d.ts | 55 + .../micromark-extension-gfm-table/index.js | 2 + .../micromark-extension-gfm-table/license | 22 + .../package.json | 128 + .../micromark-extension-gfm-table/readme.md | 515 + .../index.d.ts | 1 + .../index.js | 1 + .../micromark-extension-gfm-tagfilter/license | 22 + .../package.json | 82 + .../readme.md | 237 + .../dev/index.d.ts | 17 + .../dev/index.js | 2 + .../index.d.ts | 17 + .../index.js | 2 + .../license | 22 + .../package.json | 131 + .../readme.md | 305 + .../micromark-extension-gfm/index.d.ts | 28 + node_modules/micromark-extension-gfm/index.js | 69 + node_modules/micromark-extension-gfm/license | 22 + .../micromark-extension-gfm/package.json | 107 + .../micromark-extension-gfm/readme.md | 433 + .../dev/index.d.ts | 42 + .../dev/index.d.ts.map | 1 + .../dev/index.js | 255 + .../micromark-factory-destination/index.d.ts | 42 + .../index.d.ts.map | 1 + .../micromark-factory-destination/index.js | 206 + .../micromark-factory-destination/license | 22 + .../package.json | 57 + .../micromark-factory-destination/readme.md | 234 + .../micromark-factory-label/dev/index.d.ts | 37 + .../dev/index.d.ts.map | 1 + .../micromark-factory-label/dev/index.js | 172 + .../micromark-factory-label/index.d.ts | 37 + .../micromark-factory-label/index.d.ts.map | 1 + node_modules/micromark-factory-label/index.js | 148 + node_modules/micromark-factory-label/license | 22 + .../micromark-factory-label/package.json | 60 + .../micromark-factory-label/readme.md | 224 + .../micromark-factory-space/dev/index.d.ts | 37 + .../dev/index.d.ts.map | 1 + .../micromark-factory-space/dev/index.js | 67 + .../micromark-factory-space/index.d.ts | 37 + .../micromark-factory-space/index.d.ts.map | 1 + node_modules/micromark-factory-space/index.js | 64 + node_modules/micromark-factory-space/license | 22 + .../micromark-factory-space/package.json | 55 + .../micromark-factory-space/readme.md | 225 + .../micromark-factory-title/dev/index.d.ts | 36 + .../dev/index.d.ts.map | 1 + .../micromark-factory-title/dev/index.js | 169 + .../micromark-factory-title/index.d.ts | 36 + .../micromark-factory-title/index.d.ts.map | 1 + node_modules/micromark-factory-title/index.js | 158 + node_modules/micromark-factory-title/license | 22 + .../micromark-factory-title/package.json | 58 + .../micromark-factory-title/readme.md | 229 + .../dev/index.d.ts | 22 + .../dev/index.d.ts.map | 1 + .../micromark-factory-whitespace/dev/index.js | 53 + .../micromark-factory-whitespace/index.d.ts | 22 + .../index.d.ts.map | 1 + .../micromark-factory-whitespace/index.js | 44 + .../micromark-factory-whitespace/license | 22 + .../micromark-factory-whitespace/package.json | 57 + .../micromark-factory-whitespace/readme.md | 205 + .../micromark-util-character/dev/index.d.ts | 195 + .../dev/index.d.ts.map | 1 + .../micromark-util-character/dev/index.js | 252 + .../micromark-util-character/index.d.ts | 195 + .../micromark-util-character/index.d.ts.map | 1 + .../micromark-util-character/index.js | 246 + node_modules/micromark-util-character/license | 22 + .../micromark-util-character/package.json | 57 + .../micromark-util-character/readme.md | 446 + .../micromark-util-chunked/dev/index.d.ts | 41 + .../micromark-util-chunked/dev/index.d.ts.map | 1 + .../micromark-util-chunked/dev/index.js | 89 + .../micromark-util-chunked/index.d.ts | 41 + .../micromark-util-chunked/index.d.ts.map | 1 + node_modules/micromark-util-chunked/index.js | 81 + node_modules/micromark-util-chunked/license | 22 + .../micromark-util-chunked/package.json | 57 + node_modules/micromark-util-chunked/readme.md | 219 + .../dev/index.d.ts | 18 + .../dev/index.d.ts.map | 1 + .../dev/index.js | 38 + .../index.d.ts | 18 + .../index.d.ts.map | 1 + .../index.js | 27 + .../micromark-util-classify-character/license | 22 + .../package.json | 59 + .../readme.md | 205 + .../index.d.ts | 22 + .../index.d.ts.map | 1 + .../index.js | 143 + .../micromark-util-combine-extensions/license | 22 + .../package.json | 52 + .../readme.md | 201 + .../dev/index.d.ts | 16 + .../dev/index.d.ts.map | 1 + .../dev/index.js | 42 + .../index.d.ts | 16 + .../index.d.ts.map | 1 + .../index.js | 32 + .../license | 22 + .../package.json | 59 + .../readme.md | 184 + .../dev/index.d.ts | 14 + .../dev/index.d.ts.map | 1 + .../micromark-util-decode-string/dev/index.js | 53 + .../micromark-util-decode-string/index.d.ts | 14 + .../index.d.ts.map | 1 + .../micromark-util-decode-string/index.js | 45 + .../micromark-util-decode-string/license | 22 + .../micromark-util-decode-string/package.json | 63 + .../micromark-util-decode-string/readme.md | 179 + node_modules/micromark-util-encode/index.d.ts | 14 + .../micromark-util-encode/index.d.ts.map | 1 + node_modules/micromark-util-encode/index.js | 33 + node_modules/micromark-util-encode/license | 22 + .../micromark-util-encode/package.json | 47 + node_modules/micromark-util-encode/readme.md | 176 + .../micromark-util-html-tag-name/index.d.ts | 30 + .../index.d.ts.map | 1 + .../micromark-util-html-tag-name/index.js | 93 + .../micromark-util-html-tag-name/license | 22 + .../micromark-util-html-tag-name/package.json | 47 + .../micromark-util-html-tag-name/readme.md | 193 + .../dev/index.d.ts | 21 + .../dev/index.d.ts.map | 1 + .../dev/index.js | 38 + .../index.d.ts | 21 + .../index.d.ts.map | 1 + .../index.js | 33 + .../license | 22 + .../package.json | 58 + .../readme.md | 187 + .../micromark-util-resolve-all/index.d.ts | 22 + .../micromark-util-resolve-all/index.d.ts.map | 1 + .../micromark-util-resolve-all/index.js | 32 + .../micromark-util-resolve-all/license | 22 + .../micromark-util-resolve-all/package.json | 48 + .../micromark-util-resolve-all/readme.md | 238 + .../dev/index.d.ts | 36 + .../dev/index.d.ts.map | 1 + .../micromark-util-sanitize-uri/dev/index.js | 124 + .../micromark-util-sanitize-uri/index.d.ts | 36 + .../index.d.ts.map | 1 + .../micromark-util-sanitize-uri/index.js | 107 + .../micromark-util-sanitize-uri/license | 22 + .../micromark-util-sanitize-uri/package.json | 59 + .../micromark-util-sanitize-uri/readme.md | 214 + .../micromark-util-subtokenize/dev/index.d.ts | 12 + .../dev/index.d.ts.map | 1 + .../micromark-util-subtokenize/dev/index.js | 284 + .../micromark-util-subtokenize/index.d.ts | 12 + .../micromark-util-subtokenize/index.d.ts.map | 1 + .../micromark-util-subtokenize/index.js | 228 + .../micromark-util-subtokenize/license | 22 + .../micromark-util-subtokenize/package.json | 60 + .../micromark-util-subtokenize/readme.md | 181 + node_modules/micromark-util-symbol/license | 22 + .../micromark-util-symbol/package.json | 43 + node_modules/micromark-util-symbol/readme.md | 168 + node_modules/micromark-util-types/index.d.ts | 1312 + node_modules/micromark-util-types/index.js | 2 + node_modules/micromark-util-types/license | 22 + .../micromark-util-types/package.json | 71 + node_modules/micromark-util-types/readme.md | 151 + node_modules/micromark/dev/index.d.ts | 82 + node_modules/micromark/dev/index.d.ts.map | 1 + node_modules/micromark/dev/index.js | 68 + node_modules/micromark/dev/stream.d.ts | 35 + node_modules/micromark/dev/stream.d.ts.map | 1 + node_modules/micromark/dev/stream.js | 270 + node_modules/micromark/index.d.ts | 82 + node_modules/micromark/index.d.ts.map | 1 + node_modules/micromark/index.js | 60 + node_modules/micromark/license | 22 + node_modules/micromark/package.json | 100 + node_modules/micromark/readme.md | 488 + node_modules/micromark/stream.d.ts | 35 + node_modules/micromark/stream.d.ts.map | 1 + node_modules/micromark/stream.js | 256 + node_modules/ms/index.js | 162 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/parse-entities/index.d.ts | 126 + node_modules/parse-entities/index.js | 3 + node_modules/parse-entities/license | 22 + .../node_modules/@types/unist/LICENSE | 21 + .../node_modules/@types/unist/README.md | 122 + .../node_modules/@types/unist/index.d.ts | 103 + .../node_modules/@types/unist/package.json | 55 + node_modules/parse-entities/package.json | 91 + node_modules/parse-entities/readme.md | 266 + node_modules/property-information/index.d.ts | 118 + node_modules/property-information/index.js | 17 + node_modules/property-information/license | 22 + .../property-information/package.json | 121 + node_modules/property-information/readme.md | 1062 + node_modules/react-markdown/index.d.ts | 7 + node_modules/react-markdown/index.d.ts.map | 1 + node_modules/react-markdown/index.js | 14 + node_modules/react-markdown/license | 21 + node_modules/react-markdown/package.json | 167 + node_modules/react-markdown/readme.md | 932 + node_modules/react/LICENSE | 21 + node_modules/react/README.md | 37 + .../cjs/react-compiler-runtime.development.js | 24 + .../cjs/react-compiler-runtime.production.js | 16 + .../cjs/react-compiler-runtime.profiling.js | 16 + .../cjs/react-jsx-dev-runtime.development.js | 338 + .../cjs/react-jsx-dev-runtime.production.js | 14 + .../cjs/react-jsx-dev-runtime.profiling.js | 14 + ...sx-dev-runtime.react-server.development.js | 370 + ...jsx-dev-runtime.react-server.production.js | 40 + .../cjs/react-jsx-runtime.development.js | 352 + .../react/cjs/react-jsx-runtime.production.js | 34 + .../react/cjs/react-jsx-runtime.profiling.js | 34 + ...ct-jsx-runtime.react-server.development.js | 370 + ...act-jsx-runtime.react-server.production.js | 40 + node_modules/react/cjs/react.development.js | 1284 + node_modules/react/cjs/react.production.js | 542 + .../cjs/react.react-server.development.js | 848 + .../cjs/react.react-server.production.js | 423 + node_modules/react/compiler-runtime.js | 14 + node_modules/react/index.js | 7 + node_modules/react/jsx-dev-runtime.js | 7 + .../react/jsx-dev-runtime.react-server.js | 7 + node_modules/react/jsx-runtime.js | 7 + .../react/jsx-runtime.react-server.js | 7 + node_modules/react/package.json | 51 + node_modules/react/react.react-server.js | 7 + node_modules/remark-gfm/index.d.ts | 13 + node_modules/remark-gfm/index.js | 2 + node_modules/remark-gfm/license | 22 + node_modules/remark-gfm/package.json | 125 + node_modules/remark-gfm/readme.md | 518 + node_modules/remark-parse/index.d.ts | 55 + node_modules/remark-parse/index.js | 2 + node_modules/remark-parse/license | 21 + node_modules/remark-parse/package.json | 72 + node_modules/remark-parse/readme.md | 428 + node_modules/remark-rehype/index.d.ts | 4 + node_modules/remark-rehype/index.d.ts.map | 1 + node_modules/remark-rehype/index.js | 10 + node_modules/remark-rehype/license | 22 + node_modules/remark-rehype/package.json | 86 + node_modules/remark-rehype/readme.md | 802 + node_modules/remark-stringify/index.d.ts | 41 + node_modules/remark-stringify/index.js | 2 + node_modules/remark-stringify/license | 21 + node_modules/remark-stringify/package.json | 71 + node_modules/remark-stringify/readme.md | 407 + .../space-separated-tokens/index.d.ts | 18 + node_modules/space-separated-tokens/index.js | 24 + node_modules/space-separated-tokens/license | 22 + .../space-separated-tokens/package.json | 67 + node_modules/space-separated-tokens/readme.md | 156 + node_modules/stringify-entities/index.d.ts | 3 + node_modules/stringify-entities/index.js | 6 + node_modules/stringify-entities/license | 22 + node_modules/stringify-entities/package.json | 86 + node_modules/stringify-entities/readme.md | 233 + node_modules/style-to-js/LICENSE | 22 + node_modules/style-to-js/README.md | 271 + node_modules/style-to-js/cjs/index.d.ts | 14 + node_modules/style-to-js/cjs/index.d.ts.map | 1 + node_modules/style-to-js/cjs/index.js | 25 + node_modules/style-to-js/cjs/index.js.map | 1 + node_modules/style-to-js/cjs/utilities.d.ts | 11 + .../style-to-js/cjs/utilities.d.ts.map | 1 + node_modules/style-to-js/cjs/utilities.js | 47 + node_modules/style-to-js/cjs/utilities.js.map | 1 + node_modules/style-to-js/package.json | 70 + node_modules/style-to-js/src/index.test.ts | 129 + node_modules/style-to-js/src/index.ts | 31 + .../style-to-js/src/utilities.test.ts | 62 + node_modules/style-to-js/src/utilities.ts | 52 + node_modules/style-to-js/umd/style-to-js.js | 429 + .../style-to-js/umd/style-to-js.js.map | 1 + .../style-to-js/umd/style-to-js.min.js | 2 + .../style-to-js/umd/style-to-js.min.js.map | 1 + node_modules/style-to-object/LICENSE | 22 + node_modules/style-to-object/README.md | 188 + node_modules/style-to-object/cjs/index.d.ts | 22 + .../style-to-object/cjs/index.d.ts.map | 1 + node_modules/style-to-object/cjs/index.js | 44 + node_modules/style-to-object/cjs/index.js.map | 1 + node_modules/style-to-object/esm/index.d.ts | 22 + .../style-to-object/esm/index.d.ts.map | 1 + node_modules/style-to-object/esm/index.js | 38 + node_modules/style-to-object/esm/index.js.map | 1 + node_modules/style-to-object/esm/index.mjs | 41 + .../style-to-object/esm/index.mjs.map | 1 + node_modules/style-to-object/package.json | 92 + node_modules/style-to-object/src/index.ts | 59 + node_modules/trim-lines/index.d.ts | 10 + node_modules/trim-lines/index.js | 69 + node_modules/trim-lines/license | 22 + node_modules/trim-lines/package.json | 67 + node_modules/trim-lines/readme.md | 125 + node_modules/trough/index.d.ts | 7 + node_modules/trough/index.d.ts.map | 1 + node_modules/trough/index.js | 9 + node_modules/trough/license | 21 + node_modules/trough/package.json | 77 + node_modules/trough/readme.md | 494 + node_modules/unified/index.d.ts | 106 + node_modules/unified/index.js | 2 + node_modules/unified/license | 21 + node_modules/unified/package.json | 120 + node_modules/unified/readme.md | 1835 ++ node_modules/unist-util-is/index.d.ts | 5 + node_modules/unist-util-is/index.d.ts.map | 1 + node_modules/unist-util-is/index.js | 7 + node_modules/unist-util-is/license | 22 + node_modules/unist-util-is/package.json | 103 + node_modules/unist-util-is/readme.md | 351 + node_modules/unist-util-position/index.d.ts | 1 + node_modules/unist-util-position/index.js | 1 + node_modules/unist-util-position/license | 22 + node_modules/unist-util-position/package.json | 76 + node_modules/unist-util-position/readme.md | 243 + .../unist-util-stringify-position/index.d.ts | 1 + .../unist-util-stringify-position/index.js | 1 + .../unist-util-stringify-position/license | 22 + .../package.json | 80 + .../unist-util-stringify-position/readme.md | 206 + .../unist-util-visit-parents/index.d.ts | 14 + .../unist-util-visit-parents/index.js | 2 + node_modules/unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 106 + .../unist-util-visit-parents/readme.md | 388 + node_modules/unist-util-visit/index.d.ts | 9 + node_modules/unist-util-visit/index.js | 2 + node_modules/unist-util-visit/license | 22 + node_modules/unist-util-visit/package.json | 113 + node_modules/unist-util-visit/readme.md | 319 + node_modules/vfile-message/index.d.ts | 2 + node_modules/vfile-message/index.js | 5 + node_modules/vfile-message/license | 22 + node_modules/vfile-message/package.json | 80 + node_modules/vfile-message/readme.md | 252 + node_modules/vfile/index.d.ts | 153 + node_modules/vfile/index.js | 2 + node_modules/vfile/license | 21 + node_modules/vfile/package.json | 134 + node_modules/vfile/readme.md | 785 + node_modules/zwitch/index.d.ts | 67 + node_modules/zwitch/index.js | 118 + node_modules/zwitch/license | 22 + node_modules/zwitch/package.json | 72 + node_modules/zwitch/readme.md | 226 + package-lock.json | 1536 ++ package.json | 6 + 693 files changed, 112047 insertions(+), 10 deletions(-) create mode 100644 modules/connectors/connectorPreprocessor.py create mode 100644 modules/features/chatbot/__init__.py create mode 100644 modules/features/chatbot/eventManager.py create mode 100644 modules/features/chatbot/mainChatbot.py create mode 100644 modules/routes/routeChatbot.py create mode 100644 modules/workflows/methods/methodChatbot/__init__.py create mode 100644 modules/workflows/methods/methodChatbot/actions/__init__.py create mode 100644 modules/workflows/methods/methodChatbot/actions/queryDatabase.py create mode 100644 modules/workflows/methods/methodChatbot/methodChatbot.py create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@types/debug/LICENSE create mode 100644 node_modules/@types/debug/README.md create mode 100644 node_modules/@types/debug/index.d.ts create mode 100644 node_modules/@types/debug/package.json create mode 100644 node_modules/@types/estree-jsx/LICENSE create mode 100644 node_modules/@types/estree-jsx/README.md create mode 100644 node_modules/@types/estree-jsx/index.d.ts create mode 100644 node_modules/@types/estree-jsx/package.json create mode 100644 node_modules/@types/estree/LICENSE create mode 100644 node_modules/@types/estree/README.md create mode 100644 node_modules/@types/estree/flow.d.ts create mode 100644 node_modules/@types/estree/index.d.ts create mode 100644 node_modules/@types/estree/package.json create mode 100644 node_modules/@types/hast/LICENSE create mode 100644 node_modules/@types/hast/README.md create mode 100644 node_modules/@types/hast/index.d.ts create mode 100644 node_modules/@types/hast/package.json create mode 100644 node_modules/@types/mdast/LICENSE create mode 100644 node_modules/@types/mdast/README.md create mode 100644 node_modules/@types/mdast/index.d.ts create mode 100644 node_modules/@types/mdast/package.json create mode 100644 node_modules/@types/ms/LICENSE create mode 100644 node_modules/@types/ms/README.md create mode 100644 node_modules/@types/ms/index.d.ts create mode 100644 node_modules/@types/ms/package.json create mode 100644 node_modules/@types/react/LICENSE create mode 100644 node_modules/@types/react/README.md create mode 100644 node_modules/@types/react/canary.d.ts create mode 100644 node_modules/@types/react/compiler-runtime.d.ts create mode 100644 node_modules/@types/react/experimental.d.ts create mode 100644 node_modules/@types/react/global.d.ts create mode 100644 node_modules/@types/react/index.d.ts create mode 100644 node_modules/@types/react/jsx-dev-runtime.d.ts create mode 100644 node_modules/@types/react/jsx-runtime.d.ts create mode 100644 node_modules/@types/react/package.json create mode 100644 node_modules/@types/react/ts5.0/canary.d.ts create mode 100644 node_modules/@types/react/ts5.0/experimental.d.ts create mode 100644 node_modules/@types/react/ts5.0/global.d.ts create mode 100644 node_modules/@types/react/ts5.0/index.d.ts create mode 100644 node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts create mode 100644 node_modules/@types/react/ts5.0/jsx-runtime.d.ts create mode 100644 node_modules/@types/unist/LICENSE create mode 100644 node_modules/@types/unist/README.md create mode 100644 node_modules/@types/unist/index.d.ts create mode 100644 node_modules/@types/unist/package.json create mode 100644 node_modules/@ungap/structured-clone/.github/workflows/node.js.yml create mode 100644 node_modules/@ungap/structured-clone/LICENSE create mode 100644 node_modules/@ungap/structured-clone/README.md create mode 100644 node_modules/@ungap/structured-clone/cjs/deserialize.js create mode 100644 node_modules/@ungap/structured-clone/cjs/index.js create mode 100644 node_modules/@ungap/structured-clone/cjs/json.js create mode 100644 node_modules/@ungap/structured-clone/cjs/package.json create mode 100644 node_modules/@ungap/structured-clone/cjs/serialize.js create mode 100644 node_modules/@ungap/structured-clone/cjs/types.js create mode 100644 node_modules/@ungap/structured-clone/esm/deserialize.js create mode 100644 node_modules/@ungap/structured-clone/esm/index.js create mode 100644 node_modules/@ungap/structured-clone/esm/json.js create mode 100644 node_modules/@ungap/structured-clone/esm/serialize.js create mode 100644 node_modules/@ungap/structured-clone/esm/types.js create mode 100644 node_modules/@ungap/structured-clone/package.json create mode 100644 node_modules/@ungap/structured-clone/structured-json.js create mode 100644 node_modules/bail/index.d.ts create mode 100644 node_modules/bail/index.js create mode 100644 node_modules/bail/license create mode 100644 node_modules/bail/package.json create mode 100644 node_modules/bail/readme.md create mode 100644 node_modules/ccount/index.d.ts create mode 100644 node_modules/ccount/index.js create mode 100644 node_modules/ccount/license create mode 100644 node_modules/ccount/package.json create mode 100644 node_modules/ccount/readme.md create mode 100644 node_modules/character-entities-html4/index.d.ts create mode 100644 node_modules/character-entities-html4/index.js create mode 100644 node_modules/character-entities-html4/license create mode 100644 node_modules/character-entities-html4/package.json create mode 100644 node_modules/character-entities-html4/readme.md create mode 100644 node_modules/character-entities-legacy/index.d.ts create mode 100644 node_modules/character-entities-legacy/index.js create mode 100644 node_modules/character-entities-legacy/license create mode 100644 node_modules/character-entities-legacy/package.json create mode 100644 node_modules/character-entities-legacy/readme.md create mode 100644 node_modules/character-entities/index.d.ts create mode 100644 node_modules/character-entities/index.js create mode 100644 node_modules/character-entities/license create mode 100644 node_modules/character-entities/package.json create mode 100644 node_modules/character-entities/readme.md create mode 100644 node_modules/character-reference-invalid/index.d.ts create mode 100644 node_modules/character-reference-invalid/index.js create mode 100644 node_modules/character-reference-invalid/license create mode 100644 node_modules/character-reference-invalid/package.json create mode 100644 node_modules/character-reference-invalid/readme.md create mode 100644 node_modules/comma-separated-tokens/index.d.ts create mode 100644 node_modules/comma-separated-tokens/index.js create mode 100644 node_modules/comma-separated-tokens/license create mode 100644 node_modules/comma-separated-tokens/package.json create mode 100644 node_modules/comma-separated-tokens/readme.md create mode 100644 node_modules/csstype/LICENSE create mode 100644 node_modules/csstype/README.md create mode 100644 node_modules/csstype/index.d.ts create mode 100644 node_modules/csstype/index.js.flow create mode 100644 node_modules/csstype/package.json create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/common.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/decode-named-character-reference/index.d.ts create mode 100644 node_modules/decode-named-character-reference/index.d.ts.map create mode 100644 node_modules/decode-named-character-reference/index.dom.d.ts create mode 100644 node_modules/decode-named-character-reference/index.dom.d.ts.map create mode 100644 node_modules/decode-named-character-reference/index.dom.js create mode 100644 node_modules/decode-named-character-reference/index.js create mode 100644 node_modules/decode-named-character-reference/license create mode 100644 node_modules/decode-named-character-reference/package.json create mode 100644 node_modules/decode-named-character-reference/readme.md create mode 100644 node_modules/dequal/index.d.ts create mode 100644 node_modules/dequal/license create mode 100644 node_modules/dequal/lite/index.d.ts create mode 100644 node_modules/dequal/lite/index.js create mode 100644 node_modules/dequal/lite/index.min.js create mode 100644 node_modules/dequal/lite/index.mjs create mode 100644 node_modules/dequal/package.json create mode 100644 node_modules/dequal/readme.md create mode 100644 node_modules/devlop/license create mode 100644 node_modules/devlop/package.json create mode 100644 node_modules/devlop/readme.md create mode 100644 node_modules/escape-string-regexp/index.d.ts create mode 100644 node_modules/escape-string-regexp/index.js create mode 100644 node_modules/escape-string-regexp/license create mode 100644 node_modules/escape-string-regexp/package.json create mode 100644 node_modules/escape-string-regexp/readme.md create mode 100644 node_modules/estree-util-is-identifier-name/index.d.ts create mode 100644 node_modules/estree-util-is-identifier-name/index.js create mode 100644 node_modules/estree-util-is-identifier-name/license create mode 100644 node_modules/estree-util-is-identifier-name/package.json create mode 100644 node_modules/estree-util-is-identifier-name/readme.md create mode 100644 node_modules/extend/.editorconfig create mode 100644 node_modules/extend/.eslintrc create mode 100644 node_modules/extend/.jscs.json create mode 100644 node_modules/extend/.travis.yml create mode 100644 node_modules/extend/CHANGELOG.md create mode 100644 node_modules/extend/LICENSE create mode 100644 node_modules/extend/README.md create mode 100644 node_modules/extend/component.json create mode 100644 node_modules/extend/index.js create mode 100644 node_modules/extend/package.json create mode 100644 node_modules/hast-util-to-jsx-runtime/index.d.ts create mode 100644 node_modules/hast-util-to-jsx-runtime/index.js create mode 100644 node_modules/hast-util-to-jsx-runtime/license create mode 100644 node_modules/hast-util-to-jsx-runtime/package.json create mode 100644 node_modules/hast-util-to-jsx-runtime/readme.md create mode 100644 node_modules/hast-util-whitespace/index.d.ts create mode 100644 node_modules/hast-util-whitespace/index.js create mode 100644 node_modules/hast-util-whitespace/license create mode 100644 node_modules/hast-util-whitespace/package.json create mode 100644 node_modules/hast-util-whitespace/readme.md create mode 100644 node_modules/html-url-attributes/index.d.ts create mode 100644 node_modules/html-url-attributes/index.d.ts.map create mode 100644 node_modules/html-url-attributes/index.js create mode 100644 node_modules/html-url-attributes/license create mode 100644 node_modules/html-url-attributes/package.json create mode 100644 node_modules/html-url-attributes/readme.md create mode 100644 node_modules/inline-style-parser/LICENSE create mode 100644 node_modules/inline-style-parser/README.md create mode 100644 node_modules/inline-style-parser/cjs/index.d.cts create mode 100644 node_modules/inline-style-parser/cjs/index.js create mode 100644 node_modules/inline-style-parser/cjs/index.js.map create mode 100644 node_modules/inline-style-parser/esm/index.d.mts create mode 100644 node_modules/inline-style-parser/esm/index.mjs create mode 100644 node_modules/inline-style-parser/esm/index.mjs.map create mode 100644 node_modules/inline-style-parser/index.d.ts create mode 100644 node_modules/inline-style-parser/package.json create mode 100644 node_modules/is-alphabetical/index.d.ts create mode 100644 node_modules/is-alphabetical/index.js create mode 100644 node_modules/is-alphabetical/license create mode 100644 node_modules/is-alphabetical/package.json create mode 100644 node_modules/is-alphabetical/readme.md create mode 100644 node_modules/is-alphanumerical/index.d.ts create mode 100644 node_modules/is-alphanumerical/index.js create mode 100644 node_modules/is-alphanumerical/license create mode 100644 node_modules/is-alphanumerical/package.json create mode 100644 node_modules/is-alphanumerical/readme.md create mode 100644 node_modules/is-decimal/index.d.ts create mode 100644 node_modules/is-decimal/index.js create mode 100644 node_modules/is-decimal/license create mode 100644 node_modules/is-decimal/package.json create mode 100644 node_modules/is-decimal/readme.md create mode 100644 node_modules/is-hexadecimal/index.d.ts create mode 100644 node_modules/is-hexadecimal/index.js create mode 100644 node_modules/is-hexadecimal/license create mode 100644 node_modules/is-hexadecimal/package.json create mode 100644 node_modules/is-hexadecimal/readme.md create mode 100644 node_modules/is-plain-obj/index.d.ts create mode 100644 node_modules/is-plain-obj/index.js create mode 100644 node_modules/is-plain-obj/license create mode 100644 node_modules/is-plain-obj/package.json create mode 100644 node_modules/is-plain-obj/readme.md create mode 100644 node_modules/longest-streak/index.d.ts create mode 100644 node_modules/longest-streak/index.js create mode 100644 node_modules/longest-streak/license create mode 100644 node_modules/longest-streak/package.json create mode 100644 node_modules/longest-streak/readme.md create mode 100644 node_modules/markdown-table/index.d.ts create mode 100644 node_modules/markdown-table/index.d.ts.map create mode 100644 node_modules/markdown-table/index.js create mode 100644 node_modules/markdown-table/license create mode 100644 node_modules/markdown-table/package.json create mode 100644 node_modules/markdown-table/readme.md create mode 100644 node_modules/mdast-util-find-and-replace/index.d.ts create mode 100644 node_modules/mdast-util-find-and-replace/index.d.ts.map create mode 100644 node_modules/mdast-util-find-and-replace/index.js create mode 100644 node_modules/mdast-util-find-and-replace/license create mode 100644 node_modules/mdast-util-find-and-replace/package.json create mode 100644 node_modules/mdast-util-find-and-replace/readme.md create mode 100644 node_modules/mdast-util-from-markdown/dev/index.d.ts create mode 100644 node_modules/mdast-util-from-markdown/dev/index.js create mode 100644 node_modules/mdast-util-from-markdown/index.d.ts create mode 100644 node_modules/mdast-util-from-markdown/index.js create mode 100644 node_modules/mdast-util-from-markdown/license create mode 100644 node_modules/mdast-util-from-markdown/package.json create mode 100644 node_modules/mdast-util-from-markdown/readme.md create mode 100644 node_modules/mdast-util-gfm-autolink-literal/index.d.ts create mode 100644 node_modules/mdast-util-gfm-autolink-literal/index.js create mode 100644 node_modules/mdast-util-gfm-autolink-literal/license create mode 100644 node_modules/mdast-util-gfm-autolink-literal/package.json create mode 100644 node_modules/mdast-util-gfm-autolink-literal/readme.md create mode 100644 node_modules/mdast-util-gfm-footnote/index.d.ts create mode 100644 node_modules/mdast-util-gfm-footnote/index.js create mode 100644 node_modules/mdast-util-gfm-footnote/license create mode 100644 node_modules/mdast-util-gfm-footnote/package.json create mode 100644 node_modules/mdast-util-gfm-footnote/readme.md create mode 100644 node_modules/mdast-util-gfm-strikethrough/index.d.ts create mode 100644 node_modules/mdast-util-gfm-strikethrough/index.js create mode 100644 node_modules/mdast-util-gfm-strikethrough/license create mode 100644 node_modules/mdast-util-gfm-strikethrough/package.json create mode 100644 node_modules/mdast-util-gfm-strikethrough/readme.md create mode 100644 node_modules/mdast-util-gfm-table/index.d.ts create mode 100644 node_modules/mdast-util-gfm-table/index.js create mode 100644 node_modules/mdast-util-gfm-table/license create mode 100644 node_modules/mdast-util-gfm-table/package.json create mode 100644 node_modules/mdast-util-gfm-table/readme.md create mode 100644 node_modules/mdast-util-gfm-task-list-item/index.d.ts create mode 100644 node_modules/mdast-util-gfm-task-list-item/index.js create mode 100644 node_modules/mdast-util-gfm-task-list-item/license create mode 100644 node_modules/mdast-util-gfm-task-list-item/package.json create mode 100644 node_modules/mdast-util-gfm-task-list-item/readme.md create mode 100644 node_modules/mdast-util-gfm/index.d.ts create mode 100644 node_modules/mdast-util-gfm/index.js create mode 100644 node_modules/mdast-util-gfm/license create mode 100644 node_modules/mdast-util-gfm/package.json create mode 100644 node_modules/mdast-util-gfm/readme.md create mode 100644 node_modules/mdast-util-mdx-expression/index.d.ts create mode 100644 node_modules/mdast-util-mdx-expression/index.js create mode 100644 node_modules/mdast-util-mdx-expression/license create mode 100644 node_modules/mdast-util-mdx-expression/package.json create mode 100644 node_modules/mdast-util-mdx-expression/readme.md create mode 100644 node_modules/mdast-util-mdx-jsx/index.d.ts create mode 100644 node_modules/mdast-util-mdx-jsx/index.js create mode 100644 node_modules/mdast-util-mdx-jsx/license create mode 100644 node_modules/mdast-util-mdx-jsx/package.json create mode 100644 node_modules/mdast-util-mdx-jsx/readme.md create mode 100644 node_modules/mdast-util-mdxjs-esm/index.d.ts create mode 100644 node_modules/mdast-util-mdxjs-esm/index.js create mode 100644 node_modules/mdast-util-mdxjs-esm/license create mode 100644 node_modules/mdast-util-mdxjs-esm/package.json create mode 100644 node_modules/mdast-util-mdxjs-esm/readme.md create mode 100644 node_modules/mdast-util-phrasing/index.d.ts create mode 100644 node_modules/mdast-util-phrasing/index.js create mode 100644 node_modules/mdast-util-phrasing/license create mode 100644 node_modules/mdast-util-phrasing/package.json create mode 100644 node_modules/mdast-util-phrasing/readme.md create mode 100644 node_modules/mdast-util-to-hast/index.d.ts create mode 100644 node_modules/mdast-util-to-hast/index.js create mode 100644 node_modules/mdast-util-to-hast/license create mode 100644 node_modules/mdast-util-to-hast/package.json create mode 100644 node_modules/mdast-util-to-hast/readme.md create mode 100644 node_modules/mdast-util-to-markdown/index.d.ts create mode 100644 node_modules/mdast-util-to-markdown/index.js create mode 100644 node_modules/mdast-util-to-markdown/license create mode 100644 node_modules/mdast-util-to-markdown/package.json create mode 100644 node_modules/mdast-util-to-markdown/readme.md create mode 100644 node_modules/mdast-util-to-string/index.d.ts create mode 100644 node_modules/mdast-util-to-string/index.js create mode 100644 node_modules/mdast-util-to-string/license create mode 100644 node_modules/mdast-util-to-string/package.json create mode 100644 node_modules/mdast-util-to-string/readme.md create mode 100644 node_modules/micromark-core-commonmark/dev/index.d.ts create mode 100644 node_modules/micromark-core-commonmark/dev/index.d.ts.map create mode 100644 node_modules/micromark-core-commonmark/dev/index.js create mode 100644 node_modules/micromark-core-commonmark/index.d.ts create mode 100644 node_modules/micromark-core-commonmark/index.d.ts.map create mode 100644 node_modules/micromark-core-commonmark/index.js create mode 100644 node_modules/micromark-core-commonmark/license create mode 100644 node_modules/micromark-core-commonmark/package.json create mode 100644 node_modules/micromark-core-commonmark/readme.md create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/dev/index.js create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/index.js create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/license create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/package.json create mode 100644 node_modules/micromark-extension-gfm-autolink-literal/readme.md create mode 100644 node_modules/micromark-extension-gfm-footnote/dev/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-footnote/dev/index.js create mode 100644 node_modules/micromark-extension-gfm-footnote/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-footnote/index.js create mode 100644 node_modules/micromark-extension-gfm-footnote/license create mode 100644 node_modules/micromark-extension-gfm-footnote/package.json create mode 100644 node_modules/micromark-extension-gfm-footnote/readme.md create mode 100644 node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-strikethrough/dev/index.js create mode 100644 node_modules/micromark-extension-gfm-strikethrough/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-strikethrough/index.js create mode 100644 node_modules/micromark-extension-gfm-strikethrough/license create mode 100644 node_modules/micromark-extension-gfm-strikethrough/package.json create mode 100644 node_modules/micromark-extension-gfm-strikethrough/readme.md create mode 100644 node_modules/micromark-extension-gfm-table/dev/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-table/dev/index.js create mode 100644 node_modules/micromark-extension-gfm-table/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-table/index.js create mode 100644 node_modules/micromark-extension-gfm-table/license create mode 100644 node_modules/micromark-extension-gfm-table/package.json create mode 100644 node_modules/micromark-extension-gfm-table/readme.md create mode 100644 node_modules/micromark-extension-gfm-tagfilter/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-tagfilter/index.js create mode 100644 node_modules/micromark-extension-gfm-tagfilter/license create mode 100644 node_modules/micromark-extension-gfm-tagfilter/package.json create mode 100644 node_modules/micromark-extension-gfm-tagfilter/readme.md create mode 100644 node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-task-list-item/dev/index.js create mode 100644 node_modules/micromark-extension-gfm-task-list-item/index.d.ts create mode 100644 node_modules/micromark-extension-gfm-task-list-item/index.js create mode 100644 node_modules/micromark-extension-gfm-task-list-item/license create mode 100644 node_modules/micromark-extension-gfm-task-list-item/package.json create mode 100644 node_modules/micromark-extension-gfm-task-list-item/readme.md create mode 100644 node_modules/micromark-extension-gfm/index.d.ts create mode 100644 node_modules/micromark-extension-gfm/index.js create mode 100644 node_modules/micromark-extension-gfm/license create mode 100644 node_modules/micromark-extension-gfm/package.json create mode 100644 node_modules/micromark-extension-gfm/readme.md create mode 100644 node_modules/micromark-factory-destination/dev/index.d.ts create mode 100644 node_modules/micromark-factory-destination/dev/index.d.ts.map create mode 100644 node_modules/micromark-factory-destination/dev/index.js create mode 100644 node_modules/micromark-factory-destination/index.d.ts create mode 100644 node_modules/micromark-factory-destination/index.d.ts.map create mode 100644 node_modules/micromark-factory-destination/index.js create mode 100644 node_modules/micromark-factory-destination/license create mode 100644 node_modules/micromark-factory-destination/package.json create mode 100644 node_modules/micromark-factory-destination/readme.md create mode 100644 node_modules/micromark-factory-label/dev/index.d.ts create mode 100644 node_modules/micromark-factory-label/dev/index.d.ts.map create mode 100644 node_modules/micromark-factory-label/dev/index.js create mode 100644 node_modules/micromark-factory-label/index.d.ts create mode 100644 node_modules/micromark-factory-label/index.d.ts.map create mode 100644 node_modules/micromark-factory-label/index.js create mode 100644 node_modules/micromark-factory-label/license create mode 100644 node_modules/micromark-factory-label/package.json create mode 100644 node_modules/micromark-factory-label/readme.md create mode 100644 node_modules/micromark-factory-space/dev/index.d.ts create mode 100644 node_modules/micromark-factory-space/dev/index.d.ts.map create mode 100644 node_modules/micromark-factory-space/dev/index.js create mode 100644 node_modules/micromark-factory-space/index.d.ts create mode 100644 node_modules/micromark-factory-space/index.d.ts.map create mode 100644 node_modules/micromark-factory-space/index.js create mode 100644 node_modules/micromark-factory-space/license create mode 100644 node_modules/micromark-factory-space/package.json create mode 100644 node_modules/micromark-factory-space/readme.md create mode 100644 node_modules/micromark-factory-title/dev/index.d.ts create mode 100644 node_modules/micromark-factory-title/dev/index.d.ts.map create mode 100644 node_modules/micromark-factory-title/dev/index.js create mode 100644 node_modules/micromark-factory-title/index.d.ts create mode 100644 node_modules/micromark-factory-title/index.d.ts.map create mode 100644 node_modules/micromark-factory-title/index.js create mode 100644 node_modules/micromark-factory-title/license create mode 100644 node_modules/micromark-factory-title/package.json create mode 100644 node_modules/micromark-factory-title/readme.md create mode 100644 node_modules/micromark-factory-whitespace/dev/index.d.ts create mode 100644 node_modules/micromark-factory-whitespace/dev/index.d.ts.map create mode 100644 node_modules/micromark-factory-whitespace/dev/index.js create mode 100644 node_modules/micromark-factory-whitespace/index.d.ts create mode 100644 node_modules/micromark-factory-whitespace/index.d.ts.map create mode 100644 node_modules/micromark-factory-whitespace/index.js create mode 100644 node_modules/micromark-factory-whitespace/license create mode 100644 node_modules/micromark-factory-whitespace/package.json create mode 100644 node_modules/micromark-factory-whitespace/readme.md create mode 100644 node_modules/micromark-util-character/dev/index.d.ts create mode 100644 node_modules/micromark-util-character/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-character/dev/index.js create mode 100644 node_modules/micromark-util-character/index.d.ts create mode 100644 node_modules/micromark-util-character/index.d.ts.map create mode 100644 node_modules/micromark-util-character/index.js create mode 100644 node_modules/micromark-util-character/license create mode 100644 node_modules/micromark-util-character/package.json create mode 100644 node_modules/micromark-util-character/readme.md create mode 100644 node_modules/micromark-util-chunked/dev/index.d.ts create mode 100644 node_modules/micromark-util-chunked/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-chunked/dev/index.js create mode 100644 node_modules/micromark-util-chunked/index.d.ts create mode 100644 node_modules/micromark-util-chunked/index.d.ts.map create mode 100644 node_modules/micromark-util-chunked/index.js create mode 100644 node_modules/micromark-util-chunked/license create mode 100644 node_modules/micromark-util-chunked/package.json create mode 100644 node_modules/micromark-util-chunked/readme.md create mode 100644 node_modules/micromark-util-classify-character/dev/index.d.ts create mode 100644 node_modules/micromark-util-classify-character/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-classify-character/dev/index.js create mode 100644 node_modules/micromark-util-classify-character/index.d.ts create mode 100644 node_modules/micromark-util-classify-character/index.d.ts.map create mode 100644 node_modules/micromark-util-classify-character/index.js create mode 100644 node_modules/micromark-util-classify-character/license create mode 100644 node_modules/micromark-util-classify-character/package.json create mode 100644 node_modules/micromark-util-classify-character/readme.md create mode 100644 node_modules/micromark-util-combine-extensions/index.d.ts create mode 100644 node_modules/micromark-util-combine-extensions/index.d.ts.map create mode 100644 node_modules/micromark-util-combine-extensions/index.js create mode 100644 node_modules/micromark-util-combine-extensions/license create mode 100644 node_modules/micromark-util-combine-extensions/package.json create mode 100644 node_modules/micromark-util-combine-extensions/readme.md create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/dev/index.js create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/index.d.ts create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/index.js create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/license create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/package.json create mode 100644 node_modules/micromark-util-decode-numeric-character-reference/readme.md create mode 100644 node_modules/micromark-util-decode-string/dev/index.d.ts create mode 100644 node_modules/micromark-util-decode-string/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-decode-string/dev/index.js create mode 100644 node_modules/micromark-util-decode-string/index.d.ts create mode 100644 node_modules/micromark-util-decode-string/index.d.ts.map create mode 100644 node_modules/micromark-util-decode-string/index.js create mode 100644 node_modules/micromark-util-decode-string/license create mode 100644 node_modules/micromark-util-decode-string/package.json create mode 100644 node_modules/micromark-util-decode-string/readme.md create mode 100644 node_modules/micromark-util-encode/index.d.ts create mode 100644 node_modules/micromark-util-encode/index.d.ts.map create mode 100644 node_modules/micromark-util-encode/index.js create mode 100644 node_modules/micromark-util-encode/license create mode 100644 node_modules/micromark-util-encode/package.json create mode 100644 node_modules/micromark-util-encode/readme.md create mode 100644 node_modules/micromark-util-html-tag-name/index.d.ts create mode 100644 node_modules/micromark-util-html-tag-name/index.d.ts.map create mode 100644 node_modules/micromark-util-html-tag-name/index.js create mode 100644 node_modules/micromark-util-html-tag-name/license create mode 100644 node_modules/micromark-util-html-tag-name/package.json create mode 100644 node_modules/micromark-util-html-tag-name/readme.md create mode 100644 node_modules/micromark-util-normalize-identifier/dev/index.d.ts create mode 100644 node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-normalize-identifier/dev/index.js create mode 100644 node_modules/micromark-util-normalize-identifier/index.d.ts create mode 100644 node_modules/micromark-util-normalize-identifier/index.d.ts.map create mode 100644 node_modules/micromark-util-normalize-identifier/index.js create mode 100644 node_modules/micromark-util-normalize-identifier/license create mode 100644 node_modules/micromark-util-normalize-identifier/package.json create mode 100644 node_modules/micromark-util-normalize-identifier/readme.md create mode 100644 node_modules/micromark-util-resolve-all/index.d.ts create mode 100644 node_modules/micromark-util-resolve-all/index.d.ts.map create mode 100644 node_modules/micromark-util-resolve-all/index.js create mode 100644 node_modules/micromark-util-resolve-all/license create mode 100644 node_modules/micromark-util-resolve-all/package.json create mode 100644 node_modules/micromark-util-resolve-all/readme.md create mode 100644 node_modules/micromark-util-sanitize-uri/dev/index.d.ts create mode 100644 node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-sanitize-uri/dev/index.js create mode 100644 node_modules/micromark-util-sanitize-uri/index.d.ts create mode 100644 node_modules/micromark-util-sanitize-uri/index.d.ts.map create mode 100644 node_modules/micromark-util-sanitize-uri/index.js create mode 100644 node_modules/micromark-util-sanitize-uri/license create mode 100644 node_modules/micromark-util-sanitize-uri/package.json create mode 100644 node_modules/micromark-util-sanitize-uri/readme.md create mode 100644 node_modules/micromark-util-subtokenize/dev/index.d.ts create mode 100644 node_modules/micromark-util-subtokenize/dev/index.d.ts.map create mode 100644 node_modules/micromark-util-subtokenize/dev/index.js create mode 100644 node_modules/micromark-util-subtokenize/index.d.ts create mode 100644 node_modules/micromark-util-subtokenize/index.d.ts.map create mode 100644 node_modules/micromark-util-subtokenize/index.js create mode 100644 node_modules/micromark-util-subtokenize/license create mode 100644 node_modules/micromark-util-subtokenize/package.json create mode 100644 node_modules/micromark-util-subtokenize/readme.md create mode 100644 node_modules/micromark-util-symbol/license create mode 100644 node_modules/micromark-util-symbol/package.json create mode 100644 node_modules/micromark-util-symbol/readme.md create mode 100644 node_modules/micromark-util-types/index.d.ts create mode 100644 node_modules/micromark-util-types/index.js create mode 100644 node_modules/micromark-util-types/license create mode 100644 node_modules/micromark-util-types/package.json create mode 100644 node_modules/micromark-util-types/readme.md create mode 100644 node_modules/micromark/dev/index.d.ts create mode 100644 node_modules/micromark/dev/index.d.ts.map create mode 100644 node_modules/micromark/dev/index.js create mode 100644 node_modules/micromark/dev/stream.d.ts create mode 100644 node_modules/micromark/dev/stream.d.ts.map create mode 100644 node_modules/micromark/dev/stream.js create mode 100644 node_modules/micromark/index.d.ts create mode 100644 node_modules/micromark/index.d.ts.map create mode 100644 node_modules/micromark/index.js create mode 100644 node_modules/micromark/license create mode 100644 node_modules/micromark/package.json create mode 100644 node_modules/micromark/readme.md create mode 100644 node_modules/micromark/stream.d.ts create mode 100644 node_modules/micromark/stream.d.ts.map create mode 100644 node_modules/micromark/stream.js create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/parse-entities/index.d.ts create mode 100644 node_modules/parse-entities/index.js create mode 100644 node_modules/parse-entities/license create mode 100644 node_modules/parse-entities/node_modules/@types/unist/LICENSE create mode 100644 node_modules/parse-entities/node_modules/@types/unist/README.md create mode 100644 node_modules/parse-entities/node_modules/@types/unist/index.d.ts create mode 100644 node_modules/parse-entities/node_modules/@types/unist/package.json create mode 100644 node_modules/parse-entities/package.json create mode 100644 node_modules/parse-entities/readme.md create mode 100644 node_modules/property-information/index.d.ts create mode 100644 node_modules/property-information/index.js create mode 100644 node_modules/property-information/license create mode 100644 node_modules/property-information/package.json create mode 100644 node_modules/property-information/readme.md create mode 100644 node_modules/react-markdown/index.d.ts create mode 100644 node_modules/react-markdown/index.d.ts.map create mode 100644 node_modules/react-markdown/index.js create mode 100644 node_modules/react-markdown/license create mode 100644 node_modules/react-markdown/package.json create mode 100644 node_modules/react-markdown/readme.md create mode 100644 node_modules/react/LICENSE create mode 100644 node_modules/react/README.md create mode 100644 node_modules/react/cjs/react-compiler-runtime.development.js create mode 100644 node_modules/react/cjs/react-compiler-runtime.production.js create mode 100644 node_modules/react/cjs/react-compiler-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.development.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.production.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js create mode 100644 node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.development.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.production.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.profiling.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.react-server.development.js create mode 100644 node_modules/react/cjs/react-jsx-runtime.react-server.production.js create mode 100644 node_modules/react/cjs/react.development.js create mode 100644 node_modules/react/cjs/react.production.js create mode 100644 node_modules/react/cjs/react.react-server.development.js create mode 100644 node_modules/react/cjs/react.react-server.production.js create mode 100644 node_modules/react/compiler-runtime.js create mode 100644 node_modules/react/index.js create mode 100644 node_modules/react/jsx-dev-runtime.js create mode 100644 node_modules/react/jsx-dev-runtime.react-server.js create mode 100644 node_modules/react/jsx-runtime.js create mode 100644 node_modules/react/jsx-runtime.react-server.js create mode 100644 node_modules/react/package.json create mode 100644 node_modules/react/react.react-server.js create mode 100644 node_modules/remark-gfm/index.d.ts create mode 100644 node_modules/remark-gfm/index.js create mode 100644 node_modules/remark-gfm/license create mode 100644 node_modules/remark-gfm/package.json create mode 100644 node_modules/remark-gfm/readme.md create mode 100644 node_modules/remark-parse/index.d.ts create mode 100644 node_modules/remark-parse/index.js create mode 100644 node_modules/remark-parse/license create mode 100644 node_modules/remark-parse/package.json create mode 100644 node_modules/remark-parse/readme.md create mode 100644 node_modules/remark-rehype/index.d.ts create mode 100644 node_modules/remark-rehype/index.d.ts.map create mode 100644 node_modules/remark-rehype/index.js create mode 100644 node_modules/remark-rehype/license create mode 100644 node_modules/remark-rehype/package.json create mode 100644 node_modules/remark-rehype/readme.md create mode 100644 node_modules/remark-stringify/index.d.ts create mode 100644 node_modules/remark-stringify/index.js create mode 100644 node_modules/remark-stringify/license create mode 100644 node_modules/remark-stringify/package.json create mode 100644 node_modules/remark-stringify/readme.md create mode 100644 node_modules/space-separated-tokens/index.d.ts create mode 100644 node_modules/space-separated-tokens/index.js create mode 100644 node_modules/space-separated-tokens/license create mode 100644 node_modules/space-separated-tokens/package.json create mode 100644 node_modules/space-separated-tokens/readme.md create mode 100644 node_modules/stringify-entities/index.d.ts create mode 100644 node_modules/stringify-entities/index.js create mode 100644 node_modules/stringify-entities/license create mode 100644 node_modules/stringify-entities/package.json create mode 100644 node_modules/stringify-entities/readme.md create mode 100644 node_modules/style-to-js/LICENSE create mode 100644 node_modules/style-to-js/README.md create mode 100644 node_modules/style-to-js/cjs/index.d.ts create mode 100644 node_modules/style-to-js/cjs/index.d.ts.map create mode 100644 node_modules/style-to-js/cjs/index.js create mode 100644 node_modules/style-to-js/cjs/index.js.map create mode 100644 node_modules/style-to-js/cjs/utilities.d.ts create mode 100644 node_modules/style-to-js/cjs/utilities.d.ts.map create mode 100644 node_modules/style-to-js/cjs/utilities.js create mode 100644 node_modules/style-to-js/cjs/utilities.js.map create mode 100644 node_modules/style-to-js/package.json create mode 100644 node_modules/style-to-js/src/index.test.ts create mode 100644 node_modules/style-to-js/src/index.ts create mode 100644 node_modules/style-to-js/src/utilities.test.ts create mode 100644 node_modules/style-to-js/src/utilities.ts create mode 100644 node_modules/style-to-js/umd/style-to-js.js create mode 100644 node_modules/style-to-js/umd/style-to-js.js.map create mode 100644 node_modules/style-to-js/umd/style-to-js.min.js create mode 100644 node_modules/style-to-js/umd/style-to-js.min.js.map create mode 100644 node_modules/style-to-object/LICENSE create mode 100644 node_modules/style-to-object/README.md create mode 100644 node_modules/style-to-object/cjs/index.d.ts create mode 100644 node_modules/style-to-object/cjs/index.d.ts.map create mode 100644 node_modules/style-to-object/cjs/index.js create mode 100644 node_modules/style-to-object/cjs/index.js.map create mode 100644 node_modules/style-to-object/esm/index.d.ts create mode 100644 node_modules/style-to-object/esm/index.d.ts.map create mode 100644 node_modules/style-to-object/esm/index.js create mode 100644 node_modules/style-to-object/esm/index.js.map create mode 100644 node_modules/style-to-object/esm/index.mjs create mode 100644 node_modules/style-to-object/esm/index.mjs.map create mode 100644 node_modules/style-to-object/package.json create mode 100644 node_modules/style-to-object/src/index.ts create mode 100644 node_modules/trim-lines/index.d.ts create mode 100644 node_modules/trim-lines/index.js create mode 100644 node_modules/trim-lines/license create mode 100644 node_modules/trim-lines/package.json create mode 100644 node_modules/trim-lines/readme.md create mode 100644 node_modules/trough/index.d.ts create mode 100644 node_modules/trough/index.d.ts.map create mode 100644 node_modules/trough/index.js create mode 100644 node_modules/trough/license create mode 100644 node_modules/trough/package.json create mode 100644 node_modules/trough/readme.md create mode 100644 node_modules/unified/index.d.ts create mode 100644 node_modules/unified/index.js create mode 100644 node_modules/unified/license create mode 100644 node_modules/unified/package.json create mode 100644 node_modules/unified/readme.md create mode 100644 node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/unist-util-is/index.d.ts.map create mode 100644 node_modules/unist-util-is/index.js create mode 100644 node_modules/unist-util-is/license create mode 100644 node_modules/unist-util-is/package.json create mode 100644 node_modules/unist-util-is/readme.md create mode 100644 node_modules/unist-util-position/index.d.ts create mode 100644 node_modules/unist-util-position/index.js create mode 100644 node_modules/unist-util-position/license create mode 100644 node_modules/unist-util-position/package.json create mode 100644 node_modules/unist-util-position/readme.md create mode 100644 node_modules/unist-util-stringify-position/index.d.ts create mode 100644 node_modules/unist-util-stringify-position/index.js create mode 100644 node_modules/unist-util-stringify-position/license create mode 100644 node_modules/unist-util-stringify-position/package.json create mode 100644 node_modules/unist-util-stringify-position/readme.md create mode 100644 node_modules/unist-util-visit-parents/index.d.ts create mode 100644 node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/unist-util-visit-parents/license create mode 100644 node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/unist-util-visit/index.d.ts create mode 100644 node_modules/unist-util-visit/index.js create mode 100644 node_modules/unist-util-visit/license create mode 100644 node_modules/unist-util-visit/package.json create mode 100644 node_modules/unist-util-visit/readme.md create mode 100644 node_modules/vfile-message/index.d.ts create mode 100644 node_modules/vfile-message/index.js create mode 100644 node_modules/vfile-message/license create mode 100644 node_modules/vfile-message/package.json create mode 100644 node_modules/vfile-message/readme.md create mode 100644 node_modules/vfile/index.d.ts create mode 100644 node_modules/vfile/index.js create mode 100644 node_modules/vfile/license create mode 100644 node_modules/vfile/package.json create mode 100644 node_modules/vfile/readme.md create mode 100644 node_modules/zwitch/index.d.ts create mode 100644 node_modules/zwitch/index.js create mode 100644 node_modules/zwitch/license create mode 100644 node_modules/zwitch/package.json create mode 100644 node_modules/zwitch/readme.md create mode 100644 package-lock.json create mode 100644 package.json diff --git a/app.py b/app.py index 49aa31f2..2061836f 100644 --- a/app.py +++ b/app.py @@ -448,3 +448,6 @@ app.include_router(optionsRouter) from modules.routes.routeMessaging import router as messagingRouter app.include_router(messagingRouter) +from modules.routes.routeChatbot import router as chatbotRouter +app.include_router(chatbotRouter) + diff --git a/modules/connectors/connectorPreprocessor.py b/modules/connectors/connectorPreprocessor.py new file mode 100644 index 00000000..a1aa8368 --- /dev/null +++ b/modules/connectors/connectorPreprocessor.py @@ -0,0 +1,169 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. +""" +Preprocessor connector for executing SQL queries via HTTP API. +Connects to remote preprocessing service that hosts the SQLite database. +""" + +import logging +import httpx +from typing import Optional +from modules.shared.configuration import APP_CONFIG + +logger = logging.getLogger(__name__) + + +class PreprocessorConnector: + """ + Connector for executing SQL queries via preprocessing API. + Makes HTTP POST requests to remote preprocessing service. + """ + + def __init__(self): + """Initialize the preprocessor connector.""" + self.api_key = APP_CONFIG.get("PP_QUERY_API_KEY") + self.base_url = APP_CONFIG.get("PP_QUERY_BASE_URL") + + if not self.api_key: + logger.warning("PP_QUERY_API_KEY not found in configuration") + if not self.base_url: + logger.warning("PP_QUERY_BASE_URL not found in configuration") + + # HTTP client with timeout + self.http_client = httpx.AsyncClient( + timeout=30.0, + headers={ + "Content-Type": "application/json" + } + ) + + logger.info("PreprocessorConnector initialized") + + async def executeQuery(self, sql_query: str) -> str: + """ + Execute a SQL query via the preprocessing API. + + Args: + sql_query: SQL SELECT query to execute + + Returns: + Formatted result string with query results + + Raises: + ValueError: If query is invalid or contains forbidden keywords + Exception: If API request fails + """ + try: + # Validate query + validation_error = self._validateQuery(sql_query) + if validation_error: + return validation_error + + # Check configuration + if not self.api_key: + error_msg = "Error: PP_QUERY_API_KEY not configured" + logger.error(error_msg) + return error_msg + if not self.base_url: + error_msg = "Error: PP_QUERY_BASE_URL not configured" + logger.error(error_msg) + return error_msg + + # Make HTTP POST request to preprocessing API + logger.info(f"Executing SQL query via preprocessing API: {self.base_url} (query: {sql_query[:100]}...)") + + response = await self.http_client.post( + self.base_url, + json={"query": sql_query}, + headers={ + "X-DB-API-Key": self.api_key + } + ) + + response.raise_for_status() + result = response.json() + + # Parse response + if not result.get("success"): + error_message = result.get("message", "Unknown error") + return f"Query failed: {error_message}" + + # Format results + data = result.get("data", []) + row_count = result.get("row_count", 0) + + # Limit to 50 rows for display + display_data = data[:50] + + # Format results as string + if not display_data: + return f"Query executed successfully. Returned {row_count} rows (no data)." + + # Format each row + results = [] + for row in display_data: + results.append(str(row)) + + result_text = ( + f"Query executed successfully. Returned {row_count} rows " + f"(showing first {min(row_count, 50)}):\n" + + "\n".join(results) + ) + + return result_text + + except httpx.HTTPStatusError as e: + error_msg = f"API error: HTTP {e.response.status_code}" + try: + error_text = e.response.text + error_msg += f" - {error_text}" + except: + pass + logger.error(f"Preprocessing API HTTP error: {error_msg}") + return error_msg + + except httpx.RequestError as e: + error_msg = f"Network error: {str(e)}" + logger.error(f"Preprocessing API network error: {error_msg}") + return error_msg + + except Exception as e: + error_msg = f"Error executing query: {str(e)}" + logger.error(f"Preprocessing API error: {error_msg}") + return error_msg + + def _validateQuery(self, sql_query: str) -> Optional[str]: + """ + Validate SQL query to ensure only SELECT queries are allowed. + + Args: + sql_query: SQL query to validate + + Returns: + Error message if validation fails, None if valid + """ + if not sql_query or not isinstance(sql_query, str): + return "Error: SQL query must be a non-empty string" + + query_upper = sql_query.strip().upper() + + # Check if query starts with SELECT + if not query_upper.startswith("SELECT"): + return "Error: Only SELECT queries are allowed. Query must start with SELECT." + + # Check for forbidden keywords + forbidden_keywords = [ + "DROP", "CREATE", "ALTER", "INSERT", "UPDATE", + "DELETE", "PRAGMA", "ATTACH", "DETACH", "TRUNCATE" + ] + + for keyword in forbidden_keywords: + if keyword in query_upper: + return f"Error: Query contains forbidden keyword '{keyword}'. Only SELECT queries are allowed." + + return None + + async def close(self): + """Close the HTTP client.""" + await self.http_client.aclose() + diff --git a/modules/datamodels/datamodelChat.py b/modules/datamodels/datamodelChat.py index 7e8d140a..4800752d 100644 --- a/modules/datamodels/datamodelChat.py +++ b/modules/datamodels/datamodelChat.py @@ -274,6 +274,7 @@ registerModelLabels( class WorkflowModeEnum(str, Enum): WORKFLOW_DYNAMIC = "Dynamic" WORKFLOW_AUTOMATION = "Automation" + WORKFLOW_CHATBOT = "Chatbot" registerModelLabels( @@ -282,6 +283,7 @@ registerModelLabels( { "WORKFLOW_DYNAMIC": {"en": "Dynamic", "fr": "Dynamique"}, "WORKFLOW_AUTOMATION": {"en": "Automation", "fr": "Automatisation"}, + "WORKFLOW_CHATBOT": {"en": "Chatbot", "fr": "Chatbot"}, }, ) @@ -316,6 +318,10 @@ class ChatWorkflow(BaseModel): "value": WorkflowModeEnum.WORKFLOW_AUTOMATION.value, "label": {"en": "Automation", "fr": "Automatisation"}, }, + { + "value": WorkflowModeEnum.WORKFLOW_CHATBOT.value, + "label": {"en": "Chatbot", "fr": "Chatbot"}, + }, ]}) maxSteps: int = Field(default=10, description="Maximum number of iterations in dynamic mode", json_schema_extra={"frontend_type": "integer", "frontend_readonly": False, "frontend_required": False}) expectedFormats: Optional[List[str]] = Field(None, description="List of expected file format extensions from user request (e.g., ['xlsx', 'pdf']). Extracted during intent analysis.", json_schema_extra={"frontend_type": "text", "frontend_readonly": True, "frontend_required": False}) @@ -379,6 +385,7 @@ class UserInputRequest(BaseModel): prompt: str = Field(description="Prompt for the user") listFileId: List[str] = Field(default_factory=list, description="List of file IDs") userLanguage: str = Field(default="en", description="User's preferred language") + workflowId: Optional[str] = Field(None, description="Optional ID of the workflow to continue") registerModelLabels( diff --git a/modules/features/chatbot/__init__.py b/modules/features/chatbot/__init__.py new file mode 100644 index 00000000..76df84b3 --- /dev/null +++ b/modules/features/chatbot/__init__.py @@ -0,0 +1,7 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. + +from .mainChatbot import chatProcess + +__all__ = ['chatProcess'] + diff --git a/modules/features/chatbot/eventManager.py b/modules/features/chatbot/eventManager.py new file mode 100644 index 00000000..48d1601b --- /dev/null +++ b/modules/features/chatbot/eventManager.py @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. +""" +Event manager for chatbot streaming. +Manages event queues for SSE streaming of chatbot progress updates. +""" + +import logging +import asyncio +from typing import Dict, Optional, Any +from datetime import datetime + +logger = logging.getLogger(__name__) + + +class ChatbotEventManager: + """ + Manages event queues for chatbot streaming. + Thread-safe event emission and queue management. + """ + + def __init__(self): + """Initialize the event manager.""" + self._queues: Dict[str, asyncio.Queue] = {} + self._locks: Dict[str, asyncio.Lock] = {} + self._cleanup_tasks: Dict[str, asyncio.Task] = {} + + def create_queue(self, workflow_id: str) -> asyncio.Queue: + """ + Create a new event queue for a workflow. + + Args: + workflow_id: Workflow ID + + Returns: + Event queue for the workflow + """ + if workflow_id not in self._queues: + self._queues[workflow_id] = asyncio.Queue() + self._locks[workflow_id] = asyncio.Lock() + logger.debug(f"Created event queue for workflow {workflow_id}") + return self._queues[workflow_id] + + def get_queue(self, workflow_id: str) -> Optional[asyncio.Queue]: + """ + Get existing event queue for a workflow. + + Args: + workflow_id: Workflow ID + + Returns: + Event queue if exists, None otherwise + """ + return self._queues.get(workflow_id) + + async def emit_event( + self, + workflow_id: str, + event_type: str, + message: str, + step: Optional[str] = None, + data: Optional[Dict[str, Any]] = None + ): + """ + Emit an event to the workflow's event queue. + + Args: + workflow_id: Workflow ID + event_type: Type of event ("status", "progress", "complete", "error") + message: Event message + step: Current processing step (optional) + data: Additional event data (optional) + """ + queue = self.get_queue(workflow_id) + if not queue: + logger.debug(f"No event queue found for workflow {workflow_id}, skipping event") + return + + event = { + "type": event_type, + "message": message, + "timestamp": datetime.now().timestamp(), + "step": step, + "data": data or {} + } + + try: + await queue.put(event) + logger.debug(f"Emitted {event_type} event for workflow {workflow_id}: {message[:50]}") + except Exception as e: + logger.error(f"Error emitting event for workflow {workflow_id}: {e}") + + async def cleanup(self, workflow_id: str, delay: float = 60.0): + """ + Schedule cleanup of event queue after delay. + This allows time for any remaining events to be consumed. + + Args: + workflow_id: Workflow ID + delay: Delay in seconds before cleanup (default: 60 seconds) + """ + if workflow_id in self._cleanup_tasks: + # Cancel existing cleanup task + self._cleanup_tasks[workflow_id].cancel() + + async def _cleanup(): + try: + await asyncio.sleep(delay) + if workflow_id in self._queues: + # Drain remaining events + queue = self._queues[workflow_id] + while not queue.empty(): + try: + queue.get_nowait() + except asyncio.QueueEmpty: + break + + del self._queues[workflow_id] + del self._locks[workflow_id] + logger.info(f"Cleaned up event queue for workflow {workflow_id}") + except asyncio.CancelledError: + pass + except Exception as e: + logger.error(f"Error during cleanup for workflow {workflow_id}: {e}") + finally: + if workflow_id in self._cleanup_tasks: + del self._cleanup_tasks[workflow_id] + + self._cleanup_tasks[workflow_id] = asyncio.create_task(_cleanup()) + + def has_queue(self, workflow_id: str) -> bool: + """ + Check if a queue exists for a workflow. + + Args: + workflow_id: Workflow ID + + Returns: + True if queue exists, False otherwise + """ + return workflow_id in self._queues + + +# Global singleton instance +_event_manager = ChatbotEventManager() + + +def get_event_manager() -> ChatbotEventManager: + """Get the global event manager instance.""" + return _event_manager + + diff --git a/modules/features/chatbot/mainChatbot.py b/modules/features/chatbot/mainChatbot.py new file mode 100644 index 00000000..8bcc73ce --- /dev/null +++ b/modules/features/chatbot/mainChatbot.py @@ -0,0 +1,1352 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. +""" +Simple chatbot feature - direct AI center implementation. +Bypasses complex workflow engine for fast, simple chatbot responses. +""" + +import logging +import json +import uuid +import asyncio +import re +import datetime +from typing import Optional, Dict, Any + +from modules.datamodels.datamodelChat import ChatWorkflow, UserInputRequest, ChatMessage, WorkflowModeEnum +from modules.datamodels.datamodelUam import User +from modules.datamodels.datamodelAi import AiCallRequest, AiCallOptions, OperationTypeEnum, ProcessingModeEnum +from modules.shared.timeUtils import getUtcTimestamp, parseTimestamp +from modules.services import getInterface as getServices +from modules.connectors.connectorPreprocessor import PreprocessorConnector +from modules.features.chatbot.eventManager import get_event_manager +from modules.features.chatbot.eventManager import get_event_manager + +logger = logging.getLogger(__name__) + + +def _extractJsonFromResponse(content: str) -> Optional[dict]: + """Extract JSON from AI response, handling markdown code blocks.""" + # Try direct JSON parse first + try: + return json.loads(content.strip()) + except json.JSONDecodeError: + pass + + # Try to extract JSON from markdown code blocks + json_match = re.search(r'```(?:json)?\s*(\{.*?\})\s*```', content, re.DOTALL) + if json_match: + try: + return json.loads(json_match.group(1)) + except json.JSONDecodeError: + pass + + # Try to find JSON object in the text + json_match = re.search(r'\{.*\}', content, re.DOTALL) + if json_match: + try: + return json.loads(json_match.group(0)) + except json.JSONDecodeError: + pass + + return None + + +async def _generateSqlFromQuestion(services, userQuestion: str, context: str = "") -> str: + """Generate SQL query directly from user question when JSON parsing fails.""" + current_date = datetime.datetime.now().strftime("%d.%m.%Y") + sqlPrompt = f"""Heute ist der {current_date}. + +Du bist ein Chatbot der Althaus AG. +Du hast Zugriff auf ein SQL query tool, dass es dir ermöglicht, SQL SELECT Abfragen auf der Althaus AG Datenbank auszuführen. + +DATENBANK-INFORMATIONEN: +- Datenbankdatei: /data/database.db (SQLite) +- Tabellen: Artikel, Einkaufspreis, Lagerplatz_Artikel + +Die Datenbank besteht aus drei Tabellen, die über Beziehungen verbunden sind: +- **Artikel**: Enthält alle Produktinformationen (I_ID, Artikelbezeichnung, Artikelnummer, etc.) +- **Einkaufspreis**: Enthält Preisdaten (m_Artikel, EP_CHF) +- **Lagerplatz_Artikel**: Enthält Lagerbestands- und Lagerplatzinformationen (R_ARTIKEL, R_LAGERPLATZ, S_IST_BESTAND, etc.) +- **Beziehungen**: + - Artikel.I_ID = Einkaufspreis.m_Artikel + - Artikel.I_ID = Lagerplatz_Artikel.R_ARTIKEL + +TABELLEN-SCHEMA (WICHTIG - Spalten mit Leerzeichen/Sonderzeichen IMMER in doppelte Anführungszeichen setzen): + +Tabelle 1: Artikel +CREATE TABLE Artikel ( + "I_ID" INTEGER PRIMARY KEY, + "Artikelbeschrieb" TEXT, + "Artikelbezeichnung" TEXT, + "Artikelgruppe" TEXT, + "Artikelkategorie" TEXT, + "Artikelkürzel" TEXT, + "Artikelnummer" TEXT, + "Einheit" TEXT, + "Gesperrt" TEXT, + "Keywords" TEXT, + "Lieferant" TEXT, + "Warengruppe" TEXT +) + +Tabelle 2: Einkaufspreis +CREATE TABLE Einkaufspreis ( + "m_Artikel" INTEGER, + "EP_CHF" FLOAT +) + +Tabelle 3: Lagerplatz_Artikel +CREATE TABLE Lagerplatz_Artikel ( + "R_ARTIKEL" INTEGER, + "R_LAGERPLATZ" TEXT, + "S_BESTELLTER_BESTAND" INTEGER, + "S_IST_BESTAND" TEXT, + "S_MAXIMALBESTAND" INTEGER, + "S_MINDESTBESTAND" INTEGER, + "S_RESERVIERTER_BESTAND" INTEGER, + "S_SOLL_BESTAND" INTEGER +) + +SQL-HINWEISE: +- Verwende IMMER doppelte Anführungszeichen für Spaltennamen: "Artikelkürzel", "Artikelnummer", etc. +- Für Textsuche verwende LIKE mit Wildcards: WHERE a."Artikelbezeichnung" LIKE '%suchbegriff%' +- Für Preisabfragen: Nutze JOINs um auf e."EP_CHF" zuzugreifen +- Für Lagerbestände: Nutze JOINs um auf l."S_IST_BESTAND", l."S_SOLL_BESTAND", etc. zuzugreifen +- WICHTIG bei S_IST_BESTAND: Dieser Wert kann "Unbekannt" sein (TEXT), nicht nur Zahlen! Prüfe mit WHERE l."S_IST_BESTAND" != 'Unbekannt' wenn du nur numerische Werte willst +- Verwende Tabellenaliase (a für Artikel, e für Einkaufspreis, l für Lagerplatz_Artikel) für bessere Lesbarkeit + +SQL-AGGREGATIONEN: +Du kannst SQL-Aggregationsfunktionen verwenden, um statistische Auswertungen und Zusammenfassungen zu erstellen: +- COUNT() - Anzahl zählen +- SUM() - Summe berechnen (z.B. SUM(CASE WHEN l."S_IST_BESTAND" != 'Unbekannt' THEN CAST(l."S_IST_BESTAND" AS INTEGER) ELSE 0 END)) +- AVG() - Durchschnitt +- MIN() / MAX() - Minimum/Maximum +- GROUP BY - Gruppierung + +Beispiel für Lagerbestand-Aggregation: +SELECT SUM(CASE WHEN l."S_IST_BESTAND" != 'Unbekannt' THEN CAST(l."S_IST_BESTAND" AS INTEGER) ELSE 0 END) as "Gesamtbestand" +FROM Artikel a +LEFT JOIN Lagerplatz_Artikel l ON a."I_ID" = l."R_ARTIKEL" +WHERE a."Artikelbezeichnung" LIKE '%LED%' + +Generate a SQL SELECT query to answer this question: {userQuestion}{context} + +Return ONLY the SQL query, nothing else. Use SELECT queries only. Use double quotes for all column names.""" + + sqlRequest = AiCallRequest( + prompt=sqlPrompt, + options=AiCallOptions( + resultFormat="txt", + operationType=OperationTypeEnum.DATA_ANALYSE, + processingMode=ProcessingModeEnum.BASIC + ) + ) + + sqlResponse = await services.ai.callAi(sqlRequest) + # Extract SQL from response (might be wrapped in markdown) + sql = sqlResponse.content.strip() + # Remove markdown code blocks if present + if sql.startswith("```"): + sql = re.sub(r'^```(?:sql)?\s*', '', sql) + sql = re.sub(r'\s*```$', '', sql) + return sql.strip() + + +async def _generate_conversation_name( + services, + userPrompt: str, + userLanguage: str = "en" +) -> str: + """ + Generate a short, descriptive conversation name based on user's prompt. + + Args: + services: Services instance with AI access + userPrompt: The user's input prompt + userLanguage: User's preferred language (for prompt localization) + + Returns: + Short conversation name (max 60 characters) + """ + try: + # Truncate prompt if too long to avoid excessive token usage + truncated_prompt = userPrompt[:200] if len(userPrompt) > 200 else userPrompt + + # Create a prompt that detects the input language and generates title in the same language + name_prompt = f"""You are an expert in professional business communication. Your task is to create a professional conversation title. + +CRITICAL: The title MUST be in the SAME LANGUAGE as the user's question. If the question is in German, respond in German. If in French, respond in French. If in English, respond in English. + +USER QUESTION: "{truncated_prompt}" + +TASK: +1. Identify the language of the user's question +2. Identify the main topic of the question +3. Create an elegant, professional title in THE SAME LANGUAGE as the question (max 60 characters, no punctuation) + +RULES: +- Title MUST match the language of the input question exactly +- DO NOT translate to another language +- DO NOT just copy words from the question +- Use professional language appropriate to the detected language +- No punctuation (?, !, .) + +EXAMPLES: +- Input (German): "wie viele leds haben wir auf lager?" → Title (German): "LED Lagerbestand" +- Input (German): "wie viel kosten die leds ungefähr? was ist die preisrange?" → Title (German): "LED Preisübersicht" +- Input (French): "combien de leds avons-nous en stock?" → Title (French): "Stock de LED" +- Input (French): "combien coûtent les leds environ?" → Title (French): "Aperçu des Prix LED" +- Input (English): "how many leds do we have in stock?" → Title (English): "LED Inventory Inquiry" +- Input (English): "how much do the leds cost approximately?" → Title (English): "LED Price Overview" + +Respond ONLY with the title in the same language as the question, nothing else:""" + + # Ensure AI services are initialized before calling + await services.ai.ensureAiObjectsInitialized() + + nameRequest = AiCallRequest( + prompt=name_prompt, + options=AiCallOptions( + resultFormat="txt", + operationType=OperationTypeEnum.DATA_GENERATE, + processingMode=ProcessingModeEnum.DETAILED, + temperature=0.7 # Balanced temperature for creativity and consistency + ) + ) + + nameResponse = await services.ai.callAi(nameRequest) + raw_response = nameResponse.content.strip() + + logger.info(f"AI name generation raw response (full): {raw_response}") + + # Extract title from response - look for "TITEL:" or "TITLE:" marker first + generated_name = raw_response + + # Try to extract title after "TITEL:" or "TITLE:" marker (case insensitive) + title_markers = ["TITEL:", "TITLE:", "Titre:", "Titel:", "TITRE:", "titel:", "title:"] + for marker in title_markers: + if marker.lower() in raw_response.lower(): + # Find the marker (case insensitive) + marker_pos = raw_response.lower().find(marker.lower()) + if marker_pos >= 0: + generated_name = raw_response[marker_pos + len(marker):].strip() + # Take only the first line after the marker + generated_name = generated_name.split('\n')[0].strip() + logger.info(f"Extracted title after marker '{marker}': {generated_name}") + break + + # If no marker found, try to find the last meaningful line + if generated_name == raw_response or len(generated_name) > 60: + lines = [line.strip() for line in raw_response.split("\n") if line.strip()] + # Look for a line that looks like a title (not too long, no colons except at start) + for line in reversed(lines): + # Skip lines that are clearly explanations or steps + if any(skip in line.lower() for skip in ["schritt", "step", "étape", "beispiel", "example", "wichtig", "important"]): + continue + # Take lines that are reasonable title length and don't have colons in the middle + if 3 <= len(line) <= 60 and (":" not in line or line.startswith(":")): + generated_name = line + logger.info(f"Extracted title from last meaningful line: {generated_name}") + break + + # Remove common prefixes/suffixes and clean up + generated_name = re.sub(r'^(Title|Titel|Titre|Name|Name:):\s*', '', generated_name, flags=re.IGNORECASE) + generated_name = re.sub(r'^["\']|["\']$', '', generated_name) # Remove surrounding quotes + generated_name = re.sub(r'^#+\s*', '', generated_name) # Remove markdown headers + generated_name = re.sub(r'^```.*?\n', '', generated_name, flags=re.DOTALL) # Remove code blocks start + generated_name = re.sub(r'\n.*?```$', '', generated_name, flags=re.DOTALL) # Remove code blocks end + + # Take only the first line (in case AI added explanations) + generated_name = generated_name.split('\n')[0].strip() + + # Remove ALL question marks, exclamation marks, and trailing periods + generated_name = re.sub(r'[?!]+', '', generated_name) # Remove all ? and ! + generated_name = re.sub(r'\.+$', '', generated_name) # Remove trailing periods + + generated_name = generated_name.strip() + + # Ensure proper title case (capitalize first letter of each word, but handle acronyms) + if generated_name: + # Split into words and capitalize properly + words = generated_name.split() + capitalized_words = [] + for word in words: + # Keep acronyms (all caps) as-is, otherwise capitalize first letter + if word.isupper() and len(word) > 1: + capitalized_words.append(word) + else: + # Capitalize first letter, lowercase the rest + capitalized_words.append(word.capitalize()) + generated_name = " ".join(capitalized_words) + + # Validate: should be a proper title, not just copied words + # Check if it's too similar to the original (just first words) + prompt_words = set(userPrompt.lower().split()[:6]) + name_words = set(generated_name.lower().split()) + similarity = len(prompt_words.intersection(name_words)) / max(len(prompt_words), 1) + + # If too similar (more than 80% same words), it's probably just copied + if similarity > 0.8 and len(generated_name.split()) <= len(userPrompt.split()[:5]): + logger.warning(f"Generated name too similar to input, regenerating: {generated_name}") + # Try once more with a more explicit prompt + retry_prompt = f"""CRITICAL: Create a professional title in THE SAME LANGUAGE as the user's question. + +Question: {truncated_prompt} + +The title MUST be in the exact same language as the question above. +- If the question is in German, respond in German +- If the question is in French, respond in French +- If the question is in English, respond in English + +Create a professional title (max 60 characters, no punctuation) that summarizes the topic. + +Title (in the same language as the question):""" + # Ensure AI services are initialized (should already be, but be safe) + await services.ai.ensureAiObjectsInitialized() + + retryRequest = AiCallRequest( + prompt=retry_prompt, + options=AiCallOptions( + resultFormat="txt", + operationType=OperationTypeEnum.DATA_GENERATE, + processingMode=ProcessingModeEnum.DETAILED, + temperature=0.8 + ) + ) + retryResponse = await services.ai.callAi(retryRequest) + generated_name = retryResponse.content.strip() + generated_name = re.sub(r'^(Title|Titel|Titre|Name|Name:):\s*', '', generated_name, flags=re.IGNORECASE) + generated_name = re.sub(r'^["\']|["\']$', '', generated_name) + generated_name = generated_name.split('\n')[0].strip() + generated_name = re.sub(r'[?!]+', '', generated_name) # Remove all ? and ! + generated_name = re.sub(r'\.+$', '', generated_name) # Remove trailing periods + # Apply title case + if generated_name: + words = generated_name.split() + capitalized_words = [] + for word in words: + if word.isupper() and len(word) > 1: + capitalized_words.append(word) + else: + capitalized_words.append(word.capitalize()) + generated_name = " ".join(capitalized_words).strip() + + # Final validation and length check + if not generated_name or len(generated_name) < 3: + logger.error(f"Generated name too short or empty: '{generated_name}'") + # Use default title based on language + if userLanguage == "de": + generated_name = "Chatbot Konversation" + elif userLanguage == "fr": + generated_name = "Conversation Chatbot" + else: + generated_name = "Chatbot Conversation" + + # Final cleanup: ensure no question marks or trailing punctuation + generated_name = re.sub(r'[?!]+', '', generated_name) + generated_name = re.sub(r'\.+$', '', generated_name).strip() + + # Final length check and truncation + if len(generated_name) > 60: + # Try to truncate at word boundary + truncated = generated_name[:57] + last_space = truncated.rfind(' ') + if last_space > 30: # Only truncate at word boundary if reasonable + generated_name = truncated[:last_space] + "..." + else: + generated_name = truncated + "..." + + logger.info(f"Generated conversation name: '{generated_name}' from prompt: '{userPrompt[:50]}...'") + return generated_name + + except Exception as e: + logger.error(f"Error generating conversation name: {e}", exc_info=True) + # Use default title based on language + if userLanguage == "de": + return "Chatbot Konversation" + elif userLanguage == "fr": + return "Conversation Chatbot" + else: + return "Chatbot Conversation" + + +async def chatProcess( + currentUser: User, + userInput: UserInputRequest, + workflowId: Optional[str] = None +) -> ChatWorkflow: + """ + Simple chatbot processing - direct AI center implementation. + + Flow: + 1. Create or load workflow + 2. Store user message + 3. AI analyzes: determine if DB query/web research needed + 4. Execute database query if needed + 5. Execute web research if needed + 6. Generate final answer + 7. Store assistant message + 8. Return workflow + + Args: + currentUser: Current user + userInput: User input request + workflowId: Optional workflow ID to continue existing conversation + + Returns: + ChatWorkflow instance + """ + try: + # Get services + services = getServices(currentUser, None) + interfaceDbChat = services.interfaceDbChat + + # Get event manager and create queue if needed + event_manager = get_event_manager() + + # Create or load workflow + if workflowId: + workflow = interfaceDbChat.getWorkflow(workflowId) + if not workflow: + raise ValueError(f"Workflow {workflowId} not found") + + # Resume workflow: increment round number + new_round = workflow.currentRound + 1 + interfaceDbChat.updateWorkflow(workflowId, { + "status": "running", + "currentRound": new_round, + "lastActivity": getUtcTimestamp() + }) + workflow = interfaceDbChat.getWorkflow(workflowId) + logger.info(f"Resumed workflow {workflowId}, round incremented to {new_round}") + + # Create event queue if it doesn't exist (for streaming) + if not event_manager.has_queue(workflowId): + event_manager.create_queue(workflowId) + else: + # Generate conversation name based on user's prompt + conversation_name = await _generate_conversation_name( + services, + userInput.prompt, + userInput.userLanguage + ) + + # Create new workflow + workflowData = { + "id": str(uuid.uuid4()), + "mandateId": currentUser.mandateId, + "status": "running", + "name": conversation_name, + "currentRound": 1, + "currentTask": 0, + "currentAction": 0, + "totalTasks": 0, + "totalActions": 0, + "workflowMode": WorkflowModeEnum.WORKFLOW_CHATBOT.value, # Use Chatbot mode for chatbot conversations + "startedAt": getUtcTimestamp(), + "lastActivity": getUtcTimestamp() + } + workflow = interfaceDbChat.createWorkflow(workflowData) + logger.info(f"Created new chatbot workflow: {workflow.id} with name: {conversation_name}") + + # Create event queue for new workflow (for streaming) + event_manager.create_queue(workflow.id) + + # Reload workflow to get current message count + workflow = interfaceDbChat.getWorkflow(workflow.id) + + # Store user message + userMessageData = { + "id": f"msg_{uuid.uuid4()}", + "workflowId": workflow.id, + "message": userInput.prompt, + "role": "user", + "status": "first" if workflowId is None else "step", + "sequenceNr": len(workflow.messages) + 1, + "publishedAt": getUtcTimestamp(), + "roundNumber": workflow.currentRound, + "taskNumber": 0, + "actionNumber": 0 + } + userMessage = interfaceDbChat.createMessage(userMessageData) + logger.info(f"Stored user message: {userMessage.id}") + + # Emit message event for streaming (exact chatData format) + event_manager = get_event_manager() + message_timestamp = parseTimestamp(userMessage.publishedAt, default=getUtcTimestamp()) + await event_manager.emit_event( + workflow.id, + "chatdata", + "New message", + "message", + { + "type": "message", + "createdAt": message_timestamp, + "item": userMessage.dict() + } + ) + + # Update workflow status + interfaceDbChat.updateWorkflow(workflow.id, { + "status": "running", + "lastActivity": getUtcTimestamp() + }) + + # Process in background (async) + asyncio.create_task(_processChatbotMessage( + services, + workflow.id, + userInput, + userMessage.id + )) + + # Reload workflow to include new message + workflow = interfaceDbChat.getWorkflow(workflow.id) + return workflow + + except Exception as e: + logger.error(f"Error in chatProcess: {str(e)}", exc_info=True) + raise + + +async def _check_workflow_status(interfaceDbChat, workflowId: str, event_manager) -> bool: + """ + Check if workflow is stopped. If stopped, emit stopped event and return True. + + Returns: + True if workflow is stopped, False otherwise + """ + workflow = interfaceDbChat.getWorkflow(workflowId) + if workflow and workflow.status == "stopped": + await event_manager.emit_event( + workflowId, + "stopped", + "Workflow stopped", + "stopped" + ) + logger.info(f"Workflow {workflowId} was stopped, exiting processing") + return True + return False + + +async def _processChatbotMessage( + services, + workflowId: str, + userInput: UserInputRequest, + userMessageId: str +): + """ + Process chatbot message in background. + Executes the actual chatbot logic. + """ + event_manager = get_event_manager() + + try: + interfaceDbChat = services.interfaceDbChat + + # Reload workflow to get current messages + workflow = interfaceDbChat.getWorkflow(workflowId) + if not workflow: + logger.error(f"Workflow {workflowId} not found during processing") + await event_manager.emit_event( + workflowId, + "error", + f"Workflow {workflowId} nicht gefunden", + "error" + ) + return + + # Check if workflow was stopped + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Helper function to process streaming messages from AI responses and create logs + def process_streaming_messages(ai_response_data: Dict[str, Any], progress: Optional[float] = None): + """Process streaming messages from AI response and create logs.""" + if not ai_response_data: + return + + streaming_messages = ai_response_data.get("streamingMessages", []) + if isinstance(streaming_messages, list): + workflow = interfaceDbChat.getWorkflow(workflowId) + if workflow: + for msg in streaming_messages: + if isinstance(msg, str) and msg.strip(): + try: + services.chat.storeLog(workflow, { + "message": msg.strip(), + "type": "info", + "status": "running", + "progress": progress if progress is not None else 0.5 + }) + except Exception as e: + logger.warning(f"Error creating log from streaming message: {e}") + + # Build conversation context from history + context = "" + if workflow.messages: + recent_messages = workflow.messages[-5:] # Last 5 messages + context = "\n\nPrevious conversation:\n" + for msg in recent_messages: + if msg.role == "user": + context += f"User: {msg.message}\n" + elif msg.role == "assistant": + context += f"Assistant: {msg.message}\n" + + # Ensure AI service is initialized + await services.ai.ensureAiObjectsInitialized() + + # Get current date for prompts + current_date = datetime.datetime.now().strftime("%d.%m.%Y") + + # Check if workflow was stopped before starting analysis + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 1: AI Analysis - create detailed plan for all database queries needed + logger.info("Step 1: Analyzing user input and creating query plan...") + + await event_manager.emit_event( + workflowId, + "status", + "Analysiere Benutzeranfrage und erstelle Abfrageplan...", + "analysis" + ) + + analysisPrompt = f"""Heute ist der {current_date}. + +Du bist ein Chatbot der Althaus AG. +Du hast Zugriff auf ein SQL query tool, dass es dir ermöglicht, SQL SELECT Abfragen auf der Althaus AG Datenbank auszuführen. + +Du kannst dem Nutzer bei allen Aufgaben helfen, die du mit SQL Abfragen erledigen kannst. + +DATENBANK-INFORMATIONEN: +- Datenbankdatei: /data/database.db (SQLite) +- Tabellen: Artikel, Einkaufspreis, Lagerplatz_Artikel + +Die Datenbank besteht aus drei Tabellen, die über Beziehungen verbunden sind: +- **Artikel**: Enthält alle Produktinformationen (I_ID, Artikelbezeichnung, Artikelnummer, etc.) +- **Einkaufspreis**: Enthält Preisdaten (m_Artikel, EP_CHF) +- **Lagerplatz_Artikel**: Enthält Lagerbestands- und Lagerplatzinformationen (R_ARTIKEL, R_LAGERPLATZ, S_IST_BESTAND, etc.) +- **Beziehungen**: + - Artikel.I_ID = Einkaufspreis.m_Artikel + - Artikel.I_ID = Lagerplatz_Artikel.R_ARTIKEL + +TABELLEN-SCHEMA (WICHTIG - Spalten mit Leerzeichen/Sonderzeichen IMMER in doppelte Anführungszeichen setzen): + +Tabelle 1: Artikel +CREATE TABLE Artikel ( + "I_ID" INTEGER PRIMARY KEY, + "Artikelbeschrieb" TEXT, + "Artikelbezeichnung" TEXT, + "Artikelgruppe" TEXT, + "Artikelkategorie" TEXT, + "Artikelkürzel" TEXT, + "Artikelnummer" TEXT, + "Einheit" TEXT, + "Gesperrt" TEXT, + "Keywords" TEXT, + "Lieferant" TEXT, + "Warengruppe" TEXT +) + +Tabelle 2: Einkaufspreis +CREATE TABLE Einkaufspreis ( + "m_Artikel" INTEGER, + "EP_CHF" FLOAT +) + +Tabelle 3: Lagerplatz_Artikel +CREATE TABLE Lagerplatz_Artikel ( + "R_ARTIKEL" INTEGER, + "R_LAGERPLATZ" TEXT, + "S_BESTELLTER_BESTAND" INTEGER, + "S_IST_BESTAND" TEXT, + "S_MAXIMALBESTAND" INTEGER, + "S_MINDESTBESTAND" INTEGER, + "S_RESERVIERTER_BESTAND" INTEGER, + "S_SOLL_BESTAND" INTEGER +) + +SQL-HINWEISE: +- Verwende IMMER doppelte Anführungszeichen für Spaltennamen: "Artikelkürzel", "Artikelnummer", etc. +- Für Textsuche verwende LIKE mit Wildcards: WHERE a."Artikelbezeichnung" LIKE '%suchbegriff%' +- Für Preisabfragen: Nutze JOINs um auf e."EP_CHF" zuzugreifen +- Für Lagerbestände: Nutze JOINs um auf l."S_IST_BESTAND", l."S_SOLL_BESTAND", etc. zuzugreifen +- WICHTIG bei S_IST_BESTAND: Dieser Wert kann "Unbekannt" sein (TEXT), nicht nur Zahlen! Prüfe mit WHERE l."S_IST_BESTAND" != 'Unbekannt' wenn du nur numerische Werte willst +- Verwende Tabellenaliase (a für Artikel, e für Einkaufspreis, l für Lagerplatz_Artikel) für bessere Lesbarkeit + +SQL-AGGREGATIONEN: +Du kannst SQL-Aggregationsfunktionen verwenden, um statistische Auswertungen und Zusammenfassungen zu erstellen: +- COUNT() - Anzahl zählen +- SUM() - Summe berechnen (z.B. SUM(CASE WHEN l."S_IST_BESTAND" != 'Unbekannt' THEN CAST(l."S_IST_BESTAND" AS INTEGER) ELSE 0 END)) +- AVG() - Durchschnitt +- MIN() / MAX() - Minimum/Maximum +- GROUP BY - Gruppierung + +STREAMING-UPDATES: +WICHTIG: Du kannst mehrere Tools parallel aufrufen! Wenn es sinnvoll ist, kannst du: +- Mehrere SQL-Abfragen gleichzeitig ausführen (z.B. verschiedene Suchkriterien parallel abfragen) +- SQL-Abfragen und Tavily-Suchen kombinieren (z.B. Artikel in der DB finden UND gleichzeitig im Internet nach Produktinformationen suchen) +- Verschiedene Analysen parallel durchführen + +Nutze diese Parallelisierung, um effizienter zu arbeiten und dem Nutzer schneller umfassende Antworten zu geben. + +Du hast Zugriff auf das Tool "send_streaming_message", mit dem du dem Nutzer kurze Status-Updates senden kannst, während du an seiner Anfrage arbeitest. Nutze dieses Tool, um den Nutzer über deine aktuellen Aktivitäten zu informieren. Du kannst es parallel zu anderen Tools aufrufen. + +Beispiele für Status-Updates: +- "Analysiere Benutzeranfrage..." +- "Bestimme benötigte Datenbankabfragen..." +- "Identifiziere relevante Suchbegriffe..." +- "Erstelle Abfrageplan mit allen benötigten Queries..." +- "Durchsuche Datenbank nach Lampen, LED, Leuchten, und Ähnlichem.." +- "Suche im Internet nach Produktinformationen zu [Produktname].." +- "Analysiere Suchergebnisse und bereite Antwort vor.." +- "Führe erweiterte Datenbankabfrage durch.." + +Sende diese Updates sehr sehr häufig, damit der Nutzer weiss, was du gerade machst. Es ist ganz wichtig, dass du den Nutzer so oft es geht auf dem Laufenden hältst. +Die Beispiele oben sind nur Beispiele. Wenn möglich, sei spezifischer und kreativer, damit der Nutzer genau weiss, was du gerade tust. +Falls es möglich ist, gib in den Status-Updates auch schon Zwischenergebnisse an, z.B. "Habe 20 Artikel gefunden, suche weiter nach ähnlichen Begriffen". +Du kannst auch gerne deinen Denkenprozess in den Status-Updates beschreiben, z.B. "Überlege, welche Suchbegriffe ich noch verwenden könnte". +Es ist super wichtig, dass wir dem Nutzer laufend Updates geben, damit er nicht das Gefühl hat, dass er zu lange warten muss. +Wichtig: Sende auch eine Status-Update, wenn du die Zusammenfassende Antwort an den Nutzer schreibst, z.B. "Formuliere finale Antwort mit übersichtlicher Tabelle..". + +Analyze the user's question: {userInput.prompt}{context} + +Determine what actions are needed to answer this question. Return ONLY a valid JSON object: +{{ + "needsDatabaseQuery": boolean, + "needsWebResearch": boolean, + "sqlQuery": string (if needsDatabaseQuery is true, generate the SQL query with correct column names using double quotes), + "reasoning": string, + "streamingMessages": array of strings (status updates to send to user via send_streaming_message tool, e.g. ["Analysiere Benutzeranfrage...", "Bestimme benötigte Datenbankabfragen..."]) +}} + +WICHTIG für SQL-Queries: +- Verwende IMMER doppelte Anführungszeichen für Spaltennamen +- Für Lagerbestand: Verwende l."S_IST_BESTAND" (NICHT "Bestände"!) +- Bei Aggregationen mit S_IST_BESTAND: SUM(CASE WHEN l."S_IST_BESTAND" != 'Unbekannt' THEN CAST(l."S_IST_BESTAND" AS INTEGER) ELSE 0 END) + +Only use SELECT queries for database. Return valid JSON only.""" + + analysisRequest = AiCallRequest( + prompt=analysisPrompt, + options=AiCallOptions( + resultFormat="json", + operationType=OperationTypeEnum.DATA_ANALYSE, + processingMode=ProcessingModeEnum.BASIC + ) + ) + + analysisResponse = await services.ai.callAi(analysisRequest) + + # Log raw response for debugging + logger.debug(f"Raw AI analysis response: {analysisResponse.content[:500]}") + + # Parse analysis result with improved JSON extraction + analysis = _extractJsonFromResponse(analysisResponse.content) + + # Process streaming messages from AI (create logs) + process_streaming_messages(analysis, progress=0.1) + + if analysis: + needsDatabaseQuery = analysis.get("needsDatabaseQuery", False) + needsWebResearch = analysis.get("needsWebResearch", False) + queryPlan = analysis.get("queryPlan", {}) + reasoning = analysis.get("reasoning", "") + else: + # JSON parsing failed - fallback + logger.warning("Failed to parse analysis JSON, using fallback") + question_lower = userInput.prompt.lower() + db_keywords = ["stock", "lager", "bestand", "artikel", "preis", "price", "wie viele", "how many"] + needsDatabaseQuery = any(keyword in question_lower for keyword in db_keywords) + needsWebResearch = False + queryPlan = {} + reasoning = "Failed to parse analysis" + + logger.info(f"Analysis result: DB={needsDatabaseQuery}, Web={needsWebResearch}, Plan keys={list(queryPlan.keys()) if queryPlan else 'None'}...") + + await event_manager.emit_event( + workflowId, + "progress", + f"Analyse abgeschlossen: {len(queryPlan.keys()) if queryPlan else 0} Abfrage-Kategorien identifiziert", + "analysis", + {"needsDatabaseQuery": needsDatabaseQuery, "needsWebResearch": needsWebResearch} + ) + + # Check if workflow was stopped after analysis + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 2: Generate all SQL queries based on the plan + allQueries = {} # Store all queries to execute + queryResults = {} # Store results from all queries + + if needsDatabaseQuery and queryPlan: + logger.info("Step 2: Generating all SQL queries from plan...") + + # Store log: Query generation started + services.chat.storeLog(workflow, { + "message": "Generiere alle SQL-Abfragen basierend auf dem Plan...", + "type": "info", + "status": "running", + "progress": 0.3 + }) + + await event_manager.emit_event( + workflowId, + "status", + "Generiere alle SQL-Abfragen basierend auf dem Plan...", + "query_generation" + ) + + # Build query generation prompt + query_generation_prompt = f"""Based on this query plan: {json.dumps(queryPlan, indent=2, ensure_ascii=False)} + +And the user question: {userInput.prompt}{context} + +Generate ALL SQL queries needed. Return ONLY a valid JSON object with all queries: +{{ + "mainQuery": "SQL query for main query", + "statisticsQueries": {{ + "query1": "SQL query description and SQL", + "query2": "SQL query description and SQL" + }}, + "supplierQueries": {{ + "query1": "SQL query description and SQL" + }}, + "articleQueries": {{ + "query1": "SQL query description and SQL" + }}, + "additionalQueries": {{ + "query1": "SQL query description and SQL" + }}, + "streamingMessages": ["array of status updates via send_streaming_message tool"] +}} + +STREAMING-UPDATES: +Während du die Queries generierst, denke an hilfreiche Status-Updates: +- "Generiere Hauptabfrage..." +- "Erstelle Statistik-Abfragen..." +- "Vorbereite Lieferanten-Analyse-Abfrage..." +- "Erstelle Top-20-Artikel-Abfrage..." +- "Generiere zusätzliche relevante Abfragen..." + +IMPORTANT: +- Use double quotes for all column names +- For stock calculations: Use SUM(CASE WHEN l."S_IST_BESTAND" != 'Unbekannt' THEN CAST(l."S_IST_BESTAND" AS INTEGER) ELSE 0 END) +- For top articles: ORDER BY CAST(l."S_IST_BESTAND" AS INTEGER) DESC LIMIT 20 +- Extract search terms from user question (e.g., "LED", "Lampe", etc.) and use in WHERE clauses +- All queries should use consistent search criteria + +Return ONLY valid JSON, no other text.""" + + query_generation_request = AiCallRequest( + prompt=query_generation_prompt, + options=AiCallOptions( + resultFormat="json", + operationType=OperationTypeEnum.DATA_ANALYSE, + processingMode=ProcessingModeEnum.BASIC + ) + ) + + query_generation_response = await services.ai.callAi(query_generation_request) + queries_data = _extractJsonFromResponse(query_generation_response.content) + + # Process streaming messages from AI (create logs) + process_streaming_messages(queries_data, progress=0.3) + + if queries_data: + # Collect all queries + if queries_data.get("mainQuery"): + allQueries["main"] = queries_data["mainQuery"] + + # Collect statistics queries + if queries_data.get("statisticsQueries"): + for key, value in queries_data["statisticsQueries"].items(): + if isinstance(value, str): + allQueries[f"stat_{key}"] = value + elif isinstance(value, dict) and "sql" in value: + allQueries[f"stat_{key}"] = value["sql"] + + # Collect supplier queries + if queries_data.get("supplierQueries"): + for key, value in queries_data["supplierQueries"].items(): + if isinstance(value, str): + allQueries[f"supplier_{key}"] = value + elif isinstance(value, dict) and "sql" in value: + allQueries[f"supplier_{key}"] = value["sql"] + + # Collect article queries + if queries_data.get("articleQueries"): + for key, value in queries_data["articleQueries"].items(): + if isinstance(value, str): + allQueries[f"article_{key}"] = value + elif isinstance(value, dict) and "sql" in value: + allQueries[f"article_{key}"] = value["sql"] + + # Collect additional queries + if queries_data.get("additionalQueries"): + for key, value in queries_data["additionalQueries"].items(): + if isinstance(value, str): + allQueries[f"additional_{key}"] = value + elif isinstance(value, dict) and "sql" in value: + allQueries[f"additional_{key}"] = value["sql"] + + logger.info(f"Generated {len(allQueries)} queries from plan") + + await event_manager.emit_event( + workflowId, + "progress", + f"{len(allQueries)} SQL-Abfragen erfolgreich generiert", + "query_generation", + {"queryCount": len(allQueries), "queries": list(allQueries.keys())} + ) + else: + logger.warning("Failed to generate queries from plan") + + await event_manager.emit_event( + workflowId, + "error", + "Fehler beim Generieren der SQL-Abfragen", + "query_generation" + ) + + # Check if workflow was stopped before query execution + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 3: Execute all queries in parallel + if allQueries: + logger.info(f"Step 3: Executing {len(allQueries)} queries in parallel...") + + await event_manager.emit_event( + workflowId, + "status", + f"Führe {len(allQueries)} Datenbankabfragen parallel aus...", + "query_execution" + ) + try: + connector = PreprocessorConnector() + + async def execute_query(query_key, query_sql): + """Execute a single query and return result.""" + try: + result = await connector.executeQuery(query_sql) + if not result.startswith(("Error:", "Query failed:", "Network error:", "API error:")): + return (query_key, result) + else: + logger.warning(f"{query_key} query returned error: {result[:100]}") + return (query_key, None) + except Exception as e: + logger.warning(f"{query_key} query failed: {e}") + return (query_key, None) + + # Execute all queries in parallel + tasks = [execute_query(key, sql) for key, sql in allQueries.items()] + results = await asyncio.gather(*tasks) + + # Process results + successful_queries = 0 + for query_key, result in results: + if result is not None: + queryResults[query_key] = result + successful_queries += 1 + logger.info(f"{query_key} query executed successfully") + await event_manager.emit_event( + workflowId, + "progress", + f"Abfrage '{query_key}' erfolgreich ausgeführt", + "query_execution", + {"queryKey": query_key} + ) + + await event_manager.emit_event( + workflowId, + "progress", + f"{successful_queries} von {len(allQueries)} Abfragen erfolgreich ausgeführt", + "query_execution", + {"successful": successful_queries, "total": len(allQueries)} + ) + + await connector.close() + except Exception as e: + logger.error(f"Error executing queries: {e}") + queryResults["error"] = f"Error executing queries: {str(e)}" + + await event_manager.emit_event( + workflowId, + "error", + f"Fehler beim Ausführen der Abfragen: {str(e)}", + "query_execution" + ) + + # Check if workflow was stopped after query execution + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 3: Execute web research if needed + webResearchResults = "" + if needsWebResearch: + logger.info("Step 3: Performing web research...") + + try: + researchResult = await services.web.performWebResearch( + prompt=userInput.prompt, + urls=[], + country=None, + language=userInput.userLanguage or "de", + researchDepth="general", + operationId=None + ) + # Extract text from research result + if isinstance(researchResult, dict): + webResearchResults = json.dumps(researchResult, ensure_ascii=False, indent=2) + else: + webResearchResults = str(researchResult) + logger.info("Web research completed successfully") + + await event_manager.emit_event( + workflowId, + "progress", + "Internet-Recherche abgeschlossen", + "web_research" + ) + except Exception as e: + logger.error(f"Web research failed: {e}") + webResearchResults = f"Web research error: {str(e)}" + + await event_manager.emit_event( + workflowId, + "error", + f"Fehler bei Internet-Recherche: {str(e)}", + "web_research" + ) + + # Check if workflow was stopped before answer generation + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 4: Generate final answer + logger.info("Step 4: Generating final answer from all query results...") + + await event_manager.emit_event( + workflowId, + "status", + "Formuliere finale Antwort mit allen Ergebnissen...", + "answer_generation" + ) + + # Build context for final answer with all query results + answerContext = f"User question: {userInput.prompt}{context}\n\n" + + if queryResults: + answerContext += "Database query results (all queries executed in parallel):\n\n" + for query_key, result in queryResults.items(): + if query_key != "error": + answerContext += f"{query_key} results:\n{result}\n\n" + if "error" in queryResults: + answerContext += f"Errors: {queryResults['error']}\n\n" + + if webResearchResults: + answerContext += f"Web research results:\n{webResearchResults}\n\n" + + answerPrompt = f"""Heute ist der {current_date}. + +Du bist ein Chatbot der Althaus AG. +Du hast Zugriff auf ein SQL query tool, dass es dir ermöglicht, SQL SELECT Abfragen auf der Althaus AG Datenbank auszuführen. + +KRITISCH - AUSFÜHRLICHE ANTWORTEN ERFORDERLICH: +Du MUSST immer sehr ausführliche, detaillierte und strukturierte Antworten geben. Einfache, kurze Antworten sind NICHT ausreichend! + +ANTWORT-STRUKTUR FÜR DATENBANK-ABFRAGEN: +Wenn du Datenbank-Ergebnisse präsentierst, MUSS deine Antwort folgende Struktur haben: + +1. EINLEITUNG MIT QUELLENANGABE: + - Beginne IMMER mit: "Aus der Datenbank habe ich eine umfassende Analyse [des Themas] durchgeführt:" + - Oder: "Aus der Datenbank habe ich folgende Informationen gefunden:" + +2. ÜBERSCHRIFT MIT THEMA: + - Gib eine klare Überschrift, z.B. "LED-Lagerbestand Übersicht" oder "Artikel-Übersicht: [Suchbegriff]" + +3. ZUSAMMENFASSUNG MIT STATISTIKEN: + - Gib IMMER eine detaillierte Zusammenfassung mit wichtigen Kennzahlen + - Beispiele: + * "Gesamtbestand LEDs: 7'411 Stück verteilt auf 157 verschiedene Artikel" + * "1'027 LED-Artikel insgesamt in der Datenbank" + * "157 Artikel haben aktuell Lagerbestand > 0" + * "273 Artikel ohne Lagerinformationen" + - Formatiere Zahlen mit Tausender-Trennzeichen (z.B. 7'411 statt 7411) + - Verwende Aufzählungen für bessere Lesbarkeit + +4. TOP-LIEFERANTEN TABELLE (wenn relevant): + - Wenn mehrere Lieferanten vorhanden sind, erstelle IMMER eine Tabelle mit Top-Lieferanten + - Spalten: Lieferant, Anzahl Artikel, Gesamtbestand (oder andere relevante Metriken) + - Sortiere nach Gesamtbestand oder Anzahl Artikel (absteigend) + - Zeige mindestens Top 10 Lieferanten + +5. TOP-ARTIKEL TABELLE: + - Erstelle IMMER eine Tabelle mit den Top 20 Artikeln + - Spalten sollten enthalten: Artikelnummer (als Link), Artikelbezeichnung, Lieferant, Lagerplatz, Ist-Bestand, Soll-Bestand (wenn verfügbar) + - Sortiere nach Ist-Bestand (absteigend) oder nach Relevanz + - Formatiere Zahlen mit Tausender-Trennzeichen + +6. ZUSÄTZLICHE ANALYSEN: + - Füge immer eine kurze Analyse hinzu, z.B.: + * "Phoenix Contact AG dominiert klar mit über 68% des gesamten LED-Lagerbestands" + * "Die meisten Artikel sind Beschriftungsmarker und -schilder" + - Erkläre interessante Muster oder Auffälligkeiten + +7. HINWEIS BEI MEHR ERGEBNISSEN: + - Wenn mehr als 20 Artikel existieren, füge IMMER hinzu: + * "_Es existieren weitere X Artikel. Die Tabelle zeigt die 20 Artikel mit dem höchsten Bestand._" + - Oder: "_Es wurden insgesamt X Artikel gefunden. Die Tabelle zeigt die ersten 20._" + +8. NÄCHSTE SCHRITTE - MEHRERE VORSCHLÄGE: + - Gib IMMER mindestens 5 verschiedene Vorschläge für nächste Schritte + - Formatiere als Aufzählung mit Bullet Points + - Beispiele: + * "Details zu einem bestimmten LED-Artikel erfahren?" + * "LED-Artikel mit niedrigem Lagerbestand oder unter Mindestbestand anzeigen?" + * "Nach spezifischen LED-Typen suchen (z.B. Signalleuchten, Anzeige-LEDs, LED-Strips)?" + * "Preisinformationen zu den LED-Artikeln abrufen?" + * "LED-Artikel eines bestimmten Lieferanten detailliert anzeigen?" + - Passe die Vorschläge an den Kontext an + +TABELLEN-FORMATIERUNG: +- Verwende IMMER Markdown-Tabellen für strukturierte Daten +- Spalten sollten klar getrennt sein mit | +- Header-Zeile sollte deutlich hervorgehoben sein +- Zahlen sollten rechtsbündig sein (in Markdown mit Leerzeichen) +- Verwende Tausender-Trennzeichen (z.B. 1'090 statt 1090) + +QUELLENANGABE - DATENBANK: +WICHTIG: Wenn du Informationen aus der Datenbank präsentierst, kennzeichne dies IMMER klar für den Nutzer. +- Beginne deine Antwort mit einer klaren Kennzeichnung, z.B.: "Aus der Datenbank habe ich eine umfassende Analyse durchgeführt:" +- Bei kombinierten Informationen (Datenbank + Internet): Trenne klar zwischen beiden Quellen + +QUELLENANGABE - INTERNET: +WICHTIG: Wenn du Informationen aus dem Internet präsentierst, kennzeichne dies IMMER klar für den Nutzer. +- Beginne Internet-Recherchen mit: "Aus meiner Internet-Recherche:" oder "Laut Online-Quellen:" +- Gib IMMER die konkreten Quellen an (Website-Namen und Links) +- Bei mehreren Quellen: Liste die Quellen auf und verweise darauf +- Trenne klar zwischen Datenbank-Informationen und Internet-Recherchen + +TABELLENLÄNGE UND ARTIKELANZAHL - KRITISCH: +WICHTIG: Zeige MAXIMAL 20 Artikel in Tabellen. Du darfst und sollst aber ausführliche Erklärungen liefern! + +ZAHLEN-PRÜFUNG - ABSOLUT KRITISCH: +BEVOR du deine finale Antwort zurückgibst, MUSST du diese Schritte befolgen: +1. ZÄHLE die TATSÄCHLICHEN Zeilen in deiner finalen Tabelle +2. Diese Zahl ist die EINZIGE korrekte Anzahl für deine Antwort +3. Verwende diese Zahl KONSISTENT überall in deiner Antwort +4. Formatiere Zahlen mit Tausender-Trennzeichen (z.B. 7'411 statt 7411) + +Wenn immer du eine Artikelnummer innerhalb einer Tabelle zurückgibst bitte markiere diese als Markdownlink: +[ARTIKELNUMMER](/details/ARTIKELNUMMER). ARTIKELNUMMER ist hierbei der Platzhalter, den du ersetzen musst. +WICHTIG! Du musst im Link die ARTIKELNUMMER sicher URL-encodieren. Encodiere aber NICHT die Artikelnummer in eckigen Klammern. Also encodiere den Ankertext nicht! +Ausserhalb einer Tabelle musst du keine Links auf Artikelnummern setzen. + +Du antwortest ausschliesslich auf Deutsch. Nutze kein sz(ß) sondern immer ss. + +STREAMING-UPDATES: +Während du die Antwort erstellst, denke daran, dass der Nutzer Updates erhalten sollte: +- "Kompliliere Statistiken..." +- "Erstelle Lieferanten-Tabelle..." +- "Formatiere Top-20-Artikel..." +- "Formuliere finale Antwort mit übersichtlicher Tabelle..." +- "Füge zusätzliche Analysen hinzu..." + +Sende diese Updates sehr häufig, damit der Nutzer weiss, was du gerade machst. Es ist ganz wichtig, dass du den Nutzer so oft es geht auf dem Laufenden hältst. +Die Beispiele oben sind nur Beispiele. Wenn möglich, sei spezifischer und kreativer, damit der Nutzer genau weiss, was du gerade tust. +Falls es möglich ist, gib in den Status-Updates auch schon Zwischenergebnisse an, z.B. "Habe 20 Artikel gefunden, suche weiter nach ähnlichen Begriffen". +Du kannst auch gerne deinen Denkenprozess in den Status-Updates beschreiben, z.B. "Überlege, welche Suchbegriffe ich noch verwenden könnte". +Es ist super wichtig, dass wir dem Nutzer laufend Updates geben, damit er nicht das Gefühl hat, dass er zu lange warten muss. +Wichtig: Sende auch eine Status-Update, wenn du die Zusammenfassende Antwort an den Nutzer schreibst, z.B. "Formuliere finale Antwort mit übersichtlicher Tabelle..". + +Answer the user's question in German: {userInput.prompt}{context} + +{answerContext} + +KRITISCH: Du hast jetzt ZUSÄTZLICHE Datenbankabfragen erhalten, die dir detaillierte Informationen liefern: +- "Total count query results" - Gesamtanzahl der Artikel +- "Top suppliers query results" - Top-Lieferanten mit Artikelanzahl und Gesamtbestand +- "Top 20 articles query results" - Top 20 Artikel mit allen Details + +VERWENDE ALLE DIESE DATEN für deine Antwort! Erstelle eine umfassende Antwort mit: + +1. EINLEITUNG: "Aus der Datenbank habe ich eine umfassende Analyse [des Themas] durchgeführt:" + +2. ÜBERSCHRIFT: z.B. "LED-Lagerbestand Übersicht" + +3. ZUSAMMENFASSUNG MIT STATISTIKEN: + - Verwende die Daten aus "Total count query results" für Gesamtanzahl + - Verwende die Daten aus "Initial database query results" für Gesamtbestand + - Berechne weitere Kennzahlen basierend auf den Daten + +4. TOP-LIEFERANTEN TABELLE: + - Verwende IMMER die Daten aus "Top suppliers query results" + - Erstelle eine Tabelle mit: Lieferant | Anzahl Artikel | Gesamtbestand + - Sortiere nach Gesamtbestand (absteigend) + - Zeige mindestens Top 10 + +5. TOP 20 ARTIKEL TABELLE: + - Verwende IMMER die Daten aus "Top 20 articles query results" + - Erstelle eine Tabelle mit: Artikelnummer (als Link) | Artikelbezeichnung | Lieferant | Lagerplatz | Ist-Bestand | Soll-Bestand + - Formatiere Zahlen mit Tausender-Trennzeichen + +6. ZUSÄTZLICHE ANALYSEN: + - Analysiere die Daten und gib interessante Erkenntnisse + - z.B. "Phoenix Contact AG dominiert klar mit über 68% des gesamten Lagerbestands" + +7. HINWEIS BEI MEHR ERGEBNISSEN: + - Wenn mehr als 20 Artikel existieren: "_Es existieren weitere X Artikel. Die Tabelle zeigt die 20 Artikel mit dem höchsten Bestand._" + +8. NÄCHSTE SCHRITTE: + - Gib mindestens 5 verschiedene Vorschläge als Aufzählung + +WICHTIG: +- Verwende ALLE verfügbaren Daten aus den zusätzlichen Abfragen +- Erstelle Tabellen aus den Daten - nicht nur Text! +- Formatiere Zahlen mit Tausender-Trennzeichen (z.B. 7'411 statt 7411) +- Sei sehr ausführlich und detailliert - kurze Antworten sind NICHT ausreichend!""" + + answerRequest = AiCallRequest( + prompt=answerPrompt, + context=answerContext if (queryResults or webResearchResults) else None, + options=AiCallOptions( + resultFormat="txt", + operationType=OperationTypeEnum.DATA_ANALYSE, + processingMode=ProcessingModeEnum.BASIC + ) + ) + + answerResponse = await services.ai.callAi(answerRequest) + finalAnswer = answerResponse.content + + logger.info("Final answer generated successfully") + + # Store log: Answer generation completed + services.chat.storeLog(workflow, { + "message": "Antwort erfolgreich generiert", + "type": "info", + "status": "running", + "progress": 0.9 + }) + + await event_manager.emit_event( + workflowId, + "progress", + "Antwort erfolgreich generiert", + "answer_generation" + ) + + # Check if workflow was stopped after answer generation + if await _check_workflow_status(interfaceDbChat, workflowId, event_manager): + return + + # Step 5: Store assistant message + # Reload workflow to get updated message count + workflow = interfaceDbChat.getWorkflow(workflowId) + + assistantMessageData = { + "id": f"msg_{uuid.uuid4()}", + "workflowId": workflowId, + "parentMessageId": userMessageId, + "message": finalAnswer, + "role": "assistant", + "status": "last", + "sequenceNr": len(workflow.messages) + 1, + "publishedAt": getUtcTimestamp(), + "success": True, + "roundNumber": workflow.currentRound, + "taskNumber": 0, + "actionNumber": 0 + } + assistantMessage = interfaceDbChat.createMessage(assistantMessageData) + logger.info(f"Stored assistant message: {assistantMessage.id}") + + # Emit message event for streaming (exact chatData format) + message_timestamp = parseTimestamp(assistantMessage.publishedAt, default=getUtcTimestamp()) + await event_manager.emit_event( + workflowId, + "chatdata", + "New message", + "message", + { + "type": "message", + "createdAt": message_timestamp, + "item": assistantMessage.dict() + } + ) + + # Update workflow status to completed + interfaceDbChat.updateWorkflow(workflowId, { + "status": "completed", + "lastActivity": getUtcTimestamp() + }) + + logger.info(f"Chatbot processing completed for workflow {workflowId}") + + # Emit completion event + await event_manager.emit_event( + workflowId, + "complete", + "Chatbot-Verarbeitung abgeschlossen", + "complete", + {"workflowId": workflowId} + ) + + # Schedule cleanup + await event_manager.cleanup(workflowId) + + except Exception as e: + logger.error(f"Error processing chatbot message: {str(e)}", exc_info=True) + + # Store error message + try: + # Reload workflow to get current message count + workflow = interfaceDbChat.getWorkflow(workflowId) + + errorMessageData = { + "id": f"msg_{uuid.uuid4()}", + "workflowId": workflowId, + "parentMessageId": userMessageId, + "message": f"Sorry, I encountered an error: {str(e)}", + "role": "assistant", + "status": "last", + "sequenceNr": len(workflow.messages) + 1, + "publishedAt": getUtcTimestamp(), + "success": False, + "roundNumber": workflow.currentRound if workflow else 1, + "taskNumber": 0, + "actionNumber": 0 + } + errorMessage = interfaceDbChat.createMessage(errorMessageData) + + # Emit message event for streaming (exact chatData format) + message_timestamp = parseTimestamp(errorMessage.publishedAt, default=getUtcTimestamp()) + await event_manager.emit_event( + workflowId, + "chatdata", + "New message", + "message", + { + "type": "message", + "createdAt": message_timestamp, + "item": errorMessage.dict() + } + ) + + # Update workflow status to error + interfaceDbChat.updateWorkflow(workflowId, { + "status": "error", + "lastActivity": getUtcTimestamp() + }) + + # Schedule cleanup + await event_manager.cleanup(workflowId) + except Exception as storeError: + logger.error(f"Error storing error message: {storeError}") + diff --git a/modules/interfaces/interfaceDbChatObjects.py b/modules/interfaces/interfaceDbChatObjects.py index c16b18eb..04bde515 100644 --- a/modules/interfaces/interfaceDbChatObjects.py +++ b/modules/interfaces/interfaceDbChatObjects.py @@ -643,11 +643,11 @@ class ChatObjects: id=workflow["id"], status=workflow.get("status", "running"), name=workflow.get("name"), - currentRound=workflow.get("currentRound", 0), - currentTask=workflow.get("currentTask", 0), - currentAction=workflow.get("currentAction", 0), - totalTasks=workflow.get("totalTasks", 0), - totalActions=workflow.get("totalActions", 0), + currentRound=workflow.get("currentRound", 0) or 0, + currentTask=workflow.get("currentTask", 0) or 0, + currentAction=workflow.get("currentAction", 0) or 0, + totalTasks=workflow.get("totalTasks", 0) or 0, + totalActions=workflow.get("totalActions", 0) or 0, lastActivity=workflow.get("lastActivity", getUtcTimestamp()), startedAt=workflow.get("startedAt", getUtcTimestamp()), logs=logs, @@ -684,11 +684,11 @@ class ChatObjects: id=created["id"], status=created.get("status", "running"), name=created.get("name"), - currentRound=created.get("currentRound", 0), - currentTask=created.get("currentTask", 0), - currentAction=created.get("currentAction", 0), - totalTasks=created.get("totalTasks", 0), - totalActions=created.get("totalActions", 0), + currentRound=created.get("currentRound", 0) or 0, + currentTask=created.get("currentTask", 0) or 0, + currentAction=created.get("currentAction", 0) or 0, + totalTasks=created.get("totalTasks", 0) or 0, + totalActions=created.get("totalActions", 0) or 0, lastActivity=created.get("lastActivity", currentTime), startedAt=created.get("startedAt", currentTime), logs=[], @@ -1394,6 +1394,27 @@ class ChatObjects: # Create log in normalized table createdLog = self.db.recordCreate(ChatLog, log_model) + # Emit log event for streaming (if event manager is available) + try: + from modules.features.chatbot.eventManager import get_event_manager + event_manager = get_event_manager() + log_timestamp = parseTimestamp(createdLog.get("timestamp"), default=getUtcTimestamp()) + # Emit log event in exact chatData format: {type, createdAt, item} + asyncio.create_task(event_manager.emit_event( + workflowId, + "chatdata", + "New log", + "log", + { + "type": "log", + "createdAt": log_timestamp, + "item": ChatLog(**createdLog).dict() + } + )) + except Exception as e: + # Event manager not available or error - continue without emitting + logger.debug(f"Could not emit log event: {e}") + # Return validated ChatLog instance return ChatLog(**createdLog) diff --git a/modules/routes/routeChatbot.py b/modules/routes/routeChatbot.py new file mode 100644 index 00000000..0c3e2314 --- /dev/null +++ b/modules/routes/routeChatbot.py @@ -0,0 +1,444 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. +""" +Chatbot routes for the backend API. +Implements simple chatbot endpoints using direct AI center calls via chatbot feature. +""" + +import logging +import json +import asyncio +import math +from typing import Optional, Any, Dict, Union +from fastapi import APIRouter, HTTPException, Depends, Body, Path, Query, Request, status +from fastapi.responses import StreamingResponse +from modules.shared.timeUtils import parseTimestamp + +# Import auth modules +from modules.auth import limiter, getCurrentUser + +# Import interfaces +import modules.interfaces.interfaceDbChatObjects as interfaceDbChatObjects +from modules.interfaces.interfaceRbac import getRecordsetWithRBAC + +# Import models +from modules.datamodels.datamodelChat import ChatWorkflow, UserInputRequest, WorkflowModeEnum +from modules.datamodels.datamodelUam import User +from modules.datamodels.datamodelPagination import PaginationParams, PaginatedResponse + +# Import chatbot feature +from modules.features.chatbot import chatProcess +from modules.features.chatbot.eventManager import get_event_manager + +# Import workflow control functions +from modules.features.workflow import chatStop + +# Configure logger +logger = logging.getLogger(__name__) + +# Create router for chatbot endpoints +router = APIRouter( + prefix="/api/chatbot", + tags=["Chatbot"], + responses={404: {"description": "Not found"}} +) + +def getServiceChat(currentUser: User): + return interfaceDbChatObjects.getInterface(currentUser) + +# Chatbot streaming endpoint (SSE) +@router.post("/start/stream") +@limiter.limit("120/minute") +async def stream_chatbot_start( + request: Request, + workflowId: Optional[str] = Query(None, description="Optional ID of the workflow to continue (can also be in request body)"), + userInput: UserInputRequest = Body(...), + currentUser: User = Depends(getCurrentUser) +) -> StreamingResponse: + """ + Starts a new chatbot workflow or continues an existing one with SSE streaming. + Streams progress updates in real-time via Server-Sent Events. + + workflowId can be provided either: + - As a query parameter: /api/chatbot/start/stream?workflowId=xxx + - In the request body as part of UserInputRequest + - Query parameter takes precedence if both are provided + """ + event_manager = get_event_manager() + + try: + # Use workflowId from query parameter if provided, otherwise from request body + final_workflow_id = workflowId or userInput.workflowId + + # Start background processing (this will create the workflow and event queue) + workflow = await chatProcess(currentUser, userInput, final_workflow_id) + + # Get event queue for the workflow + queue = event_manager.get_queue(workflow.id) + if not queue: + # Create queue if it doesn't exist + queue = event_manager.create_queue(workflow.id) + + async def event_stream(): + """Async generator for SSE events.""" + try: + # Get interface for status checks and chat data + interfaceDbChat = getServiceChat(currentUser) + + # Send initial chat data (exact format as chatData endpoint) + try: + chatData = interfaceDbChat.getUnifiedChatData(workflow.id, None) + if chatData.get("items"): + for item in chatData["items"]: + # Emit item directly in exact chatData format: {type, createdAt, item} + yield f"data: {json.dumps(item)}\n\n" + # Set initial timestamp for incremental fetching + if chatData["items"]: + timestamps = [parseTimestamp(item.get("createdAt"), default=0) for item in chatData["items"]] + last_chatdata_timestamp = max(timestamps) if timestamps else None + else: + last_chatdata_timestamp = None + else: + last_chatdata_timestamp = None + except Exception as e: + logger.warning(f"Error fetching initial chat data: {e}") + last_chatdata_timestamp = None + + # Keepalive interval (30 seconds) + keepalive_interval = 30.0 + last_keepalive = asyncio.get_event_loop().time() + + # Status check interval (check workflow status every 3 seconds) + status_check_interval = 3.0 + last_status_check = asyncio.get_event_loop().time() + + # Chat data fetch interval (fetch chat data every 0.5 seconds for real-time updates) + chatdata_fetch_interval = 0.5 + last_chatdata_fetch = asyncio.get_event_loop().time() + + # Stream events until completion or timeout + timeout = 300.0 # 5 minutes max + start_time = asyncio.get_event_loop().time() + + while True: + # Check timeout + elapsed = asyncio.get_event_loop().time() - start_time + if elapsed > timeout: + # Timeout - just close stream, don't emit non-chatData format events + logger.info(f"Stream timeout for workflow {workflow.id}") + break + + # Check for client disconnection + if await request.is_disconnected(): + logger.info(f"Client disconnected for workflow {workflow.id}") + break + + current_time = asyncio.get_event_loop().time() + + # Periodically check workflow status and fetch chat data + if current_time - last_status_check >= status_check_interval: + try: + current_workflow = interfaceDbChat.getWorkflow(workflow.id) + if current_workflow and current_workflow.status == "stopped": + logger.info(f"Workflow {workflow.id} was stopped, closing stream") + # Don't emit stopped event - just close stream + break + except Exception as e: + logger.warning(f"Error checking workflow status: {e}") + last_status_check = current_time + + # Periodically fetch and emit chat data + if current_time - last_chatdata_fetch >= chatdata_fetch_interval: + try: + chatData = interfaceDbChat.getUnifiedChatData(workflow.id, last_chatdata_timestamp) + if chatData.get("items"): + # Emit items directly in exact chatData format: {type, createdAt, item} + for item in chatData["items"]: + yield f"data: {json.dumps(item)}\n\n" + # Update timestamp to only get new items next time + if chatData["items"]: + # Parse timestamps and get the maximum + timestamps = [] + for item in chatData["items"]: + ts = parseTimestamp(item.get("createdAt"), default=0) + timestamps.append(ts) + if timestamps: + last_chatdata_timestamp = max(timestamps) + except Exception as e: + logger.warning(f"Error fetching chat data: {e}") + last_chatdata_fetch = current_time + + # Try to get event with timeout + try: + event = await asyncio.wait_for(queue.get(), timeout=1.0) + + # Only emit chatdata events (messages, logs, stats) in exact chatData format + # Ignore status/progress/complete/stopped/error events that don't match the format + if event.get("type") == "chatdata" and event.get("data"): + # Emit item directly in exact chatData format: {type, createdAt, item} + chatdata_item = event.get("data") + yield f"data: {json.dumps(chatdata_item)}\n\n" + # Update timestamp for incremental fetching + if chatdata_item.get("createdAt"): + last_chatdata_timestamp = parseTimestamp(chatdata_item["createdAt"], default=None) + + # Check if this is a completion/stopped event to close stream + if event.get("type") == "complete": + logger.info(f"Workflow {workflow.id} completed, closing stream") + break + elif event.get("type") == "stopped": + # Workflow was stopped, close stream + logger.info(f"Workflow {workflow.id} stopped, closing stream") + break + elif event.get("type") == "error" and event.get("step") == "error": + # Final error, close stream + logger.warning(f"Workflow {workflow.id} error, closing stream") + break + + last_keepalive = asyncio.get_event_loop().time() + except asyncio.TimeoutError: + # Send keepalive if needed + current_time = asyncio.get_event_loop().time() + if current_time - last_keepalive >= keepalive_interval: + yield f": keepalive\n\n" + last_keepalive = current_time + continue + except Exception as e: + logger.error(f"Error in event stream: {e}") + yield f"data: {json.dumps({'type': 'error', 'message': f'Stream error: {str(e)}'})}\n\n" + break + + except Exception as e: + logger.error(f"Error in event stream generator: {e}", exc_info=True) + # Don't emit error events that don't match chatData format + finally: + # Stream ends - no final event needed as it doesn't match chatData format + pass + + return StreamingResponse( + event_stream(), + media_type="text/event-stream", + headers={ + "Cache-Control": "no-cache", + "Connection": "keep-alive", + "X-Accel-Buffering": "no" # Disable buffering for nginx + } + ) + + except Exception as e: + logger.error(f"Error in stream_chatbot_start: {str(e)}", exc_info=True) + raise HTTPException( + status_code=500, + detail=str(e) + ) + + +# Workflow stop endpoint +@router.post("/{workflowId}/stop", response_model=ChatWorkflow) +@limiter.limit("120/minute") +async def stop_chatbot( + request: Request, + workflowId: str = Path(..., description="ID of the workflow to stop"), + currentUser: User = Depends(getCurrentUser) +) -> ChatWorkflow: + """Stops a running chatbot workflow.""" + try: + workflow = await chatStop(currentUser, workflowId) + + # Emit stopped event to active streams + event_manager = get_event_manager() + await event_manager.emit_event( + workflowId, + "stopped", + "Workflow stopped by user", + "stopped" + ) + logger.info(f"Emitted stopped event for workflow {workflowId}") + + return workflow + + except Exception as e: + logger.error(f"Error in stop_chatbot: {str(e)}") + raise HTTPException( + status_code=500, + detail=str(e) + ) + +# Delete chatbot workflow endpoint +@router.delete("/{workflowId}", response_model=Dict[str, Any]) +@limiter.limit("120/minute") +async def delete_chatbot( + request: Request, + workflowId: str = Path(..., description="ID of the workflow to delete"), + currentUser: User = Depends(getCurrentUser) +) -> Dict[str, Any]: + """Deletes a chatbot workflow and its associated data.""" + try: + # Get service center + interfaceDbChat = getServiceChat(currentUser) + + # Check workflow access and permission using RBAC + workflows = getRecordsetWithRBAC( + interfaceDbChat.db, + ChatWorkflow, + currentUser, + recordFilter={"id": workflowId} + ) + if not workflows: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Workflow with ID {workflowId} not found" + ) + + workflow_data = workflows[0] + + # Check if workflow is a chatbot workflow + if workflow_data.get("workflowMode") != WorkflowModeEnum.WORKFLOW_CHATBOT.value: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=f"Workflow {workflowId} is not a chatbot workflow" + ) + + # Check if user has permission to delete using RBAC + if not interfaceDbChat.checkRbacPermission(ChatWorkflow, "delete", workflowId): + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail="You don't have permission to delete this workflow" + ) + + # Delete workflow + success = interfaceDbChat.deleteWorkflow(workflowId) + + if not success: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail="Failed to delete workflow" + ) + + return { + "id": workflowId, + "message": "Chatbot workflow and associated data deleted successfully" + } + except HTTPException: + raise + except Exception as e: + logger.error(f"Error in delete_chatbot: {str(e)}", exc_info=True) + raise HTTPException( + status_code=500, + detail=f"Error deleting chatbot workflow: {str(e)}" + ) + +# List chatbot threads/workflows or get specific thread details +@router.get("/threads") +@limiter.limit("120/minute") +async def get_chatbot_threads( + request: Request, + workflowId: Optional[str] = Query(None, description="Optional workflow ID to get details and chat data for a specific thread"), + pagination: Optional[str] = Query(None, description="JSON-encoded PaginationParams object (only used when workflowId is not provided)"), + currentUser: User = Depends(getCurrentUser) +) -> Union[PaginatedResponse[ChatWorkflow], Dict[str, Any]]: + """ + List all chatbot workflows (threads) for the current user, or get details and chat data for a specific thread. + + - If workflowId is provided: Returns the workflow details and all chat data (messages, logs, stats) + - If workflowId is not provided: Returns a paginated list of all workflows + """ + try: + interfaceDbChat = getServiceChat(currentUser) + + # If workflowId is provided, return single workflow with chat data + if workflowId: + workflow = interfaceDbChat.getWorkflow(workflowId) + if not workflow: + raise HTTPException( + status_code=404, + detail=f"Workflow with ID {workflowId} not found" + ) + + # Get unified chat data for this workflow + chatData = interfaceDbChat.getUnifiedChatData(workflowId, None) + + return { + "workflow": workflow, + "chatData": chatData + } + + # Otherwise, return paginated list of workflows + # Parse pagination parameter + paginationParams = None + if pagination: + try: + paginationDict = json.loads(pagination) + paginationParams = PaginationParams(**paginationDict) if paginationDict else None + except (json.JSONDecodeError, ValueError) as e: + raise HTTPException( + status_code=400, + detail=f"Invalid pagination parameter: {str(e)}" + ) + + # Get all workflows filtered by mandateId (RBAC handles this automatically) + # We get all workflows first to filter by workflowMode before pagination + all_workflows = interfaceDbChat.getWorkflows(pagination=None) + + # Filter to only include chatbot workflows + chatbot_workflows_data = [ + wf for wf in all_workflows + if wf.get("workflowMode") == WorkflowModeEnum.WORKFLOW_CHATBOT.value + ] + + # Apply pagination if requested + if paginationParams: + # Apply sorting if provided + if paginationParams.sort: + chatbot_workflows_data = interfaceDbChat._applySorting(chatbot_workflows_data, paginationParams.sort) + + # Count total items after filtering + totalItems = len(chatbot_workflows_data) + totalPages = math.ceil(totalItems / paginationParams.pageSize) if totalItems > 0 else 0 + + # Apply pagination (skip/limit) + startIdx = (paginationParams.page - 1) * paginationParams.pageSize + endIdx = startIdx + paginationParams.pageSize + workflows_data = chatbot_workflows_data[startIdx:endIdx] + else: + workflows_data = chatbot_workflows_data + totalItems = len(chatbot_workflows_data) + totalPages = 1 + + # Convert raw dictionaries to ChatWorkflow objects + workflows = [] + for workflow_data in workflows_data: + try: + # Load the workflow properly + workflow = interfaceDbChat.getWorkflow(workflow_data["id"]) + if workflow: + workflows.append(workflow) + except Exception as e: + logger.warning(f"Error loading workflow {workflow_data.get('id')}: {e}") + continue + + # Create paginated response + from modules.datamodels.datamodelPagination import PaginationMetadata + metadata = PaginationMetadata( + currentPage=paginationParams.page if paginationParams else 1, + pageSize=paginationParams.pageSize if paginationParams else len(workflows), + totalItems=totalItems, + totalPages=totalPages, + sort=paginationParams.sort if paginationParams else [], + filters=paginationParams.filters if paginationParams else None + ) + + return PaginatedResponse( + items=workflows, + pagination=metadata + ) + + except HTTPException: + raise + except Exception as e: + logger.error(f"Error getting chatbot threads: {str(e)}", exc_info=True) + raise HTTPException( + status_code=500, + detail=f"Error getting chatbot threads: {str(e)}" + ) + diff --git a/modules/workflows/methods/methodChatbot/__init__.py b/modules/workflows/methods/methodChatbot/__init__.py new file mode 100644 index 00000000..a5940ab0 --- /dev/null +++ b/modules/workflows/methods/methodChatbot/__init__.py @@ -0,0 +1,6 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. + +from .methodChatbot import MethodChatbot + +__all__ = ['MethodChatbot'] diff --git a/modules/workflows/methods/methodChatbot/actions/__init__.py b/modules/workflows/methods/methodChatbot/actions/__init__.py new file mode 100644 index 00000000..e76c67b4 --- /dev/null +++ b/modules/workflows/methods/methodChatbot/actions/__init__.py @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. + diff --git a/modules/workflows/methods/methodChatbot/actions/queryDatabase.py b/modules/workflows/methods/methodChatbot/actions/queryDatabase.py new file mode 100644 index 00000000..ff7e896f --- /dev/null +++ b/modules/workflows/methods/methodChatbot/actions/queryDatabase.py @@ -0,0 +1,146 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. + +""" +Query Database action for Chatbot operations. +Executes SQL queries via the preprocessor connector. +""" + +import logging +import json +import time +from typing import Dict, Any +from modules.workflows.methods.methodBase import action +from modules.datamodels.datamodelChat import ActionResult, ActionDocument +from modules.connectors.connectorPreprocessor import PreprocessorConnector + +logger = logging.getLogger(__name__) + +@action +async def queryDatabase(self, parameters: Dict[str, Any]) -> ActionResult: + """ + Execute a SQL query via the preprocessor connector. + + Parameters: + - sqlQuery (str, required): SQL SELECT query to execute. Can also be extracted from analysis_result document if provided in documentList. + """ + try: + # Init progress logger + workflowId = self.services.workflow.id if self.services.workflow else f"no-workflow-{int(time.time())}" + operationId = f"chatbot_query_db_{workflowId}_{int(time.time())}" + + # Start progress tracking + parentOperationId = parameters.get('parentOperationId') + self.services.chat.progressLogStart( + operationId, + "Database Query", + "Executing SQL Query", + "Preprocessing API", + parentOperationId=parentOperationId + ) + + # Get SQL query from parameters or extract from documentList + sqlQuery = parameters.get("sqlQuery") + + # If sqlQuery not provided, try to extract from documentList (analysis_result) + if not sqlQuery: + documentListParam = parameters.get("documentList") + if documentListParam: + # Get documents from previous task + from modules.datamodels.datamodelDocref import DocumentReferenceList + if isinstance(documentListParam, str): + docList = DocumentReferenceList.from_string_list([documentListParam]) + elif isinstance(documentListParam, list): + docList = DocumentReferenceList.from_string_list(documentListParam) + else: + docList = documentListParam + + # Get documents from workflow + documents = self.services.chat.getChatDocumentsFromDocumentList(docList) + + # Try to extract SQL query from JSON document + for doc in documents: + try: + # ChatDocument objects have fileId - get file data from database + if hasattr(doc, 'fileId') and doc.fileId: + # Get file data from database + fileData = self.services.interfaceDbComponent.getFileData(doc.fileId) + if fileData: + # Decode bytes if needed + if isinstance(fileData, bytes): + docData = fileData.decode('utf-8') + else: + docData = str(fileData) + + # Try to parse as JSON + analysisData = json.loads(docData) + sqlQuery = analysisData.get("sqlQuery") + + if sqlQuery: + logger.info(f"Extracted SQL query from analysis_result document: {sqlQuery[:100]}...") + break + except (json.JSONDecodeError, AttributeError, KeyError, TypeError) as e: + logger.debug(f"Could not parse document as JSON: {e}") + continue + + if not sqlQuery: + return ActionResult.isFailure(error="SQL query is required. Provide sqlQuery parameter or analysis_result document with sqlQuery field.") + + # Update progress + self.services.chat.progressLogUpdate(operationId, 0.3, "Validating query") + + # Initialize connector + connector = PreprocessorConnector() + + # Update progress + self.services.chat.progressLogUpdate(operationId, 0.5, "Executing query") + + # Execute query + result = await connector.executeQuery(sqlQuery) + + # Update progress + self.services.chat.progressLogUpdate(operationId, 0.8, "Formatting results") + + # Generate meaningful filename + meaningful_name = self._generateMeaningfulFileName( + base_name="database_query", + extension="txt", + action_name="queryDatabase" + ) + + # Create validation metadata + validationMetadata = self._createValidationMetadata( + "queryDatabase", + sqlQuery=sqlQuery[:200] if len(sqlQuery) > 200 else sqlQuery, # Truncate for metadata + resultLength=len(result) + ) + + # Create action document + document = ActionDocument( + documentName=meaningful_name, + documentData=result, + mimeType="text/plain", + validationMetadata=validationMetadata + ) + + # Complete progress tracking + self.services.chat.progressLogFinish(operationId, True) + + # Close connector + await connector.close() + + return ActionResult.isSuccess(documents=[document]) + + except Exception as e: + logger.error(f"Error executing database query: {str(e)}") + + # Complete progress tracking with failure + try: + self.services.chat.progressLogFinish(operationId, False) + except: + pass + + return ActionResult.isFailure( + error=str(e) + ) + diff --git a/modules/workflows/methods/methodChatbot/methodChatbot.py b/modules/workflows/methods/methodChatbot/methodChatbot.py new file mode 100644 index 00000000..d1de0fa9 --- /dev/null +++ b/modules/workflows/methods/methodChatbot/methodChatbot.py @@ -0,0 +1,52 @@ +# Copyright (c) 2025 Patrick Motsch +# All rights reserved. + +import logging +from modules.workflows.methods.methodBase import MethodBase +from modules.datamodels.datamodelWorkflowActions import WorkflowActionDefinition, WorkflowActionParameter +from modules.shared.frontendTypes import FrontendType + +# Import actions +from .actions.queryDatabase import queryDatabase + +logger = logging.getLogger(__name__) + +class MethodChatbot(MethodBase): + """Chatbot operations methods.""" + + def __init__(self, services): + super().__init__(services) + self.name = "chatbot" + self.description = "Chatbot operations" + + # RBAC-Integration: Action-Definitionen mit actionId + self._actions = { + "queryDatabase": WorkflowActionDefinition( + actionId="chatbot.queryDatabase", + description="Execute a SQL SELECT query via the preprocessor connector. Returns formatted query results.", + parameters={ + "sqlQuery": WorkflowActionParameter( + name="sqlQuery", + type="str", + frontendType=FrontendType.TEXTAREA, + required=False, + description="SQL SELECT query to execute. If not provided, will attempt to extract from analysis_result document in documentList." + ), + "documentList": WorkflowActionParameter( + name="documentList", + type="List[str]", + frontendType=FrontendType.DOCUMENT_REFERENCE, + required=False, + description="Document reference(s) containing analysis_result with sqlQuery field. Used if sqlQuery parameter is not provided." + ) + }, + execute=queryDatabase.__get__(self, self.__class__) + ) + } + + # Validate actions after definition + self._validateActions() + + # Register actions as methods (optional, für direkten Zugriff) + self.queryDatabase = queryDatabase.__get__(self, self.__class__) + diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..6ced1b3d --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,1530 @@ +{ + "name": "gateway", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT", + "peer": true + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", + "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-markdown": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.1.0.tgz", + "integrity": "sha512-xaijuJB0kzGiUdG7nc2MOMDUDBWPyGAjZtUrow9XxUeua8IqeP+VlIfAZ3bphpcLTnSZXz6z9jcVC/TCwbfgdw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/node_modules/@types/debug/LICENSE b/node_modules/@types/debug/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/debug/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/debug/README.md b/node_modules/@types/debug/README.md new file mode 100644 index 00000000..b67a4dc1 --- /dev/null +++ b/node_modules/@types/debug/README.md @@ -0,0 +1,69 @@ +# Installation +> `npm install --save @types/debug` + +# Summary +This package contains type definitions for debug (https://github.com/debug-js/debug). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug/index.d.ts) +````ts +declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug }; + +export = debug; +export as namespace debug; + +declare namespace debug { + interface Debug { + (namespace: string): Debugger; + coerce: (val: any) => any; + disable: () => string; + enable: (namespaces: string) => void; + enabled: (namespaces: string) => boolean; + formatArgs: (this: Debugger, args: any[]) => void; + log: (...args: any[]) => any; + selectColor: (namespace: string) => string | number; + humanize: typeof import("ms"); + + names: RegExp[]; + skips: RegExp[]; + + formatters: Formatters; + + inspectOpts?: { + hideDate?: boolean | number | null; + colors?: boolean | number | null; + depth?: boolean | number | null; + showHidden?: boolean | number | null; + }; + } + + type IDebug = Debug; + + interface Formatters { + [formatter: string]: (v: any) => string; + } + + type IDebugger = Debugger; + + interface Debugger { + (formatter: any, ...args: any[]): void; + + color: string; + diff: number; + enabled: boolean; + log: (...args: any[]) => any; + namespace: string; + destroy: () => boolean; + extend: (namespace: string, delimiter?: string) => Debugger; + } +} + +```` + +### Additional Details + * Last updated: Thu, 09 Nov 2023 03:06:57 GMT + * Dependencies: [@types/ms](https://npmjs.com/package/@types/ms) + +# Credits +These definitions were written by [Seon-Wook Park](https://github.com/swook), [Gal Talmor](https://github.com/galtalmor), [John McLaughlin](https://github.com/zamb3zi), [Brasten Sager](https://github.com/brasten), [Nicolas Penin](https://github.com/npenin), [Kristian Brünn](https://github.com/kristianmitk), and [Caleb Gregory](https://github.com/calebgregory). diff --git a/node_modules/@types/debug/index.d.ts b/node_modules/@types/debug/index.d.ts new file mode 100644 index 00000000..3778eb8d --- /dev/null +++ b/node_modules/@types/debug/index.d.ts @@ -0,0 +1,50 @@ +declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug }; + +export = debug; +export as namespace debug; + +declare namespace debug { + interface Debug { + (namespace: string): Debugger; + coerce: (val: any) => any; + disable: () => string; + enable: (namespaces: string) => void; + enabled: (namespaces: string) => boolean; + formatArgs: (this: Debugger, args: any[]) => void; + log: (...args: any[]) => any; + selectColor: (namespace: string) => string | number; + humanize: typeof import("ms"); + + names: RegExp[]; + skips: RegExp[]; + + formatters: Formatters; + + inspectOpts?: { + hideDate?: boolean | number | null; + colors?: boolean | number | null; + depth?: boolean | number | null; + showHidden?: boolean | number | null; + }; + } + + type IDebug = Debug; + + interface Formatters { + [formatter: string]: (v: any) => string; + } + + type IDebugger = Debugger; + + interface Debugger { + (formatter: any, ...args: any[]): void; + + color: string; + diff: number; + enabled: boolean; + log: (...args: any[]) => any; + namespace: string; + destroy: () => boolean; + extend: (namespace: string, delimiter?: string) => Debugger; + } +} diff --git a/node_modules/@types/debug/package.json b/node_modules/@types/debug/package.json new file mode 100644 index 00000000..9127e48f --- /dev/null +++ b/node_modules/@types/debug/package.json @@ -0,0 +1,57 @@ +{ + "name": "@types/debug", + "version": "4.1.12", + "description": "TypeScript definitions for debug", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug", + "license": "MIT", + "contributors": [ + { + "name": "Seon-Wook Park", + "githubUsername": "swook", + "url": "https://github.com/swook" + }, + { + "name": "Gal Talmor", + "githubUsername": "galtalmor", + "url": "https://github.com/galtalmor" + }, + { + "name": "John McLaughlin", + "githubUsername": "zamb3zi", + "url": "https://github.com/zamb3zi" + }, + { + "name": "Brasten Sager", + "githubUsername": "brasten", + "url": "https://github.com/brasten" + }, + { + "name": "Nicolas Penin", + "githubUsername": "npenin", + "url": "https://github.com/npenin" + }, + { + "name": "Kristian Brünn", + "githubUsername": "kristianmitk", + "url": "https://github.com/kristianmitk" + }, + { + "name": "Caleb Gregory", + "githubUsername": "calebgregory", + "url": "https://github.com/calebgregory" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/debug" + }, + "scripts": {}, + "dependencies": { + "@types/ms": "*" + }, + "typesPublisherContentHash": "1053110a8e5e302f35fb57f45389304fa5a4f53bb8982b76b8065bcfd7083731", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/estree-jsx/LICENSE b/node_modules/@types/estree-jsx/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/estree-jsx/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/estree-jsx/README.md b/node_modules/@types/estree-jsx/README.md new file mode 100644 index 00000000..e7b16c30 --- /dev/null +++ b/node_modules/@types/estree-jsx/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree-jsx` + +# Summary +This package contains type definitions for estree-jsx (https://github.com/facebook/jsx). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree-jsx. + +### Additional Details + * Last updated: Fri, 23 Feb 2024 02:11:41 GMT + * Dependencies: [@types/estree](https://npmjs.com/package/@types/estree) + +# Credits +These definitions were written by [Tony Ross](https://github.com/antross). diff --git a/node_modules/@types/estree-jsx/index.d.ts b/node_modules/@types/estree-jsx/index.d.ts new file mode 100644 index 00000000..7d450cba --- /dev/null +++ b/node_modules/@types/estree-jsx/index.d.ts @@ -0,0 +1,114 @@ +// Based on https://github.com/facebook/jsx/blob/master/AST.md. +// Extends existing types for ESTree AST from `@types/estree`. + +import { BaseExpression, BaseNode, Expression, Literal } from "estree"; + +export * from "estree"; + +declare module "estree" { + interface ExpressionMap { + JSXElement: JSXElement; + JSXFragment: JSXFragment; + } + + interface NodeMap { + JSXIdentifier: JSXIdentifier; + JSXNamespacedName: JSXNamespacedName; + JSXMemberExpression: JSXMemberExpression; + JSXEmptyExpression: JSXEmptyExpression; + JSXExpressionContainer: JSXExpressionContainer; + JSXSpreadAttribute: JSXSpreadAttribute; + JSXAttribute: JSXAttribute; + JSXOpeningElement: JSXOpeningElement; + JSXOpeningFragment: JSXOpeningFragment; + JSXClosingElement: JSXClosingElement; + JSXClosingFragment: JSXClosingFragment; + JSXElement: JSXElement; + JSXFragment: JSXFragment; + JSXText: JSXText; + } +} + +export interface JSXIdentifier extends BaseNode { + type: "JSXIdentifier"; + name: string; +} + +export interface JSXMemberExpression extends BaseExpression { + type: "JSXMemberExpression"; + object: JSXMemberExpression | JSXIdentifier; + property: JSXIdentifier; +} + +export interface JSXNamespacedName extends BaseExpression { + type: "JSXNamespacedName"; + namespace: JSXIdentifier; + name: JSXIdentifier; +} + +export interface JSXEmptyExpression extends BaseNode { + type: "JSXEmptyExpression"; +} + +export interface JSXExpressionContainer extends BaseNode { + type: "JSXExpressionContainer"; + expression: Expression | JSXEmptyExpression; +} + +export interface JSXSpreadChild extends BaseNode { + type: "JSXSpreadChild"; + expression: Expression; +} + +interface JSXBoundaryElement extends BaseNode { + name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName; +} + +export interface JSXOpeningElement extends JSXBoundaryElement { + type: "JSXOpeningElement"; + attributes: Array; + selfClosing: boolean; +} + +export interface JSXClosingElement extends JSXBoundaryElement { + type: "JSXClosingElement"; +} + +export interface JSXAttribute extends BaseNode { + type: "JSXAttribute"; + name: JSXIdentifier | JSXNamespacedName; + value: Literal | JSXExpressionContainer | JSXElement | JSXFragment | null; +} + +export interface JSXSpreadAttribute extends BaseNode { + type: "JSXSpreadAttribute"; + argument: Expression; +} + +export interface JSXText extends BaseNode { + type: "JSXText"; + value: string; + raw: string; +} + +export interface JSXElement extends BaseExpression { + type: "JSXElement"; + openingElement: JSXOpeningElement; + children: Array; + closingElement: JSXClosingElement | null; +} + +export interface JSXFragment extends BaseExpression { + type: "JSXFragment"; + openingFragment: JSXOpeningFragment; + children: Array; + closingFragment: JSXClosingFragment; +} + +export interface JSXOpeningFragment extends BaseNode { + type: "JSXOpeningFragment"; +} + +export interface JSXClosingFragment extends BaseNode { + type: "JSXClosingFragment"; +} diff --git a/node_modules/@types/estree-jsx/package.json b/node_modules/@types/estree-jsx/package.json new file mode 100644 index 00000000..7a96a614 --- /dev/null +++ b/node_modules/@types/estree-jsx/package.json @@ -0,0 +1,27 @@ +{ + "name": "@types/estree-jsx", + "version": "1.0.5", + "description": "TypeScript definitions for estree-jsx", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree-jsx", + "license": "MIT", + "contributors": [ + { + "name": "Tony Ross", + "githubUsername": "antross", + "url": "https://github.com/antross" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree-jsx" + }, + "scripts": {}, + "dependencies": { + "@types/estree": "*" + }, + "typesPublisherContentHash": "42fda803cc34f935c5a60a45e66b78e18fac56ef350d2d47c00759e16d4fef7f", + "typeScriptVersion": "4.6" +} \ No newline at end of file diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/estree/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md new file mode 100644 index 00000000..3a8c0415 --- /dev/null +++ b/node_modules/@types/estree/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Fri, 06 Jun 2025 00:04:33 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts new file mode 100644 index 00000000..9d001a92 --- /dev/null +++ b/node_modules/@types/estree/flow.d.ts @@ -0,0 +1,167 @@ +declare namespace ESTree { + interface FlowTypeAnnotation extends Node {} + + interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} + + interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} + + interface FlowDeclaration extends Declaration {} + + interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ArrayTypeAnnotation extends FlowTypeAnnotation { + elementType: FlowTypeAnnotation; + } + + interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ClassImplements extends Node { + id: Identifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface ClassProperty { + key: Expression; + value?: Expression | null; + typeAnnotation?: TypeAnnotation | null; + computed: boolean; + static: boolean; + } + + interface DeclareClass extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + body: ObjectTypeAnnotation; + extends: InterfaceExtends[]; + } + + interface DeclareFunction extends FlowDeclaration { + id: Identifier; + } + + interface DeclareModule extends FlowDeclaration { + id: Literal | Identifier; + body: BlockStatement; + } + + interface DeclareVariable extends FlowDeclaration { + id: Identifier; + } + + interface FunctionTypeAnnotation extends FlowTypeAnnotation { + params: FunctionTypeParam[]; + returnType: FlowTypeAnnotation; + rest?: FunctionTypeParam | null; + typeParameters?: TypeParameterDeclaration | null; + } + + interface FunctionTypeParam { + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + optional: boolean; + } + + interface GenericTypeAnnotation extends FlowTypeAnnotation { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceExtends extends Node { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceDeclaration extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + interface IntersectionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface NullableTypeAnnotation extends FlowTypeAnnotation { + typeAnnotation: TypeAnnotation; + } + + interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface TupleTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface TypeofTypeAnnotation extends FlowTypeAnnotation { + argument: FlowTypeAnnotation; + } + + interface TypeAlias extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + right: FlowTypeAnnotation; + } + + interface TypeAnnotation extends Node { + typeAnnotation: FlowTypeAnnotation; + } + + interface TypeCastExpression extends Expression { + expression: Expression; + typeAnnotation: TypeAnnotation; + } + + interface TypeParameterDeclaration extends Node { + params: Identifier[]; + } + + interface TypeParameterInstantiation extends Node { + params: FlowTypeAnnotation[]; + } + + interface ObjectTypeAnnotation extends FlowTypeAnnotation { + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + interface ObjectTypeCallProperty extends Node { + value: FunctionTypeAnnotation; + static: boolean; + } + + interface ObjectTypeIndexer extends Node { + id: Identifier; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + static: boolean; + } + + interface ObjectTypeProperty extends Node { + key: Expression; + value: FlowTypeAnnotation; + optional: boolean; + static: boolean; + } + + interface QualifiedTypeIdentifier extends Node { + qualification: Identifier | QualifiedTypeIdentifier; + id: Identifier; + } + + interface UnionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} +} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts new file mode 100644 index 00000000..2bc66fb6 --- /dev/null +++ b/node_modules/@types/estree/index.d.ts @@ -0,0 +1,694 @@ +// This definition file follows a somewhat unusual format. ESTree allows +// runtime type checks based on the `type` parameter. In order to explain this +// to typescript we want to use discriminated union types: +// https://github.com/Microsoft/TypeScript/pull/9163 +// +// For ESTree this is a bit tricky because the high level interfaces like +// Node or Function are pulling double duty. We want to pass common fields down +// to the interfaces that extend them (like Identifier or +// ArrowFunctionExpression), but you can't extend a type union or enforce +// common fields on them. So we've split the high level interfaces into two +// types, a base type which passes down inherited fields, and a type union of +// all types which extend the base type. Only the type union is exported, and +// the union is how other types refer to the collection of inheriting types. +// +// This makes the definitions file here somewhat more difficult to maintain, +// but it has the notable advantage of making ESTree much easier to use as +// an end user. + +export interface BaseNodeWithoutComments { + // Every leaf interface that extends BaseNode must specify a type property. + // The type property should be a string literal. For example, Identifier + // has: `type: "Identifier"` + type: string; + loc?: SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface BaseNode extends BaseNodeWithoutComments { + leadingComments?: Comment[] | undefined; + trailingComments?: Comment[] | undefined; +} + +export interface NodeMap { + AssignmentProperty: AssignmentProperty; + CatchClause: CatchClause; + Class: Class; + ClassBody: ClassBody; + Expression: Expression; + Function: Function; + Identifier: Identifier; + Literal: Literal; + MethodDefinition: MethodDefinition; + ModuleDeclaration: ModuleDeclaration; + ModuleSpecifier: ModuleSpecifier; + Pattern: Pattern; + PrivateIdentifier: PrivateIdentifier; + Program: Program; + Property: Property; + PropertyDefinition: PropertyDefinition; + SpreadElement: SpreadElement; + Statement: Statement; + Super: Super; + SwitchCase: SwitchCase; + TemplateElement: TemplateElement; + VariableDeclarator: VariableDeclarator; +} + +export type Node = NodeMap[keyof NodeMap]; + +export interface Comment extends BaseNodeWithoutComments { + type: "Line" | "Block"; + value: string; +} + +export interface SourceLocation { + source?: string | null | undefined; + start: Position; + end: Position; +} + +export interface Position { + /** >= 1 */ + line: number; + /** >= 0 */ + column: number; +} + +export interface Program extends BaseNode { + type: "Program"; + sourceType: "script" | "module"; + body: Array; + comments?: Comment[] | undefined; +} + +export interface Directive extends BaseNode { + type: "ExpressionStatement"; + expression: Literal; + directive: string; +} + +export interface BaseFunction extends BaseNode { + params: Pattern[]; + generator?: boolean | undefined; + async?: boolean | undefined; + // The body is either BlockStatement or Expression because arrow functions + // can have a body that's either. FunctionDeclarations and + // FunctionExpressions have only BlockStatement bodies. + body: BlockStatement | Expression; +} + +export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; + +export type Statement = + | ExpressionStatement + | BlockStatement + | StaticBlock + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration; + +export interface BaseStatement extends BaseNode {} + +export interface EmptyStatement extends BaseStatement { + type: "EmptyStatement"; +} + +export interface BlockStatement extends BaseStatement { + type: "BlockStatement"; + body: Statement[]; + innerComments?: Comment[] | undefined; +} + +export interface StaticBlock extends Omit { + type: "StaticBlock"; +} + +export interface ExpressionStatement extends BaseStatement { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface IfStatement extends BaseStatement { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate?: Statement | null | undefined; +} + +export interface LabeledStatement extends BaseStatement { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseStatement { + type: "BreakStatement"; + label?: Identifier | null | undefined; +} + +export interface ContinueStatement extends BaseStatement { + type: "ContinueStatement"; + label?: Identifier | null | undefined; +} + +export interface WithStatement extends BaseStatement { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends BaseStatement { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ReturnStatement extends BaseStatement { + type: "ReturnStatement"; + argument?: Expression | null | undefined; +} + +export interface ThrowStatement extends BaseStatement { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseStatement { + type: "TryStatement"; + block: BlockStatement; + handler?: CatchClause | null | undefined; + finalizer?: BlockStatement | null | undefined; +} + +export interface WhileStatement extends BaseStatement { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseStatement { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseStatement { + type: "ForStatement"; + init?: VariableDeclaration | Expression | null | undefined; + test?: Expression | null | undefined; + update?: Expression | null | undefined; + body: Statement; +} + +export interface BaseForXStatement extends BaseStatement { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForInStatement extends BaseForXStatement { + type: "ForInStatement"; +} + +export interface DebuggerStatement extends BaseStatement { + type: "DebuggerStatement"; +} + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; + +export interface BaseDeclaration extends BaseStatement {} + +export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { + type: "FunctionDeclaration"; + /** It is null when a function declaration is a part of the `export default function` statement */ + id: Identifier | null; + body: BlockStatement; +} + +export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { + id: Identifier; +} + +export interface VariableDeclaration extends BaseDeclaration { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const" | "using" | "await using"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init?: Expression | null | undefined; +} + +export interface ExpressionMap { + ArrayExpression: ArrayExpression; + ArrowFunctionExpression: ArrowFunctionExpression; + AssignmentExpression: AssignmentExpression; + AwaitExpression: AwaitExpression; + BinaryExpression: BinaryExpression; + CallExpression: CallExpression; + ChainExpression: ChainExpression; + ClassExpression: ClassExpression; + ConditionalExpression: ConditionalExpression; + FunctionExpression: FunctionExpression; + Identifier: Identifier; + ImportExpression: ImportExpression; + Literal: Literal; + LogicalExpression: LogicalExpression; + MemberExpression: MemberExpression; + MetaProperty: MetaProperty; + NewExpression: NewExpression; + ObjectExpression: ObjectExpression; + SequenceExpression: SequenceExpression; + TaggedTemplateExpression: TaggedTemplateExpression; + TemplateLiteral: TemplateLiteral; + ThisExpression: ThisExpression; + UnaryExpression: UnaryExpression; + UpdateExpression: UpdateExpression; + YieldExpression: YieldExpression; +} + +export type Expression = ExpressionMap[keyof ExpressionMap]; + +export interface BaseExpression extends BaseNode {} + +export type ChainElement = SimpleCallExpression | MemberExpression; + +export interface ChainExpression extends BaseExpression { + type: "ChainExpression"; + expression: ChainElement; +} + +export interface ThisExpression extends BaseExpression { + type: "ThisExpression"; +} + +export interface ArrayExpression extends BaseExpression { + type: "ArrayExpression"; + elements: Array; +} + +export interface ObjectExpression extends BaseExpression { + type: "ObjectExpression"; + properties: Array; +} + +export interface PrivateIdentifier extends BaseNode { + type: "PrivateIdentifier"; + name: string; +} + +export interface Property extends BaseNode { + type: "Property"; + key: Expression | PrivateIdentifier; + value: Expression | Pattern; // Could be an AssignmentProperty + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export interface PropertyDefinition extends BaseNode { + type: "PropertyDefinition"; + key: Expression | PrivateIdentifier; + value?: Expression | null | undefined; + computed: boolean; + static: boolean; +} + +export interface FunctionExpression extends BaseFunction, BaseExpression { + id?: Identifier | null | undefined; + type: "FunctionExpression"; + body: BlockStatement; +} + +export interface SequenceExpression extends BaseExpression { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface UnaryExpression extends BaseExpression { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: true; + argument: Expression; +} + +export interface BinaryExpression extends BaseExpression { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression | PrivateIdentifier; + right: Expression; +} + +export interface AssignmentExpression extends BaseExpression { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface UpdateExpression extends BaseExpression { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface LogicalExpression extends BaseExpression { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface ConditionalExpression extends BaseExpression { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface BaseCallExpression extends BaseExpression { + callee: Expression | Super; + arguments: Array; +} +export type CallExpression = SimpleCallExpression | NewExpression; + +export interface SimpleCallExpression extends BaseCallExpression { + type: "CallExpression"; + optional: boolean; +} + +export interface NewExpression extends BaseCallExpression { + type: "NewExpression"; +} + +export interface MemberExpression extends BaseExpression, BasePattern { + type: "MemberExpression"; + object: Expression | Super; + property: Expression | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; + +export interface BasePattern extends BaseNode {} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test?: Expression | null | undefined; + consequent: Statement[]; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface Identifier extends BaseNode, BaseExpression, BasePattern { + type: "Identifier"; + name: string; +} + +export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; + +export interface SimpleLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value: string | boolean | number | null; + raw?: string | undefined; +} + +export interface RegExpLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: RegExp | null | undefined; + regex: { + pattern: string; + flags: string; + }; + raw?: string | undefined; +} + +export interface BigIntLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: bigint | null | undefined; + bigint: string; + raw?: string | undefined; +} + +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export interface ForOfStatement extends BaseForXStatement { + type: "ForOfStatement"; + await: boolean; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { + type: "ArrowFunctionExpression"; + expression: boolean; + body: BlockStatement | Expression; +} + +export interface YieldExpression extends BaseExpression { + type: "YieldExpression"; + argument?: Expression | null | undefined; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseExpression { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseExpression { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ + cooked?: string | null | undefined; + raw: string; + }; +} + +export interface AssignmentProperty extends Property { + value: Pattern; + kind: "init"; + method: boolean; // false +} + +export interface ObjectPattern extends BasePattern { + type: "ObjectPattern"; + properties: Array; +} + +export interface ArrayPattern extends BasePattern { + type: "ArrayPattern"; + elements: Array; +} + +export interface RestElement extends BasePattern { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BasePattern { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +export type Class = ClassDeclaration | ClassExpression; +export interface BaseClass extends BaseNode { + superClass?: Expression | null | undefined; + body: ClassBody; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression | PrivateIdentifier; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { + type: "ClassDeclaration"; + /** It is null when a class declaration is a part of the `export default class` statement */ + id: Identifier | null; +} + +export interface ClassDeclaration extends MaybeNamedClassDeclaration { + id: Identifier; +} + +export interface ClassExpression extends BaseClass, BaseExpression { + type: "ClassExpression"; + id?: Identifier | null | undefined; +} + +export interface MetaProperty extends BaseExpression { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration; +export interface BaseModuleDeclaration extends BaseNode {} + +export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; +export interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +export interface ImportDeclaration extends BaseModuleDeclaration { + type: "ImportDeclaration"; + specifiers: Array; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier | Literal; +} + +export interface ImportAttribute extends BaseNode { + type: "ImportAttribute"; + key: Identifier | Literal; + value: Literal; +} + +export interface ImportExpression extends BaseExpression { + type: "ImportExpression"; + source: Expression; + options?: Expression | null | undefined; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseModuleDeclaration { + type: "ExportNamedDeclaration"; + declaration?: Declaration | null | undefined; + specifiers: ExportSpecifier[]; + attributes: ImportAttribute[]; + source?: Literal | null | undefined; +} + +export interface ExportSpecifier extends Omit { + type: "ExportSpecifier"; + local: Identifier | Literal; + exported: Identifier | Literal; +} + +export interface ExportDefaultDeclaration extends BaseModuleDeclaration { + type: "ExportDefaultDeclaration"; + declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; +} + +export interface ExportAllDeclaration extends BaseModuleDeclaration { + type: "ExportAllDeclaration"; + exported: Identifier | Literal | null; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface AwaitExpression extends BaseExpression { + type: "AwaitExpression"; + argument: Expression; +} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json new file mode 100644 index 00000000..68c0782c --- /dev/null +++ b/node_modules/@types/estree/package.json @@ -0,0 +1,27 @@ +{ + "name": "@types/estree", + "version": "1.0.8", + "description": "TypeScript definitions for estree", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", + "license": "MIT", + "contributors": [ + { + "name": "RReverser", + "githubUsername": "RReverser", + "url": "https://github.com/RReverser" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "7a167b6e4a4d9f6e9a2cb9fd3fc45c885f89cbdeb44b3e5961bb057a45c082fd", + "typeScriptVersion": "5.1", + "nonNpm": true +} \ No newline at end of file diff --git a/node_modules/@types/hast/LICENSE b/node_modules/@types/hast/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/hast/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/hast/README.md b/node_modules/@types/hast/README.md new file mode 100644 index 00000000..b548c80e --- /dev/null +++ b/node_modules/@types/hast/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/hast` + +# Summary +This package contains type definitions for hast (https://github.com/syntax-tree/hast). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast. + +### Additional Details + * Last updated: Tue, 30 Jan 2024 21:35:45 GMT + * Dependencies: [@types/unist](https://npmjs.com/package/@types/unist) + +# Credits +These definitions were written by [lukeggchapman](https://github.com/lukeggchapman), [Junyoung Choi](https://github.com/rokt33r), [Christian Murphy](https://github.com/ChristianMurphy), and [Remco Haszing](https://github.com/remcohaszing). diff --git a/node_modules/@types/hast/index.d.ts b/node_modules/@types/hast/index.d.ts new file mode 100644 index 00000000..122b5b4d --- /dev/null +++ b/node_modules/@types/hast/index.d.ts @@ -0,0 +1,282 @@ +import type { Data as UnistData, Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from "unist"; + +// ## Interfaces + +/** + * Info associated with hast nodes by the ecosystem. + * + * This space is guaranteed to never be specified by unist or hast. + * But you can use it in utilities and plugins to store data. + * + * This type can be augmented to register custom data. + * For example: + * + * ```ts + * declare module 'hast' { + * interface Data { + * // `someNode.data.myId` is typed as `number | undefined` + * myId?: number | undefined + * } + * } + * ``` + */ +export interface Data extends UnistData {} + +/** + * Info associated with an element. + */ +export interface Properties { + [PropertyName: string]: boolean | number | string | null | undefined | Array; +} + +// ## Content maps + +/** + * Union of registered hast nodes that can occur in {@link Element}. + * + * To register mote custom hast nodes, add them to {@link ElementContentMap}. + * They will be automatically added here. + */ +export type ElementContent = ElementContentMap[keyof ElementContentMap]; + +/** + * Registry of all hast nodes that can occur as children of {@link Element}. + * + * For a union of all {@link Element} children, see {@link ElementContent}. + */ +export interface ElementContentMap { + comment: Comment; + element: Element; + text: Text; +} + +/** + * Union of registered hast nodes that can occur in {@link Root}. + * + * To register custom hast nodes, add them to {@link RootContentMap}. + * They will be automatically added here. + */ +export type RootContent = RootContentMap[keyof RootContentMap]; + +/** + * Registry of all hast nodes that can occur as children of {@link Root}. + * + * > 👉 **Note**: {@link Root} does not need to be an entire document. + * > it can also be a fragment. + * + * For a union of all {@link Root} children, see {@link RootContent}. + */ +export interface RootContentMap { + comment: Comment; + doctype: Doctype; + element: Element; + text: Text; +} + +// ### Special content types + +/** + * Union of registered hast nodes that can occur in {@link Root}. + * + * @deprecated Use {@link RootContent} instead. + */ +export type Content = RootContent; + +/** + * Union of registered hast literals. + * + * To register custom hast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Literals = Extract; + +/** + * Union of registered hast nodes. + * + * To register custom hast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Nodes = Root | RootContent; + +/** + * Union of registered hast parents. + * + * To register custom hast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Parents = Extract; + +// ## Abstract nodes + +/** + * Abstract hast node. + * + * This interface is supposed to be extended. + * If you can use {@link Literal} or {@link Parent}, you should. + * But for example in HTML, a `Doctype` is neither literal nor parent, but + * still a node. + * + * To register custom hast nodes, add them to {@link RootContentMap} and other + * places where relevant (such as {@link ElementContentMap}). + * + * For a union of all registered hast nodes, see {@link Nodes}. + */ +export interface Node extends UnistNode { + /** + * Info from the ecosystem. + */ + data?: Data | undefined; +} + +/** + * Abstract hast node that contains the smallest possible value. + * + * This interface is supposed to be extended if you make custom hast nodes. + * + * For a union of all registered hast literals, see {@link Literals}. + */ +export interface Literal extends Node { + /** + * Plain-text value. + */ + value: string; +} + +/** + * Abstract hast node that contains other hast nodes (*children*). + * + * This interface is supposed to be extended if you make custom hast nodes. + * + * For a union of all registered hast parents, see {@link Parents}. + */ +export interface Parent extends Node { + /** + * List of children. + */ + children: RootContent[]; +} + +// ## Concrete nodes + +/** + * HTML comment. + */ +export interface Comment extends Literal { + /** + * Node type of HTML comments in hast. + */ + type: "comment"; + /** + * Data associated with the comment. + */ + data?: CommentData | undefined; +} + +/** + * Info associated with hast comments by the ecosystem. + */ +export interface CommentData extends Data {} + +/** + * HTML document type. + */ +export interface Doctype extends UnistNode { + /** + * Node type of HTML document types in hast. + */ + type: "doctype"; + /** + * Data associated with the doctype. + */ + data?: DoctypeData | undefined; +} + +/** + * Info associated with hast doctypes by the ecosystem. + */ +export interface DoctypeData extends Data {} + +/** + * HTML element. + */ +export interface Element extends Parent { + /** + * Node type of elements. + */ + type: "element"; + /** + * Tag name (such as `'body'`) of the element. + */ + tagName: string; + /** + * Info associated with the element. + */ + properties: Properties; + /** + * Children of element. + */ + children: ElementContent[]; + /** + * When the `tagName` field is `'template'`, a `content` field can be + * present. + */ + content?: Root | undefined; + /** + * Data associated with the element. + */ + data?: ElementData | undefined; +} + +/** + * Info associated with hast elements by the ecosystem. + */ +export interface ElementData extends Data {} + +/** + * Document fragment or a whole document. + * + * Should be used as the root of a tree and must not be used as a child. + * + * Can also be used as the value for the content field on a `'template'` element. + */ +export interface Root extends Parent { + /** + * Node type of hast root. + */ + type: "root"; + /** + * Children of root. + */ + children: RootContent[]; + /** + * Data associated with the hast root. + */ + data?: RootData | undefined; +} + +/** + * Info associated with hast root nodes by the ecosystem. + */ +export interface RootData extends Data {} + +/** + * HTML character data (plain text). + */ +export interface Text extends Literal { + /** + * Node type of HTML character data (plain text) in hast. + */ + type: "text"; + /** + * Data associated with the text. + */ + data?: TextData | undefined; +} + +/** + * Info associated with hast texts by the ecosystem. + */ +export interface TextData extends Data {} diff --git a/node_modules/@types/hast/package.json b/node_modules/@types/hast/package.json new file mode 100644 index 00000000..464e3f7b --- /dev/null +++ b/node_modules/@types/hast/package.json @@ -0,0 +1,42 @@ +{ + "name": "@types/hast", + "version": "3.0.4", + "description": "TypeScript definitions for hast", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast", + "license": "MIT", + "contributors": [ + { + "name": "lukeggchapman", + "githubUsername": "lukeggchapman", + "url": "https://github.com/lukeggchapman" + }, + { + "name": "Junyoung Choi", + "githubUsername": "rokt33r", + "url": "https://github.com/rokt33r" + }, + { + "name": "Christian Murphy", + "githubUsername": "ChristianMurphy", + "url": "https://github.com/ChristianMurphy" + }, + { + "name": "Remco Haszing", + "githubUsername": "remcohaszing", + "url": "https://github.com/remcohaszing" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/hast" + }, + "scripts": {}, + "dependencies": { + "@types/unist": "*" + }, + "typesPublisherContentHash": "3f3f73826d79157c12087f5bb36195319c6f435b9e218fa7a8de88d1cc64d097", + "typeScriptVersion": "4.6" +} \ No newline at end of file diff --git a/node_modules/@types/mdast/LICENSE b/node_modules/@types/mdast/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/mdast/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/mdast/README.md b/node_modules/@types/mdast/README.md new file mode 100644 index 00000000..0652767d --- /dev/null +++ b/node_modules/@types/mdast/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/mdast` + +# Summary +This package contains type definitions for mdast (https://github.com/syntax-tree/mdast). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast. + +### Additional Details + * Last updated: Tue, 14 May 2024 07:35:36 GMT + * Dependencies: [@types/unist](https://npmjs.com/package/@types/unist) + +# Credits +These definitions were written by [Christian Murphy](https://github.com/ChristianMurphy), [Jun Lu](https://github.com/lujun2), [Remco Haszing](https://github.com/remcohaszing), [Titus Wormer](https://github.com/wooorm), and [Remco Haszing](https://github.com/remcohaszing). diff --git a/node_modules/@types/mdast/index.d.ts b/node_modules/@types/mdast/index.d.ts new file mode 100644 index 00000000..239875d1 --- /dev/null +++ b/node_modules/@types/mdast/index.d.ts @@ -0,0 +1,1123 @@ +import type { Data as UnistData, Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from "unist"; + +// ## Enumeration + +/** + * How phrasing content is aligned + * ({@link https://drafts.csswg.org/css-text/ | [CSSTEXT]}). + * + * * `'left'`: See the + * {@link https://drafts.csswg.org/css-text/#valdef-text-align-left | left} + * value of the `text-align` CSS property + * * `'right'`: See the + * {@link https://drafts.csswg.org/css-text/#valdef-text-align-right | right} + * value of the `text-align` CSS property + * * `'center'`: See the + * {@link https://drafts.csswg.org/css-text/#valdef-text-align-center | center} + * value of the `text-align` CSS property + * * `null`: phrasing content is aligned as defined by the host environment + * + * Used in GFM tables. + */ +export type AlignType = "center" | "left" | "right" | null; + +/** + * Explicitness of a reference. + * + * `'shortcut'`: the reference is implicit, its identifier inferred from its + * content + * `'collapsed'`: the reference is explicit, its identifier inferred from its + * content + * `'full'`: the reference is explicit, its identifier explicitly set + */ +export type ReferenceType = "shortcut" | "collapsed" | "full"; + +// ## Mixin + +/** + * Node with a fallback. + */ +export interface Alternative { + /** + * Equivalent content for environments that cannot represent the node as + * intended. + */ + alt?: string | null | undefined; +} + +/** + * Internal relation from one node to another. + * + * Whether the value of `identifier` is expected to be a unique identifier or + * not depends on the type of node including the Association. + * An example of this is that they should be unique on {@link Definition}, + * whereas multiple {@link LinkReference}s can be non-unique to be associated + * with one definition. + */ +export interface Association { + /** + * Relation of association. + * + * `identifier` is a source value: character escapes and character + * references are not parsed. + * + * It can match another node. + * + * Its value must be normalized. + * To normalize a value, collapse markdown whitespace (`[\t\n\r ]+`) to a space, + * trim the optional initial and/or final space, and perform Unicode-aware + * case-folding. + */ + identifier: string; + + /** + * Relation of association, in parsed form. + * + * `label` is a `string` value: it works just like `title` on {@link Link} + * or a `lang` on {@link Code}: character escapes and character references + * are parsed. + * + * It can match another node. + */ + label?: string | null | undefined; +} + +/** + * Marker that is associated to another node. + */ +export interface Reference extends Association { + /** + * Explicitness of the reference. + */ + referenceType: ReferenceType; +} + +/** + * Reference to resource. + */ +export interface Resource { + /** + * URL to the referenced resource. + */ + url: string; + /** + * Advisory information for the resource, such as would be appropriate for + * a tooltip. + */ + title?: string | null | undefined; +} + +// ## Interfaces + +/** + * Info associated with mdast nodes by the ecosystem. + * + * This space is guaranteed to never be specified by unist or mdast. + * But you can use it in utilities and plugins to store data. + * + * This type can be augmented to register custom data. + * For example: + * + * ```ts + * declare module 'mdast' { + * interface Data { + * // `someNode.data.myId` is typed as `number | undefined` + * myId?: number | undefined + * } + * } + * ``` + */ +export interface Data extends UnistData {} + +// ## Content maps + +/** + * Union of registered mdast nodes that can occur where block content is + * expected. + * + * To register custom mdast nodes, add them to {@link BlockContentMap}. + * They will be automatically added here. + */ +export type BlockContent = BlockContentMap[keyof BlockContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link BlockContent} is + * expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface BlockContentMap { + * // Allow using MDX ESM nodes defined by `remark-mdx`. + * mdxjsEsm: MdxjsEsm; + * } + * } + * ``` + * + * For a union of all block content, see {@link RootContent}. + */ +export interface BlockContentMap { + blockquote: Blockquote; + code: Code; + heading: Heading; + html: Html; + list: List; + paragraph: Paragraph; + table: Table; + thematicBreak: ThematicBreak; +} + +/** + * Union of registered mdast nodes that can occur where definition content is + * expected. + * + * To register custom mdast nodes, add them to {@link DefinitionContentMap}. + * They will be automatically added here. + */ +export type DefinitionContent = DefinitionContentMap[keyof DefinitionContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link DefinitionContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface DefinitionContentMap { + * custom: Custom; + * } + * } + * ``` + * + * For a union of all definition content, see {@link RootContent}. + */ +export interface DefinitionContentMap { + definition: Definition; + footnoteDefinition: FootnoteDefinition; +} + +/** + * Union of registered mdast nodes that can occur where frontmatter content is + * expected. + * + * To register custom mdast nodes, add them to {@link FrontmatterContentMap}. + * They will be automatically added here. + */ +export type FrontmatterContent = FrontmatterContentMap[keyof FrontmatterContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link FrontmatterContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface FrontmatterContentMap { + * // Allow using toml nodes defined by `remark-frontmatter`. + * toml: TOML; + * } + * } + * ``` + * + * For a union of all frontmatter content, see {@link RootContent}. + */ +export interface FrontmatterContentMap { + yaml: Yaml; +} + +/** + * Union of registered mdast nodes that can occur where list content is + * expected. + * + * To register custom mdast nodes, add them to {@link ListContentMap}. + * They will be automatically added here. + */ +export type ListContent = ListContentMap[keyof ListContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link ListContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface ListContentMap { + * custom: Custom; + * } + * } + * ``` + * + * For a union of all list content, see {@link RootContent}. + */ +export interface ListContentMap { + listItem: ListItem; +} + +/** + * Union of registered mdast nodes that can occur where phrasing content is + * expected. + * + * To register custom mdast nodes, add them to {@link PhrasingContentMap}. + * They will be automatically added here. + */ +export type PhrasingContent = PhrasingContentMap[keyof PhrasingContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link PhrasingContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface PhrasingContentMap { + * // Allow using MDX JSX (text) nodes defined by `remark-mdx`. + * mdxJsxTextElement: MDXJSXTextElement; + * } + * } + * ``` + * + * For a union of all phrasing content, see {@link RootContent}. + */ +export interface PhrasingContentMap { + break: Break; + delete: Delete; + emphasis: Emphasis; + footnoteReference: FootnoteReference; + html: Html; + image: Image; + imageReference: ImageReference; + inlineCode: InlineCode; + link: Link; + linkReference: LinkReference; + strong: Strong; + text: Text; +} + +/** + * Union of registered mdast nodes that can occur in {@link Root}. + * + * To register custom mdast nodes, add them to {@link RootContentMap}. + * They will be automatically added here. + */ +export type RootContent = RootContentMap[keyof RootContentMap]; + +/** + * Registry of all mdast nodes that can occur as children of {@link Root}. + * + * > **Note**: {@link Root} does not need to be an entire document. + * > it can also be a fragment. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface RootContentMap { + * // Allow using toml nodes defined by `remark-frontmatter`. + * toml: TOML; + * } + * } + * ``` + * + * For a union of all {@link Root} children, see {@link RootContent}. + */ +export interface RootContentMap { + blockquote: Blockquote; + break: Break; + code: Code; + definition: Definition; + delete: Delete; + emphasis: Emphasis; + footnoteDefinition: FootnoteDefinition; + footnoteReference: FootnoteReference; + heading: Heading; + html: Html; + image: Image; + imageReference: ImageReference; + inlineCode: InlineCode; + link: Link; + linkReference: LinkReference; + list: List; + listItem: ListItem; + paragraph: Paragraph; + strong: Strong; + table: Table; + tableCell: TableCell; + tableRow: TableRow; + text: Text; + thematicBreak: ThematicBreak; + yaml: Yaml; +} + +/** + * Union of registered mdast nodes that can occur where row content is + * expected. + * + * To register custom mdast nodes, add them to {@link RowContentMap}. + * They will be automatically added here. + */ +export type RowContent = RowContentMap[keyof RowContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link RowContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface RowContentMap { + * custom: Custom; + * } + * } + * ``` + * + * For a union of all row content, see {@link RootContent}. + */ +export interface RowContentMap { + tableCell: TableCell; +} + +/** + * Union of registered mdast nodes that can occur where table content is + * expected. + * + * To register custom mdast nodes, add them to {@link TableContentMap}. + * They will be automatically added here. + */ +export type TableContent = TableContentMap[keyof TableContentMap]; + +/** + * Registry of all mdast nodes that can occur where {@link TableContent} + * is expected. + * + * This interface can be augmented to register custom node types: + * + * ```ts + * declare module 'mdast' { + * interface TableContentMap { + * custom: Custom; + * } + * } + * ``` + * + * For a union of all table content, see {@link RootContent}. + */ +export interface TableContentMap { + tableRow: TableRow; +} + +// ### Special content types + +/** + * Union of registered mdast nodes that can occur in {@link Root}. + * + * @deprecated Use {@link RootContent} instead. + */ +export type Content = RootContent; + +/** + * Union of registered mdast literals. + * + * To register custom mdast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Literals = Extract; + +/** + * Union of registered mdast nodes. + * + * To register custom mdast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Nodes = Root | RootContent; + +/** + * Union of registered mdast parents. + * + * To register custom mdast nodes, add them to {@link RootContentMap} and other + * places where relevant. + * They will be automatically added here. + */ +export type Parents = Extract; + +/** + * Union of registered mdast nodes that can occur at the top of the document. + * + * To register custom mdast nodes, add them to {@link BlockContent}, + * {@link FrontmatterContent}, or {@link DefinitionContent}. + * They will be automatically added here. + */ +export type TopLevelContent = BlockContent | FrontmatterContent | DefinitionContent; + +// ## Abstract nodes + +/** + * Abstract mdast node that contains the smallest possible value. + * + * This interface is supposed to be extended if you make custom mdast nodes. + * + * For a union of all registered mdast literals, see {@link Literals}. + */ +export interface Literal extends Node { + /** + * Plain-text value. + */ + value: string; +} + +/** + * Abstract mdast node. + * + * This interface is supposed to be extended. + * If you can use {@link Literal} or {@link Parent}, you should. + * But for example in markdown, a thematic break (`***`) is neither literal nor + * parent, but still a node. + * + * To register custom mdast nodes, add them to {@link RootContentMap} and other + * places where relevant (such as {@link ElementContentMap}). + * + * For a union of all registered mdast nodes, see {@link Nodes}. + */ +export interface Node extends UnistNode { + /** + * Info from the ecosystem. + */ + data?: Data | undefined; +} + +/** + * Abstract mdast node that contains other mdast nodes (*children*). + * + * This interface is supposed to be extended if you make custom mdast nodes. + * + * For a union of all registered mdast parents, see {@link Parents}. + */ +export interface Parent extends Node { + /** + * List of children. + */ + children: RootContent[]; +} + +// ## Concrete nodes + +/** + * Markdown block quote. + */ +export interface Blockquote extends Parent { + /** + * Node type of mdast block quote. + */ + type: "blockquote"; + /** + * Children of block quote. + */ + children: Array; + /** + * Data associated with the mdast block quote. + */ + data?: BlockquoteData | undefined; +} + +/** + * Info associated with mdast block quote nodes by the ecosystem. + */ +export interface BlockquoteData extends Data {} + +/** + * Markdown break. + */ +export interface Break extends Node { + /** + * Node type of mdast break. + */ + type: "break"; + /** + * Data associated with the mdast break. + */ + data?: BreakData | undefined; +} + +/** + * Info associated with mdast break nodes by the ecosystem. + */ +export interface BreakData extends Data {} + +/** + * Markdown code (flow) (block). + */ +export interface Code extends Literal { + /** + * Node type of mdast code (flow). + */ + type: "code"; + /** + * Language of computer code being marked up. + */ + lang?: string | null | undefined; + /** + * Custom information relating to the node. + * + * If the lang field is present, a meta field can be present. + */ + meta?: string | null | undefined; + /** + * Data associated with the mdast code (flow). + */ + data?: CodeData | undefined; +} + +/** + * Info associated with mdast code (flow) (block) nodes by the ecosystem. + */ +export interface CodeData extends Data {} + +/** + * Markdown definition. + */ +export interface Definition extends Node, Association, Resource { + /** + * Node type of mdast definition. + */ + type: "definition"; + /** + * Data associated with the mdast definition. + */ + data?: DefinitionData | undefined; +} + +/** + * Info associated with mdast definition nodes by the ecosystem. + */ +export interface DefinitionData extends Data {} + +/** + * Markdown GFM delete (strikethrough). + */ +export interface Delete extends Parent { + /** + * Node type of mdast GFM delete. + */ + type: "delete"; + /** + * Children of GFM delete. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast GFM delete. + */ + data?: DeleteData | undefined; +} + +/** + * Info associated with mdast GFM delete nodes by the ecosystem. + */ +export interface DeleteData extends Data {} + +/** + * Markdown emphasis. + */ +export interface Emphasis extends Parent { + /** + * Node type of mdast emphasis. + */ + type: "emphasis"; + /** + * Children of emphasis. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast emphasis. + */ + data?: EmphasisData | undefined; +} + +/** + * Info associated with mdast emphasis nodes by the ecosystem. + */ +export interface EmphasisData extends Data {} + +/** + * Markdown GFM footnote definition. + */ +export interface FootnoteDefinition extends Parent, Association { + /** + * Node type of mdast GFM footnote definition. + */ + type: "footnoteDefinition"; + /** + * Children of GFM footnote definition. + */ + children: Array; + /** + * Data associated with the mdast GFM footnote definition. + */ + data?: FootnoteDefinitionData | undefined; +} + +/** + * Info associated with mdast GFM footnote definition nodes by the ecosystem. + */ +export interface FootnoteDefinitionData extends Data {} + +/** + * Markdown GFM footnote reference. + */ +export interface FootnoteReference extends Association, Node { + /** + * Node type of mdast GFM footnote reference. + */ + type: "footnoteReference"; + /** + * Data associated with the mdast GFM footnote reference. + */ + data?: FootnoteReferenceData | undefined; +} + +/** + * Info associated with mdast GFM footnote reference nodes by the ecosystem. + */ +export interface FootnoteReferenceData extends Data {} + +/** + * Markdown heading. + */ +export interface Heading extends Parent { + /** + * Node type of mdast heading. + */ + type: "heading"; + /** + * Heading rank. + * + * A value of `1` is said to be the highest rank and `6` the lowest. + */ + depth: 1 | 2 | 3 | 4 | 5 | 6; + /** + * Children of heading. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast heading. + */ + data?: HeadingData | undefined; +} + +/** + * Info associated with mdast heading nodes by the ecosystem. + */ +export interface HeadingData extends Data {} + +/** + * Markdown HTML. + */ +export interface Html extends Literal { + /** + * Node type of mdast HTML. + */ + type: "html"; + /** + * Data associated with the mdast HTML. + */ + data?: HtmlData | undefined; +} + +/** + * Info associated with mdast HTML nodes by the ecosystem. + */ +export interface HtmlData extends Data {} + +/** + * Old name of `Html` node. + * + * @deprecated + * Please use `Html` instead. + */ +export type HTML = Html; + +/** + * Markdown image. + */ +export interface Image extends Alternative, Node, Resource { + /** + * Node type of mdast image. + */ + type: "image"; + /** + * Data associated with the mdast image. + */ + data?: ImageData | undefined; +} + +/** + * Info associated with mdast image nodes by the ecosystem. + */ +export interface ImageData extends Data {} + +/** + * Markdown image reference. + */ +export interface ImageReference extends Alternative, Node, Reference { + /** + * Node type of mdast image reference. + */ + type: "imageReference"; + /** + * Data associated with the mdast image reference. + */ + data?: ImageReferenceData | undefined; +} + +/** + * Info associated with mdast image reference nodes by the ecosystem. + */ +export interface ImageReferenceData extends Data {} + +/** + * Markdown code (text) (inline). + */ +export interface InlineCode extends Literal { + /** + * Node type of mdast code (text). + */ + type: "inlineCode"; + /** + * Data associated with the mdast code (text). + */ + data?: InlineCodeData | undefined; +} + +/** + * Info associated with mdast code (text) (inline) nodes by the ecosystem. + */ +export interface InlineCodeData extends Data {} + +/** + * Markdown link. + */ +export interface Link extends Parent, Resource { + /** + * Node type of mdast link. + */ + type: "link"; + /** + * Children of link. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast link. + */ + data?: LinkData | undefined; +} + +/** + * Info associated with mdast link nodes by the ecosystem. + */ +export interface LinkData extends Data {} + +/** + * Markdown link reference. + */ +export interface LinkReference extends Parent, Reference { + /** + * Node type of mdast link reference. + */ + type: "linkReference"; + /** + * Children of link reference. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast link reference. + */ + data?: LinkReferenceData | undefined; +} + +/** + * Info associated with mdast link reference nodes by the ecosystem. + */ +export interface LinkReferenceData extends Data {} + +/** + * Markdown list. + */ +export interface List extends Parent { + /** + * Node type of mdast list. + */ + type: "list"; + /** + * Whether the items have been intentionally ordered (when `true`), or that + * the order of items is not important (when `false` or not present). + */ + ordered?: boolean | null | undefined; + /** + * The starting number of the list, when the `ordered` field is `true`. + */ + start?: number | null | undefined; + /** + * Whether one or more of the children are separated with a blank line from + * its siblings (when `true`), or not (when `false` or not present). + */ + spread?: boolean | null | undefined; + /** + * Children of list. + */ + children: ListContent[]; + /** + * Data associated with the mdast list. + */ + data?: ListData | undefined; +} + +/** + * Info associated with mdast list nodes by the ecosystem. + */ +export interface ListData extends Data {} + +/** + * Markdown list item. + */ +export interface ListItem extends Parent { + /** + * Node type of mdast list item. + */ + type: "listItem"; + /** + * Whether the item is a tasklist item (when `boolean`). + * + * When `true`, the item is complete. + * When `false`, the item is incomplete. + */ + checked?: boolean | null | undefined; + /** + * Whether one or more of the children are separated with a blank line from + * its siblings (when `true`), or not (when `false` or not present). + */ + spread?: boolean | null | undefined; + /** + * Children of list item. + */ + children: Array; + /** + * Data associated with the mdast list item. + */ + data?: ListItemData | undefined; +} + +/** + * Info associated with mdast list item nodes by the ecosystem. + */ +export interface ListItemData extends Data {} + +/** + * Markdown paragraph. + */ +export interface Paragraph extends Parent { + /** + * Node type of mdast paragraph. + */ + type: "paragraph"; + /** + * Children of paragraph. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast paragraph. + */ + data?: ParagraphData | undefined; +} + +/** + * Info associated with mdast paragraph nodes by the ecosystem. + */ +export interface ParagraphData extends Data {} + +/** + * Document fragment or a whole document. + * + * Should be used as the root of a tree and must not be used as a child. + */ +export interface Root extends Parent { + /** + * Node type of mdast root. + */ + type: "root"; + /** + * Data associated with the mdast root. + */ + data?: RootData | undefined; +} + +/** + * Info associated with mdast root nodes by the ecosystem. + */ +export interface RootData extends Data {} + +/** + * Markdown strong. + */ +export interface Strong extends Parent { + /** + * Node type of mdast strong. + */ + type: "strong"; + /** + * Children of strong. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast strong. + */ + data?: StrongData | undefined; +} + +/** + * Info associated with mdast strong nodes by the ecosystem. + */ +export interface StrongData extends Data {} + +/** + * Markdown GFM table. + */ +export interface Table extends Parent { + /** + * Node type of mdast GFM table. + */ + type: "table"; + /** + * How cells in columns are aligned. + */ + align?: AlignType[] | null | undefined; + /** + * Children of GFM table. + */ + children: TableContent[]; + /** + * Data associated with the mdast GFM table. + */ + data?: TableData | undefined; +} + +/** + * Info associated with mdast GFM table nodes by the ecosystem. + */ +export interface TableData extends Data {} + +/** + * Markdown GFM table row. + */ +export interface TableRow extends Parent { + /** + * Node type of mdast GFM table row. + */ + type: "tableRow"; + /** + * Children of GFM table row. + */ + children: RowContent[]; + /** + * Data associated with the mdast GFM table row. + */ + data?: TableRowData | undefined; +} + +/** + * Info associated with mdast GFM table row nodes by the ecosystem. + */ +export interface TableRowData extends Data {} + +/** + * Markdown GFM table cell. + */ +export interface TableCell extends Parent { + /** + * Node type of mdast GFM table cell. + */ + type: "tableCell"; + /** + * Children of GFM table cell. + */ + children: PhrasingContent[]; + /** + * Data associated with the mdast GFM table cell. + */ + data?: TableCellData | undefined; +} + +/** + * Info associated with mdast GFM table cell nodes by the ecosystem. + */ +export interface TableCellData extends Data {} + +/** + * Markdown text. + */ +export interface Text extends Literal { + /** + * Node type of mdast text. + */ + type: "text"; + /** + * Data associated with the mdast text. + */ + data?: TextData | undefined; +} + +/** + * Info associated with mdast text nodes by the ecosystem. + */ +export interface TextData extends Data {} + +/** + * Markdown thematic break (horizontal rule). + */ +export interface ThematicBreak extends Node { + /** + * Node type of mdast thematic break. + */ + type: "thematicBreak"; + /** + * Data associated with the mdast thematic break. + */ + data?: ThematicBreakData | undefined; +} + +/** + * Info associated with mdast thematic break nodes by the ecosystem. + */ +export interface ThematicBreakData extends Data {} + +/** + * Markdown YAML. + */ +export interface Yaml extends Literal { + /** + * Node type of mdast YAML. + */ + type: "yaml"; + /** + * Data associated with the mdast YAML. + */ + data?: YamlData | undefined; +} + +/** + * Info associated with mdast YAML nodes by the ecosystem. + */ +export interface YamlData extends Data {} + +/** + * Old name of `Yaml` node. + * + * @deprecated + * Please use `Yaml` instead. + */ +export type YAML = Yaml; diff --git a/node_modules/@types/mdast/package.json b/node_modules/@types/mdast/package.json new file mode 100644 index 00000000..d37b05a6 --- /dev/null +++ b/node_modules/@types/mdast/package.json @@ -0,0 +1,47 @@ +{ + "name": "@types/mdast", + "version": "4.0.4", + "description": "TypeScript definitions for mdast", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast", + "license": "MIT", + "contributors": [ + { + "name": "Christian Murphy", + "githubUsername": "ChristianMurphy", + "url": "https://github.com/ChristianMurphy" + }, + { + "name": "Jun Lu", + "githubUsername": "lujun2", + "url": "https://github.com/lujun2" + }, + { + "name": "Remco Haszing", + "githubUsername": "remcohaszing", + "url": "https://github.com/remcohaszing" + }, + { + "name": "Titus Wormer", + "githubUsername": "wooorm", + "url": "https://github.com/wooorm" + }, + { + "name": "Remco Haszing", + "githubUsername": "remcohaszing", + "url": "https://github.com/remcohaszing" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/mdast" + }, + "scripts": {}, + "dependencies": { + "@types/unist": "*" + }, + "typesPublisherContentHash": "1599d3ca45533e9d9248231c90843306b49c07fe13ad94ebf7345da44d8fd4bd", + "typeScriptVersion": "4.7" +} \ No newline at end of file diff --git a/node_modules/@types/ms/LICENSE b/node_modules/@types/ms/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/ms/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/ms/README.md b/node_modules/@types/ms/README.md new file mode 100644 index 00000000..8b7446f1 --- /dev/null +++ b/node_modules/@types/ms/README.md @@ -0,0 +1,82 @@ +# Installation +> `npm install --save @types/ms` + +# Summary +This package contains type definitions for ms (https://github.com/vercel/ms). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms/index.d.ts) +````ts +/** + * Short/Long format for `value`. + * + * @param {Number} value + * @param {{long: boolean}} options + * @return {String} + */ +declare function ms(value: number, options?: { long: boolean }): string; + +/** + * Parse the given `value` and return milliseconds. + * + * @param {ms.StringValue} value + * @return {Number} + */ +declare function ms(value: ms.StringValue): number; + +declare namespace ms { + // Unit, UnitAnyCase, and StringValue are backported from ms@3 + // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts + + type Unit = + | "Years" + | "Year" + | "Yrs" + | "Yr" + | "Y" + | "Weeks" + | "Week" + | "W" + | "Days" + | "Day" + | "D" + | "Hours" + | "Hour" + | "Hrs" + | "Hr" + | "H" + | "Minutes" + | "Minute" + | "Mins" + | "Min" + | "M" + | "Seconds" + | "Second" + | "Secs" + | "Sec" + | "s" + | "Milliseconds" + | "Millisecond" + | "Msecs" + | "Msec" + | "Ms"; + + type UnitAnyCase = Unit | Uppercase | Lowercase; + + type StringValue = + | `${number}` + | `${number}${UnitAnyCase}` + | `${number} ${UnitAnyCase}`; +} + +export = ms; + +```` + +### Additional Details + * Last updated: Thu, 16 Jan 2025 21:02:45 GMT + * Dependencies: none + +# Credits +These definitions were written by [Zhiyuan Wang](https://github.com/danny8002). diff --git a/node_modules/@types/ms/index.d.ts b/node_modules/@types/ms/index.d.ts new file mode 100644 index 00000000..b1b1f515 --- /dev/null +++ b/node_modules/@types/ms/index.d.ts @@ -0,0 +1,63 @@ +/** + * Short/Long format for `value`. + * + * @param {Number} value + * @param {{long: boolean}} options + * @return {String} + */ +declare function ms(value: number, options?: { long: boolean }): string; + +/** + * Parse the given `value` and return milliseconds. + * + * @param {ms.StringValue} value + * @return {Number} + */ +declare function ms(value: ms.StringValue): number; + +declare namespace ms { + // Unit, UnitAnyCase, and StringValue are backported from ms@3 + // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts + + type Unit = + | "Years" + | "Year" + | "Yrs" + | "Yr" + | "Y" + | "Weeks" + | "Week" + | "W" + | "Days" + | "Day" + | "D" + | "Hours" + | "Hour" + | "Hrs" + | "Hr" + | "H" + | "Minutes" + | "Minute" + | "Mins" + | "Min" + | "M" + | "Seconds" + | "Second" + | "Secs" + | "Sec" + | "s" + | "Milliseconds" + | "Millisecond" + | "Msecs" + | "Msec" + | "Ms"; + + type UnitAnyCase = Unit | Uppercase | Lowercase; + + type StringValue = + | `${number}` + | `${number}${UnitAnyCase}` + | `${number} ${UnitAnyCase}`; +} + +export = ms; diff --git a/node_modules/@types/ms/package.json b/node_modules/@types/ms/package.json new file mode 100644 index 00000000..0f547d02 --- /dev/null +++ b/node_modules/@types/ms/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/ms", + "version": "2.1.0", + "description": "TypeScript definitions for ms", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms", + "license": "MIT", + "contributors": [ + { + "name": "Zhiyuan Wang", + "githubUsername": "danny8002", + "url": "https://github.com/danny8002" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/ms" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "2c8651ce1714fdc6bcbc0f262c93a790f1d127fb1c2dc8edbb583decef56fd39", + "typeScriptVersion": "5.0" +} \ No newline at end of file diff --git a/node_modules/@types/react/LICENSE b/node_modules/@types/react/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/react/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/react/README.md b/node_modules/@types/react/README.md new file mode 100644 index 00000000..a6062d30 --- /dev/null +++ b/node_modules/@types/react/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/react` + +# Summary +This package contains type definitions for react (https://react.dev/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. + +### Additional Details + * Last updated: Mon, 24 Nov 2025 09:38:12 GMT + * Dependencies: [csstype](https://npmjs.com/package/csstype) + +# Credits +These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock). diff --git a/node_modules/@types/react/canary.d.ts b/node_modules/@types/react/canary.d.ts new file mode 100644 index 00000000..22b1807e --- /dev/null +++ b/node_modules/@types/react/canary.d.ts @@ -0,0 +1,120 @@ +/** + * These are types for things that are present in the React `canary` release channel. + * + * To load the types declared here in an actual project, there are three ways. The easiest one, + * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, + * is to add `"react/canary"` to the `"types"` array. + * + * Alternatively, a specific import syntax can to be used from a typescript file. + * This module does not exist in reality, which is why the {} is important: + * + * ```ts + * import {} from 'react/canary' + * ``` + * + * It is also possible to include it through a triple-slash reference: + * + * ```ts + * /// + * ``` + * + * Either the import or the reference only needs to appear once, anywhere in the project. + */ + +// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared, + +import React = require("."); + +export {}; + +declare const UNDEFINED_VOID_ONLY: unique symbol; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +declare module "." { + export function unstable_useCacheRefresh(): () => void; + + // @enableViewTransition + export interface ViewTransitionInstance { + /** + * The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted. + */ + name: string; + } + + export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>; + export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string]; + + export interface ViewTransitionProps { + children?: ReactNode | undefined; + /** + * Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node. + */ + default?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if this `` or its parent Component is mounted and there's no other with the same name being deleted. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + enter?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if this `` or its parent Component is unmounted and there's no other with the same name being deleted. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + exit?: ViewTransitionClass | undefined; + /** + * "auto" will automatically assign a view-transition-name to the inner DOM node. + * That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise. + * + * A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter. + * @default "auto" + */ + name?: "auto" | (string & {}) | undefined; + /** + * The `` or its parent Component is mounted and there's no other `` with the same name being deleted. + */ + onEnter?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * The `` or its parent Component is unmounted and there's no other `` with the same name being deleted. + */ + onExit?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * This `` is being mounted and another `` instance with the same name is being unmounted elsewhere. + */ + onShare?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * The content of `` has changed either due to DOM mutations or because an inner child `` has resized. + */ + onUpdate?: (instance: ViewTransitionInstance, types: Array) => void; + ref?: Ref | undefined; + /** + * Combined with {@link className} if this `` is being mounted and another instance with the same name is being unmounted elsewhere. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + share?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if the content of this `` has changed either due to DOM mutations or because an inner child has resized. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + update?: ViewTransitionClass | undefined; + } + + /** + * Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React. + * View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content. + * Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't. + * + * @see {@link https://react.dev/reference/react/ViewTransition `` reference documentation} + */ + export const ViewTransition: ExoticComponent; + + /** + * @see {@link https://react.dev/reference/react/addTransitionType `addTransitionType` reference documentation} + */ + export function addTransitionType(type: string): void; + + // @enableFragmentRefs + export interface FragmentInstance {} + + export interface FragmentProps { + ref?: Ref | undefined; + } +} diff --git a/node_modules/@types/react/compiler-runtime.d.ts b/node_modules/@types/react/compiler-runtime.d.ts new file mode 100644 index 00000000..a98a26e6 --- /dev/null +++ b/node_modules/@types/react/compiler-runtime.d.ts @@ -0,0 +1,4 @@ +// Not meant to be used directly +// Omitting all exports so that they don't appear in IDE autocomplete. + +export {}; diff --git a/node_modules/@types/react/experimental.d.ts b/node_modules/@types/react/experimental.d.ts new file mode 100644 index 00000000..e6ebe931 --- /dev/null +++ b/node_modules/@types/react/experimental.d.ts @@ -0,0 +1,147 @@ +/** + * These are types for things that are present in the `experimental` builds of React but not yet + * on a stable build. + * + * Once they are promoted to stable they can just be moved to the main index file. + * + * To load the types declared here in an actual project, there are three ways. The easiest one, + * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, + * is to add `"react/experimental"` to the `"types"` array. + * + * Alternatively, a specific import syntax can to be used from a typescript file. + * This module does not exist in reality, which is why the {} is important: + * + * ```ts + * import {} from 'react/experimental' + * ``` + * + * It is also possible to include it through a triple-slash reference: + * + * ```ts + * /// + * ``` + * + * Either the import or the reference only needs to appear once, anywhere in the project. + */ + +// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared, +// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are +// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`. +// +// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js +// is a good place to start looking for details; it generally calls prop validation functions or delegates +// all tasks done as part of the render phase (the concurrent part of the React update cycle). +// +// Suspense-related handling can be found in ReactFiberThrow.js. + +import React = require("./canary"); + +export {}; + +declare const UNDEFINED_VOID_ONLY: unique symbol; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +declare module "." { + export interface SuspenseProps { + // @enableCPUSuspense + /** + * The presence of this prop indicates that the content is computationally expensive to render. + * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data). + * @see {@link https://github.com/facebook/react/pull/19936} + */ + defer?: boolean | undefined; + } + + export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent"; + export type SuspenseListTailMode = "collapsed" | "hidden" | "visible"; + + export interface SuspenseListCommonProps { + } + + interface DirectionalSuspenseListProps extends SuspenseListCommonProps { + /** + * Note that SuspenseList require more than one child; + * it is a runtime warning to provide only a single child. + * + * It does, however, allow those children to be wrapped inside a single + * level of ``. + */ + children: Iterable | AsyncIterable; + /** + * Defines the order in which the `SuspenseList` children should be revealed. + * @default "forwards" + */ + revealOrder?: "forwards" | "backwards" | "unstable_legacy-backwards" | undefined; + /** + * Dictates how unloaded items in a SuspenseList is shown. + * + * - `collapsed` shows only the next fallback in the list. + * - `hidden` doesn't show any unloaded items. + * - `visible` shows all fallbacks in the list. + * + * @default "hidden" + */ + tail?: SuspenseListTailMode | undefined; + } + + interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps { + children: ReactNode; + /** + * Defines the order in which the `SuspenseList` children should be revealed. + */ + revealOrder: Exclude; + /** + * The tail property is invalid when not using the `forwards` or `backwards` reveal orders. + */ + tail?: never; + } + + export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps; + + /** + * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order + * in which these components are revealed to the user. + * + * When multiple components need to fetch data, this data may arrive in an unpredictable order. + * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list + * until previous items have been displayed (this behavior is adjustable). + * + * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist + * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist + */ + export const unstable_SuspenseList: ExoticComponent; + + type Reference = object; + type TaintableUniqueValue = string | bigint | ArrayBufferView; + function experimental_taintUniqueValue( + message: string | undefined, + lifetime: Reference, + value: TaintableUniqueValue, + ): void; + function experimental_taintObjectReference(message: string | undefined, object: Reference): void; + + // @enableGestureTransition + // Implemented by the specific renderer e.g. `react-dom`. + // Keep in mind that augmented interfaces merge their JSDoc so if you put + // JSDoc here and in the renderer, the IDE will display both. + export interface GestureProvider {} + export interface GestureOptions { + rangeStart?: number | undefined; + rangeEnd?: number | undefined; + } + /** */ + export function unstable_startGestureTransition( + provider: GestureProvider, + scope: () => void, + options?: GestureOptions, + ): () => void; + + // @enableSrcObject + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES { + srcObject: Blob; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES { + srcObject: Blob | MediaSource | MediaStream; + } +} diff --git a/node_modules/@types/react/global.d.ts b/node_modules/@types/react/global.d.ts new file mode 100644 index 00000000..6770d08e --- /dev/null +++ b/node_modules/@types/react/global.d.ts @@ -0,0 +1,165 @@ +/* +React projects that don't include the DOM library need these interfaces to compile. +React Native applications use React, but there is no DOM available. The JavaScript runtime +is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`. + +Warning: all of these interfaces are empty. If you want type definitions for various properties +(such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json). +*/ + +interface Event {} +interface AnimationEvent extends Event {} +interface ClipboardEvent extends Event {} +interface CompositionEvent extends Event {} +interface DragEvent extends Event {} +interface FocusEvent extends Event {} +interface InputEvent extends Event {} +interface KeyboardEvent extends Event {} +interface MouseEvent extends Event {} +interface TouchEvent extends Event {} +interface PointerEvent extends Event {} +interface ToggleEvent extends Event {} +interface TransitionEvent extends Event {} +interface UIEvent extends Event {} +interface WheelEvent extends Event {} + +interface EventTarget {} +interface Document {} +interface DataTransfer {} +interface StyleMedia {} + +interface Element {} +interface DocumentFragment {} + +interface HTMLElement extends Element {} +interface HTMLAnchorElement extends HTMLElement {} +interface HTMLAreaElement extends HTMLElement {} +interface HTMLAudioElement extends HTMLElement {} +interface HTMLBaseElement extends HTMLElement {} +interface HTMLBodyElement extends HTMLElement {} +interface HTMLBRElement extends HTMLElement {} +interface HTMLButtonElement extends HTMLElement {} +interface HTMLCanvasElement extends HTMLElement {} +interface HTMLDataElement extends HTMLElement {} +interface HTMLDataListElement extends HTMLElement {} +interface HTMLDetailsElement extends HTMLElement {} +interface HTMLDialogElement extends HTMLElement {} +interface HTMLDivElement extends HTMLElement {} +interface HTMLDListElement extends HTMLElement {} +interface HTMLEmbedElement extends HTMLElement {} +interface HTMLFieldSetElement extends HTMLElement {} +interface HTMLFormElement extends HTMLElement {} +interface HTMLHeadingElement extends HTMLElement {} +interface HTMLHeadElement extends HTMLElement {} +interface HTMLHRElement extends HTMLElement {} +interface HTMLHtmlElement extends HTMLElement {} +interface HTMLIFrameElement extends HTMLElement {} +interface HTMLImageElement extends HTMLElement {} +interface HTMLInputElement extends HTMLElement {} +interface HTMLModElement extends HTMLElement {} +interface HTMLLabelElement extends HTMLElement {} +interface HTMLLegendElement extends HTMLElement {} +interface HTMLLIElement extends HTMLElement {} +interface HTMLLinkElement extends HTMLElement {} +interface HTMLMapElement extends HTMLElement {} +interface HTMLMetaElement extends HTMLElement {} +interface HTMLMeterElement extends HTMLElement {} +interface HTMLObjectElement extends HTMLElement {} +interface HTMLOListElement extends HTMLElement {} +interface HTMLOptGroupElement extends HTMLElement {} +interface HTMLOptionElement extends HTMLElement {} +interface HTMLOutputElement extends HTMLElement {} +interface HTMLParagraphElement extends HTMLElement {} +interface HTMLParamElement extends HTMLElement {} +interface HTMLPreElement extends HTMLElement {} +interface HTMLProgressElement extends HTMLElement {} +interface HTMLQuoteElement extends HTMLElement {} +interface HTMLSlotElement extends HTMLElement {} +interface HTMLScriptElement extends HTMLElement {} +interface HTMLSelectElement extends HTMLElement {} +interface HTMLSourceElement extends HTMLElement {} +interface HTMLSpanElement extends HTMLElement {} +interface HTMLStyleElement extends HTMLElement {} +interface HTMLTableElement extends HTMLElement {} +interface HTMLTableColElement extends HTMLElement {} +interface HTMLTableDataCellElement extends HTMLElement {} +interface HTMLTableHeaderCellElement extends HTMLElement {} +interface HTMLTableRowElement extends HTMLElement {} +interface HTMLTableSectionElement extends HTMLElement {} +interface HTMLTemplateElement extends HTMLElement {} +interface HTMLTextAreaElement extends HTMLElement {} +interface HTMLTimeElement extends HTMLElement {} +interface HTMLTitleElement extends HTMLElement {} +interface HTMLTrackElement extends HTMLElement {} +interface HTMLUListElement extends HTMLElement {} +interface HTMLVideoElement extends HTMLElement {} +interface HTMLWebViewElement extends HTMLElement {} + +interface SVGElement extends Element {} +interface SVGSVGElement extends SVGElement {} +interface SVGCircleElement extends SVGElement {} +interface SVGClipPathElement extends SVGElement {} +interface SVGDefsElement extends SVGElement {} +interface SVGDescElement extends SVGElement {} +interface SVGEllipseElement extends SVGElement {} +interface SVGFEBlendElement extends SVGElement {} +interface SVGFEColorMatrixElement extends SVGElement {} +interface SVGFEComponentTransferElement extends SVGElement {} +interface SVGFECompositeElement extends SVGElement {} +interface SVGFEConvolveMatrixElement extends SVGElement {} +interface SVGFEDiffuseLightingElement extends SVGElement {} +interface SVGFEDisplacementMapElement extends SVGElement {} +interface SVGFEDistantLightElement extends SVGElement {} +interface SVGFEDropShadowElement extends SVGElement {} +interface SVGFEFloodElement extends SVGElement {} +interface SVGFEFuncAElement extends SVGElement {} +interface SVGFEFuncBElement extends SVGElement {} +interface SVGFEFuncGElement extends SVGElement {} +interface SVGFEFuncRElement extends SVGElement {} +interface SVGFEGaussianBlurElement extends SVGElement {} +interface SVGFEImageElement extends SVGElement {} +interface SVGFEMergeElement extends SVGElement {} +interface SVGFEMergeNodeElement extends SVGElement {} +interface SVGFEMorphologyElement extends SVGElement {} +interface SVGFEOffsetElement extends SVGElement {} +interface SVGFEPointLightElement extends SVGElement {} +interface SVGFESpecularLightingElement extends SVGElement {} +interface SVGFESpotLightElement extends SVGElement {} +interface SVGFETileElement extends SVGElement {} +interface SVGFETurbulenceElement extends SVGElement {} +interface SVGFilterElement extends SVGElement {} +interface SVGForeignObjectElement extends SVGElement {} +interface SVGGElement extends SVGElement {} +interface SVGImageElement extends SVGElement {} +interface SVGLineElement extends SVGElement {} +interface SVGLinearGradientElement extends SVGElement {} +interface SVGMarkerElement extends SVGElement {} +interface SVGMaskElement extends SVGElement {} +interface SVGMetadataElement extends SVGElement {} +interface SVGPathElement extends SVGElement {} +interface SVGPatternElement extends SVGElement {} +interface SVGPolygonElement extends SVGElement {} +interface SVGPolylineElement extends SVGElement {} +interface SVGRadialGradientElement extends SVGElement {} +interface SVGRectElement extends SVGElement {} +interface SVGSetElement extends SVGElement {} +interface SVGStopElement extends SVGElement {} +interface SVGSwitchElement extends SVGElement {} +interface SVGSymbolElement extends SVGElement {} +interface SVGTextElement extends SVGElement {} +interface SVGTextPathElement extends SVGElement {} +interface SVGTSpanElement extends SVGElement {} +interface SVGUseElement extends SVGElement {} +interface SVGViewElement extends SVGElement {} + +interface FormData {} +interface Text {} +interface TouchList {} +interface WebGLRenderingContext {} +interface WebGL2RenderingContext {} + +interface TrustedHTML {} + +interface Blob {} +interface MediaStream {} +interface MediaSource {} diff --git a/node_modules/@types/react/index.d.ts b/node_modules/@types/react/index.d.ts new file mode 100644 index 00000000..b3bab603 --- /dev/null +++ b/node_modules/@types/react/index.d.ts @@ -0,0 +1,4324 @@ +// NOTE: Users of the `experimental` builds of React should add a reference +// to 'react/experimental' in their project. See experimental.d.ts's top comment +// for reference and documentation on how exactly to do it. + +/// + +import * as CSS from "csstype"; + +type NativeAnimationEvent = AnimationEvent; +type NativeClipboardEvent = ClipboardEvent; +type NativeCompositionEvent = CompositionEvent; +type NativeDragEvent = DragEvent; +type NativeFocusEvent = FocusEvent; +type NativeInputEvent = InputEvent; +type NativeKeyboardEvent = KeyboardEvent; +type NativeMouseEvent = MouseEvent; +type NativeTouchEvent = TouchEvent; +type NativePointerEvent = PointerEvent; +type NativeToggleEvent = ToggleEvent; +type NativeTransitionEvent = TransitionEvent; +type NativeUIEvent = UIEvent; +type NativeWheelEvent = WheelEvent; + +/** + * Used to represent DOM API's where users can either pass + * true or false as a boolean or as its equivalent strings. + */ +type Booleanish = boolean | "true" | "false"; + +/** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN} + */ +type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined; + +declare const UNDEFINED_VOID_ONLY: unique symbol; + +/** + * @internal Use `Awaited` instead + */ +// Helper type to enable `Awaited`. +// Must be a copy of the non-thenables of `ReactNode`. +type AwaitedReactNode = + | React.ReactElement + | string + | number + | bigint + | Iterable + | React.ReactPortal + | boolean + | null + | undefined + | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ + keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES + ]; + +/** + * The function returned from an effect passed to {@link React.useEffect useEffect}, + * which can be used to clean up the effect when the component unmounts. + * + * @see {@link https://react.dev/reference/react/useEffect React Docs} + */ +type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never }; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +// eslint-disable-next-line @definitelytyped/export-just-namespace +export = React; +export as namespace React; + +declare namespace React { + // + // React Elements + // ---------------------------------------------------------------------- + + /** + * Used to retrieve the possible components which accept a given set of props. + * + * Can be passed no type parameters to get a union of all possible components + * and tags. + * + * Is a superset of {@link ComponentType}. + * + * @template P The props to match against. If not passed, defaults to any. + * @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags. + * + * @example + * + * ```tsx + * // All components and tags (img, embed etc.) + * // which accept `src` + * type SrcComponents = ElementType<{ src: any }>; + * ``` + * + * @example + * + * ```tsx + * // All components + * type AllComponents = ElementType; + * ``` + * + * @example + * + * ```tsx + * // All custom components which match `src`, and tags which + * // match `src`, narrowed down to just `audio` and `embed` + * type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>; + * ``` + */ + type ElementType

= + | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] + | ComponentType

; + + /** + * Represents any user-defined component, either as a function or a class. + * + * Similar to {@link JSXElementConstructor}, but with extra properties like + * {@link FunctionComponent.defaultProps defaultProps }. + * + * @template P The props the component accepts. + * + * @see {@link ComponentClass} + * @see {@link FunctionComponent} + */ + type ComponentType

= ComponentClass

| FunctionComponent

; + + /** + * Represents any user-defined component, either as a function or a class. + * + * Similar to {@link ComponentType}, but without extra properties like + * {@link FunctionComponent.defaultProps defaultProps }. + * + * @template P The props the component accepts. + */ + type JSXElementConstructor

= + | (( + props: P, + ) => ReactNode | Promise) + // constructor signature must match React.Component + | (new(props: P, context: any) => Component); + + /** + * Created by {@link createRef}, or {@link useRef} when passed `null`. + * + * @template T The type of the ref's value. + * + * @example + * + * ```tsx + * const ref = createRef(); + * + * ref.current = document.createElement('div'); // Error + * ``` + */ + interface RefObject { + /** + * The current value of the ref. + */ + current: T; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { + } + /** + * A callback fired whenever the ref's value changes. + * + * @template T The type of the ref's value. + * + * @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs} + * + * @example + * + * ```tsx + *

console.log(node)} /> + * ``` + */ + type RefCallback = { + bivarianceHack( + instance: T | null, + ): + | void + | (() => VoidOrUndefinedOnly) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES + ]; + }["bivarianceHack"]; + + /** + * A union type of all possible shapes for React refs. + * + * @see {@link RefCallback} + * @see {@link RefObject} + */ + + type Ref = RefCallback | RefObject | null; + /** + * @deprecated Use `Ref` instead. String refs are no longer supported. + * If you're typing a library with support for React versions with string refs, use `RefAttributes['ref']` instead. + */ + type LegacyRef = Ref; + /** + * @deprecated Use `ComponentRef` instead + * + * Retrieves the type of the 'ref' prop for a given component type or tag name. + * + * @template C The component type. + * + * @example + * + * ```tsx + * type MyComponentRef = React.ElementRef; + * ``` + * + * @example + * + * ```tsx + * type DivRef = React.ElementRef<'div'>; + * ``` + */ + type ElementRef< + C extends + | ForwardRefExoticComponent + | { new(props: any, context: any): Component } + | ((props: any) => ReactNode) + | keyof JSX.IntrinsicElements, + > = ComponentRef; + + type ComponentState = any; + + /** + * A value which uniquely identifies a node among items in an array. + * + * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs} + */ + type Key = string | number | bigint; + + /** + * @internal The props any component can receive. + * You don't have to add this type. All components automatically accept these props. + * ```tsx + * const Component = () =>
; + * + * ``` + * + * WARNING: The implementation of a component will never have access to these attributes. + * The following example would be incorrect usage because {@link Component} would never have access to `key`: + * ```tsx + * const Component = (props: React.Attributes) => props.key; + * ``` + */ + interface Attributes { + key?: Key | null | undefined; + } + /** + * The props any component accepting refs can receive. + * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props. + * ```tsx + * const Component = forwardRef(() =>
); + * console.log(current)} /> + * ``` + * + * You only need this type if you manually author the types of props that need to be compatible with legacy refs. + * ```tsx + * interface Props extends React.RefAttributes {} + * declare const Component: React.FunctionComponent; + * ``` + * + * Otherwise it's simpler to directly use {@link Ref} since you can safely use the + * props type to describe to props that a consumer can pass to the component + * as well as describing the props the implementation of a component "sees". + * {@link RefAttributes} is generally not safe to describe both consumer and seen props. + * + * ```tsx + * interface Props extends { + * ref?: React.Ref | undefined; + * } + * declare const Component: React.FunctionComponent; + * ``` + * + * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs. + * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string` + * ```tsx + * const Component = (props: React.RefAttributes) => props.ref; + * ``` + */ + interface RefAttributes extends Attributes { + /** + * Allows getting a ref to the component instance. + * Once the component unmounts, React will set `ref.current` to `null` + * (or call the ref with `null` if you passed a callback ref). + * + * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} + */ + ref?: Ref | undefined; + } + + /** + * Represents the built-in attributes available to class components. + */ + interface ClassAttributes extends RefAttributes { + } + + /** + * Represents a JSX element. + * + * Where {@link ReactNode} represents everything that can be rendered, `ReactElement` + * only represents JSX. + * + * @template P The type of the props object + * @template T The type of the component or tag + * + * @example + * + * ```tsx + * const element: ReactElement =
; + * ``` + */ + interface ReactElement< + P = unknown, + T extends string | JSXElementConstructor = string | JSXElementConstructor, + > { + type: T; + props: P; + key: string | null; + } + + /** + * @deprecated + */ + interface ReactComponentElement< + T extends keyof JSX.IntrinsicElements | JSXElementConstructor, + P = Pick, Exclude, "key" | "ref">>, + > extends ReactElement> {} + + /** + * @deprecated Use `ReactElement>` + */ + interface FunctionComponentElement

extends ReactElement> { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined; + } + + /** + * @deprecated Use `ReactElement>` + */ + type CElement> = ComponentElement; + /** + * @deprecated Use `ReactElement>` + */ + interface ComponentElement> extends ReactElement> { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref?: Ref | undefined; + } + + /** + * @deprecated Use {@link ComponentElement} instead. + */ + type ClassicElement

= CElement>; + + // string fallback for custom web-components + /** + * @deprecated Use `ReactElement` + */ + interface DOMElement

| SVGAttributes, T extends Element> + extends ReactElement + { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref: Ref; + } + + // ReactHTML for ReactHTMLElement + interface ReactHTMLElement extends DetailedReactHTMLElement, T> {} + + interface DetailedReactHTMLElement

, T extends HTMLElement> extends DOMElement { + type: HTMLElementType; + } + + // ReactSVG for ReactSVGElement + interface ReactSVGElement extends DOMElement, SVGElement> { + type: SVGElementType; + } + + interface ReactPortal extends ReactElement { + children: ReactNode; + } + + /** + * Different release channels declare additional types of ReactNode this particular release channel accepts. + * App or library types should never augment this interface. + */ + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {} + + /** + * Represents all of the things React can render. + * + * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Typing children + * type Props = { children: ReactNode } + * + * const Component = ({ children }: Props) =>

{children}
+ * + * hello + * ``` + * + * @example + * + * ```tsx + * // Typing a custom element + * type Props = { customElement: ReactNode } + * + * const Component = ({ customElement }: Props) =>
{customElement}
+ * + * hello
} /> + * ``` + */ + // non-thenables need to be kept in sync with AwaitedReactNode + type ReactNode = + | ReactElement + | string + | number + | bigint + | Iterable + | ReactPortal + | boolean + | null + | undefined + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES + ] + | Promise; + + // + // Top Level API + // ---------------------------------------------------------------------- + + // DOM Elements + // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" + function createElement( + type: "input", + props?: InputHTMLAttributes & ClassAttributes | null, + ...children: ReactNode[] + ): DetailedReactHTMLElement, HTMLInputElement>; + function createElement

, T extends HTMLElement>( + type: HTMLElementType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): DetailedReactHTMLElement; + function createElement

, T extends SVGElement>( + type: SVGElementType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): ReactSVGElement; + function createElement

, T extends Element>( + type: string, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): DOMElement; + + // Custom components + + function createElement

( + type: FunctionComponent

, + props?: Attributes & P | null, + ...children: ReactNode[] + ): FunctionComponentElement

; + function createElement

, C extends ComponentClass

>( + type: ClassType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): CElement; + function createElement

( + type: FunctionComponent

| ComponentClass

| string, + props?: Attributes & P | null, + ...children: ReactNode[] + ): ReactElement

; + + // DOM Elements + // ReactHTMLElement + function cloneElement

, T extends HTMLElement>( + element: DetailedReactHTMLElement, + props?: P, + ...children: ReactNode[] + ): DetailedReactHTMLElement; + // ReactHTMLElement, less specific + function cloneElement

, T extends HTMLElement>( + element: ReactHTMLElement, + props?: P, + ...children: ReactNode[] + ): ReactHTMLElement; + // SVGElement + function cloneElement

, T extends SVGElement>( + element: ReactSVGElement, + props?: P, + ...children: ReactNode[] + ): ReactSVGElement; + // DOM Element (has to be the last, because type checking stops at first overload that fits) + function cloneElement

, T extends Element>( + element: DOMElement, + props?: DOMAttributes & P, + ...children: ReactNode[] + ): DOMElement; + + // Custom components + function cloneElement

( + element: FunctionComponentElement

, + props?: Partial

& Attributes, + ...children: ReactNode[] + ): FunctionComponentElement

; + function cloneElement>( + element: CElement, + props?: Partial

& ClassAttributes, + ...children: ReactNode[] + ): CElement; + function cloneElement

( + element: ReactElement

, + props?: Partial

& Attributes, + ...children: ReactNode[] + ): ReactElement

; + + /** + * Describes the props accepted by a Context {@link Provider}. + * + * @template T The type of the value the context provides. + */ + interface ProviderProps { + value: T; + children?: ReactNode | undefined; + } + + /** + * Describes the props accepted by a Context {@link Consumer}. + * + * @template T The type of the value the context provides. + */ + interface ConsumerProps { + children: (value: T) => ReactNode; + } + + /** + * An object masquerading as a component. These are created by functions + * like {@link forwardRef}, {@link memo}, and {@link createContext}. + * + * In order to make TypeScript work, we pretend that they are normal + * components. + * + * But they are, in fact, not callable - instead, they are objects which + * are treated specially by the renderer. + * + * @template P The props the component accepts. + */ + interface ExoticComponent

{ + (props: P): ReactNode; + readonly $$typeof: symbol; + } + + /** + * An {@link ExoticComponent} with a `displayName` property applied to it. + * + * @template P The props the component accepts. + */ + interface NamedExoticComponent

extends ExoticComponent

{ + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * An {@link ExoticComponent} with a `propTypes` property applied to it. + * + * @template P The props the component accepts. + */ + interface ProviderExoticComponent

extends ExoticComponent

{ + } + + /** + * Used to retrieve the type of a context object from a {@link Context}. + * + * @template C The context object. + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const MyContext = createContext({ foo: 'bar' }); + * + * type ContextType = ContextType; + * // ContextType = { foo: string } + * ``` + */ + type ContextType> = C extends Context ? T : never; + + /** + * Wraps your components to specify the value of this context for all components inside. + * + * @see {@link https://react.dev/reference/react/createContext#provider React Docs} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * + * function App() { + * return ( + * + * + * + * ); + * } + * ``` + */ + type Provider = ProviderExoticComponent>; + + /** + * The old way to read context, before {@link useContext} existed. + * + * @see {@link https://react.dev/reference/react/createContext#consumer React Docs} + * + * @example + * + * ```tsx + * import { UserContext } from './user-context'; + * + * function Avatar() { + * return ( + * + * {user => {user.name}} + * + * ); + * } + * ``` + */ + type Consumer = ExoticComponent>; + + /** + * Context lets components pass information deep down without explicitly + * passing props. + * + * Created from {@link createContext} + * + * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * ``` + */ + interface Context extends Provider { + Provider: Provider; + Consumer: Consumer; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * Lets you create a {@link Context} that components can provide or read. + * + * @param defaultValue The value you want the context to have when there is no matching + * {@link Provider} in the tree above the component reading the context. This is meant + * as a "last resort" fallback. + * + * @see {@link https://react.dev/reference/react/createContext#reference React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * function App() { + * return ( + * + * + * + * ); + * } + * ``` + */ + function createContext( + // If you thought this should be optional, see + // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106 + defaultValue: T, + ): Context; + + function isValidElement

(object: {} | null | undefined): object is ReactElement

; + + const Children: { + map( + children: C | readonly C[], + fn: (child: C, index: number) => T, + ): C extends null | undefined ? C : Array>; + forEach(children: C | readonly C[], fn: (child: C, index: number) => void): void; + count(children: any): number; + only(children: C): C extends any[] ? never : C; + toArray(children: ReactNode | ReactNode[]): Array>; + }; + + export interface FragmentProps { + children?: React.ReactNode; + } + /** + * Lets you group elements without a wrapper node. + * + * @see {@link https://react.dev/reference/react/Fragment React Docs} + * + * @example + * + * ```tsx + * import { Fragment } from 'react'; + * + * + * Hello + * World + * + * ``` + * + * @example + * + * ```tsx + * // Using the <> shorthand syntax: + * + * <> + * Hello + * World + * + * ``` + */ + const Fragment: ExoticComponent; + + /** + * Lets you find common bugs in your components early during development. + * + * @see {@link https://react.dev/reference/react/StrictMode React Docs} + * + * @example + * + * ```tsx + * import { StrictMode } from 'react'; + * + * + * + * + * ``` + */ + const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>; + + /** + * The props accepted by {@link Suspense}. + * + * @see {@link https://react.dev/reference/react/Suspense React Docs} + */ + interface SuspenseProps { + children?: ReactNode | undefined; + + /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */ + fallback?: ReactNode; + + /** + * A name for this Suspense boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; + } + + /** + * Lets you display a fallback until its children have finished loading. + * + * @see {@link https://react.dev/reference/react/Suspense React Docs} + * + * @example + * + * ```tsx + * import { Suspense } from 'react'; + * + * }> + * + * + * ``` + */ + const Suspense: ExoticComponent; + const version: string; + + /** + * The callback passed to {@link ProfilerProps.onRender}. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + type ProfilerOnRenderCallback = ( + /** + * The string id prop of the {@link Profiler} tree that has just committed. This lets + * you identify which part of the tree was committed if you are using multiple + * profilers. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + id: string, + /** + * This lets you know whether the tree has just been mounted for the first time + * or re-rendered due to a change in props, state, or hooks. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + phase: "mount" | "update" | "nested-update", + /** + * The number of milliseconds spent rendering the {@link Profiler} and its descendants + * for the current update. This indicates how well the subtree makes use of + * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease + * significantly after the initial mount as many of the descendants will only need to + * re-render if their specific props change. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + actualDuration: number, + /** + * The number of milliseconds estimating how much time it would take to re-render the entire + * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most + * recent render durations of each component in the tree. This value estimates a worst-case + * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare + * {@link actualDuration} against it to see if memoization is working. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + baseDuration: number, + /** + * A numeric timestamp for when React began rendering the current update. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + startTime: number, + /** + * A numeric timestamp for when React committed the current update. This value is shared + * between all profilers in a commit, enabling them to be grouped if desirable. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + commitTime: number, + ) => void; + + /** + * The props accepted by {@link Profiler}. + * + * @see {@link https://react.dev/reference/react/Profiler React Docs} + */ + interface ProfilerProps { + children?: ReactNode | undefined; + id: string; + onRender: ProfilerOnRenderCallback; + } + + /** + * Lets you measure rendering performance of a React tree programmatically. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + * + * @example + * + * ```tsx + * + * + * + * ``` + */ + const Profiler: ExoticComponent; + + // + // Component API + // ---------------------------------------------------------------------- + + type ReactInstance = Component | Element; + + // Base component for plain JS classes + interface Component

extends ComponentLifecycle {} + class Component { + /** + * If set, `this.context` will be set at runtime to the current value of the given Context. + * + * @example + * + * ```ts + * type MyContext = number + * const Ctx = React.createContext(0) + * + * class Foo extends React.Component { + * static contextType = Ctx + * context!: React.ContextType + * render () { + * return <>My context's value: {this.context}; + * } + * } + * ``` + * + * @see {@link https://react.dev/reference/react/Component#static-contexttype} + */ + static contextType?: Context | undefined; + + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + static propTypes?: any; + + /** + * If using React Context, re-declare this in your class to be the + * `React.ContextType` of your `static contextType`. + * Should be used with type annotation or static contextType. + * + * @example + * ```ts + * static contextType = MyContext + * // For TS pre-3.7: + * context!: React.ContextType + * // For TS 3.7 and above: + * declare context: React.ContextType + * ``` + * + * @see {@link https://react.dev/reference/react/Component#context React Docs} + */ + context: unknown; + + // Keep in sync with constructor signature of JSXElementConstructor and ComponentClass. + constructor(props: P); + /** + * @param props + * @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified + * in `contextType`. + */ + // TODO: Ideally we'd infer the constructor signatur from `contextType`. + // Might be hard to ship without breaking existing code. + constructor(props: P, context: any); + + // We MUST keep setState() as a unified signature because it allows proper checking of the method return type. + // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257 + // Also, the ` | S` allows intellisense to not be dumbisense + setState( + state: ((prevState: Readonly, props: Readonly

) => Pick | S | null) | (Pick | S | null), + callback?: () => void, + ): void; + + forceUpdate(callback?: () => void): void; + render(): ReactNode; + + readonly props: Readonly

; + state: Readonly; + } + + class PureComponent

extends Component {} + + /** + * @deprecated Use `ClassicComponent` from `create-react-class` + * + * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} + * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} + */ + interface ClassicComponent

extends Component { + replaceState(nextState: S, callback?: () => void): void; + isMounted(): boolean; + getInitialState?(): S; + } + + // + // Class Interfaces + // ---------------------------------------------------------------------- + + /** + * Represents the type of a function component. Can optionally + * receive a type argument that represents the props the component + * receives. + * + * @template P The props the component accepts. + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} + * @alias for {@link FunctionComponent} + * + * @example + * + * ```tsx + * // With props: + * type Props = { name: string } + * + * const MyComponent: FC = (props) => { + * return

{props.name}
+ * } + * ``` + * + * @example + * + * ```tsx + * // Without props: + * const MyComponentWithoutProps: FC = () => { + * return
MyComponentWithoutProps
+ * } + * ``` + */ + type FC

= FunctionComponent

; + + /** + * Represents the type of a function component. Can optionally + * receive a type argument that represents the props the component + * accepts. + * + * @template P The props the component accepts. + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // With props: + * type Props = { name: string } + * + * const MyComponent: FunctionComponent = (props) => { + * return

{props.name}
+ * } + * ``` + * + * @example + * + * ```tsx + * // Without props: + * const MyComponentWithoutProps: FunctionComponent = () => { + * return
MyComponentWithoutProps
+ * } + * ``` + */ + interface FunctionComponent

{ + (props: P): ReactNode | Promise; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + * + * @example + * + * ```tsx + * + * const MyComponent: FC = () => { + * return

Hello!
+ * } + * + * MyComponent.displayName = 'MyAwesomeComponent' + * ``` + */ + displayName?: string | undefined; + } + + /** + * The type of the ref received by a {@link ForwardRefRenderFunction}. + * + * @see {@link ForwardRefRenderFunction} + */ + // Making T nullable is assuming the refs will be managed by React or the component impl will write it somewhere else. + // But this isn't necessarily true. We haven't heard complains about it yet and hopefully `forwardRef` is removed from React before we do. + type ForwardedRef = ((instance: T | null) => void) | RefObject | null; + + /** + * The type of the function passed to {@link forwardRef}. This is considered different + * to a normal {@link FunctionComponent} because it receives an additional argument, + * + * @param props Props passed to the component, if any. + * @param ref A ref forwarded to the component of type {@link ForwardedRef}. + * + * @template T The type of the forwarded ref. + * @template P The type of the props the component accepts. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} + * @see {@link forwardRef} + */ + interface ForwardRefRenderFunction { + (props: P, ref: ForwardedRef): ReactNode; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * Will show `ForwardRef(${Component.displayName || Component.name})` + * in devtools by default, but can be given its own specific name. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + } + + /** + * Represents a component class in React. + * + * @template P The props the component accepts. + * @template S The internal state of the component. + */ + interface ComponentClass

extends StaticLifecycle { + // constructor signature must match React.Component + new( + props: P, + /** + * Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified + * in `contextType`. + */ + context?: any, + ): Component; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + contextType?: Context | undefined; + defaultProps?: Partial

| undefined; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * @deprecated Use `ClassicComponentClass` from `create-react-class` + * + * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} + * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} + */ + interface ClassicComponentClass

extends ComponentClass

{ + new(props: P): ClassicComponent; + getDefaultProps?(): P; + } + + /** + * Used in {@link createElement} and {@link createFactory} to represent + * a class. + * + * An intersection type is used to infer multiple type parameters from + * a single argument, which is useful for many top-level API defs. + * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue} + * for more info. + */ + type ClassType, C extends ComponentClass

> = + & C + & (new(props: P, context: any) => T); + + // + // Component Specs and Lifecycle + // ---------------------------------------------------------------------- + + // This should actually be something like `Lifecycle | DeprecatedLifecycle`, + // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle + // methods are present. + interface ComponentLifecycle extends NewLifecycle, DeprecatedLifecycle { + /** + * Called immediately after a component is mounted. Setting state here will trigger re-rendering. + */ + componentDidMount?(): void; + /** + * Called to determine whether the change in props and state should trigger a re-render. + * + * `Component` always returns true. + * `PureComponent` implements a shallow comparison on props and state and returns true if any + * props or states have changed. + * + * If false is returned, {@link Component.render}, `componentWillUpdate` + * and `componentDidUpdate` will not be called. + */ + shouldComponentUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): boolean; + /** + * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as + * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`. + */ + componentWillUnmount?(): void; + /** + * Catches exceptions generated in descendant components. Unhandled exceptions will cause + * the entire component tree to unmount. + */ + componentDidCatch?(error: Error, errorInfo: ErrorInfo): void; + } + + // Unfortunately, we have no way of declaring that the component constructor must implement this + interface StaticLifecycle { + getDerivedStateFromProps?: GetDerivedStateFromProps | undefined; + getDerivedStateFromError?: GetDerivedStateFromError | undefined; + } + + type GetDerivedStateFromProps = + /** + * Returns an update to a component's state based on its new props and old state. + * + * Note: its presence prevents any of the deprecated lifecycle methods from being invoked + */ + (nextProps: Readonly

, prevState: S) => Partial | null; + + type GetDerivedStateFromError = + /** + * This lifecycle is invoked after an error has been thrown by a descendant component. + * It receives the error that was thrown as a parameter and should return a value to update state. + * + * Note: its presence prevents any of the deprecated lifecycle methods from being invoked + */ + (error: any) => Partial | null; + + // This should be "infer SS" but can't use it yet + interface NewLifecycle { + /** + * Runs before React applies the result of {@link Component.render render} to the document, and + * returns an object to be given to {@link componentDidUpdate}. Useful for saving + * things such as scroll position before {@link Component.render render} causes changes to it. + * + * Note: the presence of this method prevents any of the deprecated + * lifecycle events from running. + */ + getSnapshotBeforeUpdate?(prevProps: Readonly

, prevState: Readonly): SS | null; + /** + * Called immediately after updating occurs. Not called for the initial render. + * + * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null. + */ + componentDidUpdate?(prevProps: Readonly

, prevState: Readonly, snapshot?: SS): void; + } + + interface DeprecatedLifecycle { + /** + * Called immediately before mounting occurs, and before {@link Component.render}. + * Avoid introducing any side-effects or subscriptions in this method. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillMount?(): void; + /** + * Called immediately before mounting occurs, and before {@link Component.render}. + * Avoid introducing any side-effects or subscriptions in this method. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillMount?(): void; + /** + * Called when the component may be receiving new props. + * React may call this even if props have not changed, so be sure to compare new and existing + * props if you only want to handle changes. + * + * Calling {@link Component.setState} generally does not trigger this method. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; + /** + * Called when the component may be receiving new props. + * React may call this even if props have not changed, so be sure to compare new and existing + * props if you only want to handle changes. + * + * Calling {@link Component.setState} generally does not trigger this method. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; + /** + * Called immediately before rendering when new props or state is received. Not called for the initial render. + * + * Note: You cannot call {@link Component.setState} here. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; + /** + * Called immediately before rendering when new props or state is received. Not called for the initial render. + * + * Note: You cannot call {@link Component.setState} here. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use getSnapshotBeforeUpdate instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; + } + + function createRef(): RefObject; + + /** + * The type of the component returned from {@link forwardRef}. + * + * @template P The props the component accepts, if any. + * + * @see {@link ExoticComponent} + */ + interface ForwardRefExoticComponent

extends NamedExoticComponent

{ + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + } + + /** + * Lets your component expose a DOM node to a parent component + * using a ref. + * + * @see {@link https://react.dev/reference/react/forwardRef React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} + * + * @param render See the {@link ForwardRefRenderFunction}. + * + * @template T The type of the DOM node. + * @template P The props the component accepts, if any. + * + * @example + * + * ```tsx + * interface Props { + * children?: ReactNode; + * type: "submit" | "button"; + * } + * + * export const FancyButton = forwardRef((props, ref) => ( + * + * )); + * ``` + */ + function forwardRef( + render: ForwardRefRenderFunction>, + ): ForwardRefExoticComponent & RefAttributes>; + + /** + * Omits the 'ref' attribute from the given props object. + * + * @template Props The props object type. + */ + type PropsWithoutRef = + // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions. + // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types + // https://github.com/Microsoft/TypeScript/issues/28339 + Props extends any ? ("ref" extends keyof Props ? Omit : Props) : Props; + /** + * Ensures that the props do not include string ref, which cannot be forwarded + * @deprecated Use `Props` directly. `PropsWithRef` is just an alias for `Props` + */ + type PropsWithRef = Props; + + type PropsWithChildren

= P & { children?: ReactNode | undefined }; + + /** + * Used to retrieve the props a component accepts. Can either be passed a string, + * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React + * component. + * + * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef} + * instead of this type, as they let you be explicit about whether or not to include + * the `ref` prop. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentProps<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>

; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentProps = React.ComponentProps; + * ``` + */ + type ComponentProps> = T extends + JSXElementConstructor ? Props + : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] + : {}; + + /** + * Used to retrieve the props a component accepts with its ref. Can either be + * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the + * type of a React component. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentPropsWithRef<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithRef = React.ComponentPropsWithRef; + * ``` + */ + type ComponentPropsWithRef = T extends JSXElementConstructor + // If it's a class i.e. newable we're dealing with a class component + ? T extends abstract new(args: any) => any ? PropsWithoutRef & RefAttributes> + : Props + : ComponentProps; + /** + * Used to retrieve the props a custom component accepts with its ref. + * + * Unlike {@link ComponentPropsWithRef}, this only works with custom + * components, i.e. components you define yourself. This is to improve + * type-checking performance. + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef; + * ``` + */ + type CustomComponentPropsWithRef = T extends JSXElementConstructor + // If it's a class i.e. newable we're dealing with a class component + ? T extends abstract new(args: any) => any ? PropsWithoutRef & RefAttributes> + : Props + : never; + + /** + * Used to retrieve the props a component accepts without its ref. Can either be + * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the + * type of a React component. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentPropsWithoutRef<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef; + * ``` + */ + type ComponentPropsWithoutRef = PropsWithoutRef>; + + /** + * Retrieves the type of the 'ref' prop for a given component type or tag name. + * + * @template C The component type. + * + * @example + * + * ```tsx + * type MyComponentRef = React.ComponentRef; + * ``` + * + * @example + * + * ```tsx + * type DivRef = React.ComponentRef<'div'>; + * ``` + */ + type ComponentRef = ComponentPropsWithRef extends RefAttributes ? Method + : never; + + // will show `Memo(${Component.displayName || Component.name})` in devtools by default, + // but can be given its own specific name + type MemoExoticComponent> = NamedExoticComponent> & { + readonly type: T; + }; + + /** + * Lets you skip re-rendering a component when its props are unchanged. + * + * @see {@link https://react.dev/reference/react/memo React Docs} + * + * @param Component The component to memoize. + * @param propsAreEqual A function that will be used to determine if the props have changed. + * + * @example + * + * ```tsx + * import { memo } from 'react'; + * + * const SomeComponent = memo(function SomeComponent(props: { foo: string }) { + * // ... + * }); + * ``` + */ + function memo

( + Component: FunctionComponent

, + propsAreEqual?: (prevProps: Readonly

, nextProps: Readonly

) => boolean, + ): NamedExoticComponent

; + function memo>( + Component: T, + propsAreEqual?: (prevProps: Readonly>, nextProps: Readonly>) => boolean, + ): MemoExoticComponent; + + interface LazyExoticComponent> + extends ExoticComponent> + { + readonly _result: T; + } + + /** + * Lets you defer loading a component’s code until it is rendered for the first time. + * + * @see {@link https://react.dev/reference/react/lazy React Docs} + * + * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a + * then method). React will not call `load` until the first time you attempt to render the returned + * component. After React first calls load, it will wait for it to resolve, and then render the + * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s + * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects, + * React will throw the rejection reason for the nearest Error Boundary to handle. + * + * @example + * + * ```tsx + * import { lazy } from 'react'; + * + * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js')); + * ``` + */ + function lazy>( + load: () => Promise<{ default: T }>, + ): LazyExoticComponent; + + // + // React Hooks + // ---------------------------------------------------------------------- + + /** + * The instruction passed to a {@link Dispatch} function in {@link useState} + * to tell React what the next value of the {@link useState} should be. + * + * Often found wrapped in {@link Dispatch}. + * + * @template S The type of the state. + * + * @example + * + * ```tsx + * // This return type correctly represents the type of + * // `setCount` in the example below. + * const useCustomState = (): Dispatch> => { + * const [count, setCount] = useState(0); + * + * return setCount; + * } + * ``` + */ + type SetStateAction = S | ((prevState: S) => S); + + /** + * A function that can be used to update the state of a {@link useState} + * or {@link useReducer} hook. + */ + type Dispatch = (value: A) => void; + /** + * A {@link Dispatch} function can sometimes be called without any arguments. + */ + type DispatchWithoutAction = () => void; + // Limit the reducer to accept only 0 or 1 action arguments + // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type + type AnyActionArg = [] | [any]; + // Get the dispatch type from the reducer arguments (captures optional action argument correctly) + type ActionDispatch = (...args: ActionArg) => void; + // Unlike redux, the actions _can_ be anything + type Reducer = (prevState: S, action: A) => S; + // If useReducer accepts a reducer without action, dispatch may be called without any parameters. + type ReducerWithoutAction = (prevState: S) => S; + // types used to try and prevent the compiler from reducing S + // to a supertype common with the second argument to useReducer() + type ReducerState> = R extends Reducer ? S : never; + type DependencyList = readonly unknown[]; + + // NOTE: callbacks are _only_ allowed to return either void, or a destructor. + type EffectCallback = () => void | Destructor; + + /** + * @deprecated Use `RefObject` instead. + */ + interface MutableRefObject { + current: T; + } + + // This will technically work if you give a Consumer or Provider but it's deprecated and warns + /** + * Accepts a context object (the value returned from `React.createContext`) and returns the current + * context value, as given by the nearest context provider for the given context. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useContext} + */ + function useContext(context: Context /*, (not public API) observedBits?: number|boolean */): T; + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useState} + */ + function useState(initialState: S | (() => S)): [S, Dispatch>]; + // convenience overload when first argument is omitted + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useState} + */ + function useState(): [S | undefined, Dispatch>]; + /** + * An alternative to `useState`. + * + * `useReducer` is usually preferable to `useState` when you have complex state logic that involves + * multiple sub-values. It also lets you optimize performance for components that trigger deep + * updates because you can pass `dispatch` down instead of callbacks. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useReducer} + */ + function useReducer( + reducer: (prevState: S, ...args: A) => S, + initialState: S, + ): [S, ActionDispatch]; + /** + * An alternative to `useState`. + * + * `useReducer` is usually preferable to `useState` when you have complex state logic that involves + * multiple sub-values. It also lets you optimize performance for components that trigger deep + * updates because you can pass `dispatch` down instead of callbacks. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useReducer} + */ + function useReducer( + reducer: (prevState: S, ...args: A) => S, + initialArg: I, + init: (i: I) => S, + ): [S, ActionDispatch]; + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T): RefObject; + // convenience overload for refs given as a ref prop as they typically start with a null value + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T | null): RefObject; + // convenience overload for undefined initialValue + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T | undefined): RefObject; + /** + * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. + * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside + * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint. + * + * Prefer the standard `useEffect` when possible to avoid blocking visual updates. + * + * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as + * `componentDidMount` and `componentDidUpdate`. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useLayoutEffect} + */ + function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void; + /** + * Accepts a function that contains imperative, possibly effectful code. + * + * @param effect Imperative function that can return a cleanup function + * @param deps If present, effect will only activate if the values in the list change. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useEffect} + */ + function useEffect(effect: EffectCallback, deps?: DependencyList): void; + /** + * @see {@link https://react.dev/reference/react/useEffectEvent `useEffectEvent()` documentation} + * @version 19.2.0 + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + export function useEffectEvent(callback: T): T; + // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref + /** + * `useImperativeHandle` customizes the instance value that is exposed to parent components when using + * `ref`. As always, imperative code using refs should be avoided in most cases. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useImperativeHandle} + */ + function useImperativeHandle(ref: Ref | undefined, init: () => R, deps?: DependencyList): void; + // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key + // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y. + /** + * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs` + * has changed. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useCallback} + */ + // A specific function type would not trigger implicit any. + // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types. + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + function useCallback(callback: T, deps: DependencyList): T; + /** + * `useMemo` will only recompute the memoized value when one of the `deps` has changed. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useMemo} + */ + // allow undefined, but don't make it optional as that is very likely a mistake + function useMemo(factory: () => T, deps: DependencyList): T; + /** + * `useDebugValue` can be used to display a label for custom hooks in React DevTools. + * + * NOTE: We don’t recommend adding debug values to every custom hook. + * It’s most valuable for custom hooks that are part of shared libraries. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useDebugValue} + */ + // the name of the custom hook is itself derived from the function name at runtime: + // it's just the function name without the "use" prefix. + function useDebugValue(value: T, format?: (value: T) => any): void; + + export type TransitionFunction = () => VoidOrUndefinedOnly | Promise; + // strange definition to allow vscode to show documentation on the invocation + export interface TransitionStartFunction { + /** + * State updates caused inside the callback are allowed to be deferred. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @param callback A function which causes state updates that can be deferred. + */ + (callback: TransitionFunction): void; + } + + /** + * Returns a deferred version of the value that may “lag behind” it. + * + * This is commonly used to keep the interface responsive when you have something that renders immediately + * based on user input and something that needs to wait for a data fetch. + * + * A good example of this is a text input. + * + * @param value The value that is going to be deferred + * @param initialValue A value to use during the initial render of a component. If this option is omitted, `useDeferredValue` will not defer during the initial render, because there’s no previous version of `value` that it can render instead. + * + * @see {@link https://react.dev/reference/react/useDeferredValue} + */ + export function useDeferredValue(value: T, initialValue?: T): T; + + /** + * Allows components to avoid undesirable loading states by waiting for content to load + * before transitioning to the next screen. It also allows components to defer slower, + * data fetching updates until subsequent renders so that more crucial updates can be + * rendered immediately. + * + * The `useTransition` hook returns two values in an array. + * + * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish. + * The second is a function that takes a callback. We can use it to tell React which state we want to defer. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @see {@link https://react.dev/reference/react/useTransition} + */ + export function useTransition(): [boolean, TransitionStartFunction]; + + /** + * Similar to `useTransition` but allows uses where hooks are not available. + * + * @param callback A function which causes state updates that can be deferred. + */ + export function startTransition(scope: TransitionFunction): void; + + /** + * Wrap any code rendering and triggering updates to your components into `act()` calls. + * + * Ensures that the behavior in your tests matches what happens in the browser + * more closely by executing pending `useEffect`s before returning. This also + * reduces the amount of re-renders done. + * + * @param callback A synchronous, void callback that will execute as a single, complete React commit. + * + * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks + */ + // NOTES + // - the order of these signatures matters - typescript will check the signatures in source order. + // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with + // `strictNullChecks: false`. + // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true` + // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. + export function act(callback: () => VoidOrUndefinedOnly): void; + export function act(callback: () => T | Promise): Promise; + + export function useId(): string; + + /** + * @param effect Imperative function that can return a cleanup function + * @param deps If present, effect will only activate if the values in the list change. + * + * @see {@link https://github.com/facebook/react/pull/21913} + */ + export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void; + + /** + * @param subscribe + * @param getSnapshot + * + * @see {@link https://github.com/reactwg/react-18/discussions/86} + */ + // keep in sync with `useSyncExternalStore` from `use-sync-external-store` + export function useSyncExternalStore( + subscribe: (onStoreChange: () => void) => () => void, + getSnapshot: () => Snapshot, + getServerSnapshot?: () => Snapshot, + ): Snapshot; + + export function useOptimistic( + passthrough: State, + ): [State, (action: State | ((pendingState: State) => State)) => void]; + export function useOptimistic( + passthrough: State, + reducer: (state: State, action: Action) => State, + ): [State, (action: Action) => void]; + + interface UntrackedReactPromise extends PromiseLike { + status?: void; + } + + export interface PendingReactPromise extends PromiseLike { + status: "pending"; + } + + export interface FulfilledReactPromise extends PromiseLike { + status: "fulfilled"; + value: T; + } + + export interface RejectedReactPromise extends PromiseLike { + status: "rejected"; + reason: unknown; + } + + export type ReactPromise = + | UntrackedReactPromise + | PendingReactPromise + | FulfilledReactPromise + | RejectedReactPromise; + + export type Usable = ReactPromise | Context; + + export function use(usable: Usable): T; + + export function useActionState( + action: (state: Awaited) => State | Promise, + initialState: Awaited, + permalink?: string, + ): [state: Awaited, dispatch: () => void, isPending: boolean]; + export function useActionState( + action: (state: Awaited, payload: Payload) => State | Promise, + initialState: Awaited, + permalink?: string, + ): [state: Awaited, dispatch: (payload: Payload) => void, isPending: boolean]; + + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + export function cache(fn: CachedFunction): CachedFunction; + + export interface CacheSignal {} + /** + * @version 19.2.0 + */ + export function cacheSignal(): null | CacheSignal; + + export interface ActivityProps { + /** + * @default "visible" + */ + mode?: + | "hidden" + | "visible" + | undefined; + /** + * A name for this Activity boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; + children: ReactNode; + } + + /** + * @see {@link https://react.dev/reference/react/Activity `` documentation} + * @version 19.2.0 + */ + export const Activity: ExoticComponent; + + /** + * Warning: Only available in development builds. + * + * @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs} + * @version 19.1.0 + */ + function captureOwnerStack(): string | null; + + // + // Event System + // ---------------------------------------------------------------------- + // TODO: change any to unknown when moving to TS v3 + interface BaseSyntheticEvent { + nativeEvent: E; + currentTarget: C; + target: T; + bubbles: boolean; + cancelable: boolean; + defaultPrevented: boolean; + eventPhase: number; + isTrusted: boolean; + preventDefault(): void; + isDefaultPrevented(): boolean; + stopPropagation(): void; + isPropagationStopped(): boolean; + persist(): void; + timeStamp: number; + type: string; + } + + /** + * currentTarget - a reference to the element on which the event listener is registered. + * + * target - a reference to the element from which the event was originally dispatched. + * This might be a child element to the element on which the event listener is registered. + * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 + */ + interface SyntheticEvent extends BaseSyntheticEvent {} + + interface ClipboardEvent extends SyntheticEvent { + clipboardData: DataTransfer; + } + + interface CompositionEvent extends SyntheticEvent { + data: string; + } + + interface DragEvent extends MouseEvent { + dataTransfer: DataTransfer; + } + + interface PointerEvent extends MouseEvent { + pointerId: number; + pressure: number; + tangentialPressure: number; + tiltX: number; + tiltY: number; + twist: number; + width: number; + height: number; + pointerType: "mouse" | "pen" | "touch"; + isPrimary: boolean; + } + + interface FocusEvent extends SyntheticEvent { + relatedTarget: (EventTarget & RelatedTarget) | null; + target: EventTarget & Target; + } + + interface FormEvent extends SyntheticEvent { + } + + interface InvalidEvent extends SyntheticEvent { + target: EventTarget & T; + } + + interface ChangeEvent extends SyntheticEvent { + target: EventTarget & T; + } + + interface InputEvent extends SyntheticEvent { + data: string; + } + + export type ModifierKey = + | "Alt" + | "AltGraph" + | "CapsLock" + | "Control" + | "Fn" + | "FnLock" + | "Hyper" + | "Meta" + | "NumLock" + | "ScrollLock" + | "Shift" + | "Super" + | "Symbol" + | "SymbolLock"; + + interface KeyboardEvent extends UIEvent { + altKey: boolean; + /** @deprecated */ + charCode: number; + ctrlKey: boolean; + code: string; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + /** + * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values + */ + key: string; + /** @deprecated */ + keyCode: number; + locale: string; + location: number; + metaKey: boolean; + repeat: boolean; + shiftKey: boolean; + /** @deprecated */ + which: number; + } + + interface MouseEvent extends UIEvent { + altKey: boolean; + button: number; + buttons: number; + clientX: number; + clientY: number; + ctrlKey: boolean; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + metaKey: boolean; + movementX: number; + movementY: number; + pageX: number; + pageY: number; + relatedTarget: EventTarget | null; + screenX: number; + screenY: number; + shiftKey: boolean; + } + + interface TouchEvent extends UIEvent { + altKey: boolean; + changedTouches: TouchList; + ctrlKey: boolean; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + metaKey: boolean; + shiftKey: boolean; + targetTouches: TouchList; + touches: TouchList; + } + + interface UIEvent extends SyntheticEvent { + detail: number; + view: AbstractView; + } + + interface WheelEvent extends MouseEvent { + deltaMode: number; + deltaX: number; + deltaY: number; + deltaZ: number; + } + + interface AnimationEvent extends SyntheticEvent { + animationName: string; + elapsedTime: number; + pseudoElement: string; + } + + interface ToggleEvent extends SyntheticEvent { + oldState: "closed" | "open"; + newState: "closed" | "open"; + } + + interface TransitionEvent extends SyntheticEvent { + elapsedTime: number; + propertyName: string; + pseudoElement: string; + } + + // + // Event Handler Types + // ---------------------------------------------------------------------- + + type EventHandler> = { bivarianceHack(event: E): void }["bivarianceHack"]; + + type ReactEventHandler = EventHandler>; + + type ClipboardEventHandler = EventHandler>; + type CompositionEventHandler = EventHandler>; + type DragEventHandler = EventHandler>; + type FocusEventHandler = EventHandler>; + type FormEventHandler = EventHandler>; + type ChangeEventHandler = EventHandler>; + type InputEventHandler = EventHandler>; + type KeyboardEventHandler = EventHandler>; + type MouseEventHandler = EventHandler>; + type TouchEventHandler = EventHandler>; + type PointerEventHandler = EventHandler>; + type UIEventHandler = EventHandler>; + type WheelEventHandler = EventHandler>; + type AnimationEventHandler = EventHandler>; + type ToggleEventHandler = EventHandler>; + type TransitionEventHandler = EventHandler>; + + // + // Props / DOM Attributes + // ---------------------------------------------------------------------- + + interface HTMLProps extends AllHTMLAttributes, ClassAttributes { + } + + type DetailedHTMLProps, T> = ClassAttributes & E; + + interface SVGProps extends SVGAttributes, ClassAttributes { + } + + interface SVGLineElementAttributes extends SVGProps {} + interface SVGTextElementAttributes extends SVGProps {} + + interface DOMAttributes { + children?: ReactNode | undefined; + dangerouslySetInnerHTML?: { + // Should be InnerHTML['innerHTML']. + // But unfortunately we're mixing renderer-specific type declarations. + __html: string | TrustedHTML; + } | undefined; + + // Clipboard Events + onCopy?: ClipboardEventHandler | undefined; + onCopyCapture?: ClipboardEventHandler | undefined; + onCut?: ClipboardEventHandler | undefined; + onCutCapture?: ClipboardEventHandler | undefined; + onPaste?: ClipboardEventHandler | undefined; + onPasteCapture?: ClipboardEventHandler | undefined; + + // Composition Events + onCompositionEnd?: CompositionEventHandler | undefined; + onCompositionEndCapture?: CompositionEventHandler | undefined; + onCompositionStart?: CompositionEventHandler | undefined; + onCompositionStartCapture?: CompositionEventHandler | undefined; + onCompositionUpdate?: CompositionEventHandler | undefined; + onCompositionUpdateCapture?: CompositionEventHandler | undefined; + + // Focus Events + onFocus?: FocusEventHandler | undefined; + onFocusCapture?: FocusEventHandler | undefined; + onBlur?: FocusEventHandler | undefined; + onBlurCapture?: FocusEventHandler | undefined; + + // Form Events + onChange?: FormEventHandler | undefined; + onChangeCapture?: FormEventHandler | undefined; + onBeforeInput?: InputEventHandler | undefined; + onBeforeInputCapture?: FormEventHandler | undefined; + onInput?: FormEventHandler | undefined; + onInputCapture?: FormEventHandler | undefined; + onReset?: FormEventHandler | undefined; + onResetCapture?: FormEventHandler | undefined; + onSubmit?: FormEventHandler | undefined; + onSubmitCapture?: FormEventHandler | undefined; + onInvalid?: FormEventHandler | undefined; + onInvalidCapture?: FormEventHandler | undefined; + + // Image Events + onLoad?: ReactEventHandler | undefined; + onLoadCapture?: ReactEventHandler | undefined; + onError?: ReactEventHandler | undefined; // also a Media Event + onErrorCapture?: ReactEventHandler | undefined; // also a Media Event + + // Keyboard Events + onKeyDown?: KeyboardEventHandler | undefined; + onKeyDownCapture?: KeyboardEventHandler | undefined; + /** @deprecated Use `onKeyUp` or `onKeyDown` instead */ + onKeyPress?: KeyboardEventHandler | undefined; + /** @deprecated Use `onKeyUpCapture` or `onKeyDownCapture` instead */ + onKeyPressCapture?: KeyboardEventHandler | undefined; + onKeyUp?: KeyboardEventHandler | undefined; + onKeyUpCapture?: KeyboardEventHandler | undefined; + + // Media Events + onAbort?: ReactEventHandler | undefined; + onAbortCapture?: ReactEventHandler | undefined; + onCanPlay?: ReactEventHandler | undefined; + onCanPlayCapture?: ReactEventHandler | undefined; + onCanPlayThrough?: ReactEventHandler | undefined; + onCanPlayThroughCapture?: ReactEventHandler | undefined; + onDurationChange?: ReactEventHandler | undefined; + onDurationChangeCapture?: ReactEventHandler | undefined; + onEmptied?: ReactEventHandler | undefined; + onEmptiedCapture?: ReactEventHandler | undefined; + onEncrypted?: ReactEventHandler | undefined; + onEncryptedCapture?: ReactEventHandler | undefined; + onEnded?: ReactEventHandler | undefined; + onEndedCapture?: ReactEventHandler | undefined; + onLoadedData?: ReactEventHandler | undefined; + onLoadedDataCapture?: ReactEventHandler | undefined; + onLoadedMetadata?: ReactEventHandler | undefined; + onLoadedMetadataCapture?: ReactEventHandler | undefined; + onLoadStart?: ReactEventHandler | undefined; + onLoadStartCapture?: ReactEventHandler | undefined; + onPause?: ReactEventHandler | undefined; + onPauseCapture?: ReactEventHandler | undefined; + onPlay?: ReactEventHandler | undefined; + onPlayCapture?: ReactEventHandler | undefined; + onPlaying?: ReactEventHandler | undefined; + onPlayingCapture?: ReactEventHandler | undefined; + onProgress?: ReactEventHandler | undefined; + onProgressCapture?: ReactEventHandler | undefined; + onRateChange?: ReactEventHandler | undefined; + onRateChangeCapture?: ReactEventHandler | undefined; + onSeeked?: ReactEventHandler | undefined; + onSeekedCapture?: ReactEventHandler | undefined; + onSeeking?: ReactEventHandler | undefined; + onSeekingCapture?: ReactEventHandler | undefined; + onStalled?: ReactEventHandler | undefined; + onStalledCapture?: ReactEventHandler | undefined; + onSuspend?: ReactEventHandler | undefined; + onSuspendCapture?: ReactEventHandler | undefined; + onTimeUpdate?: ReactEventHandler | undefined; + onTimeUpdateCapture?: ReactEventHandler | undefined; + onVolumeChange?: ReactEventHandler | undefined; + onVolumeChangeCapture?: ReactEventHandler | undefined; + onWaiting?: ReactEventHandler | undefined; + onWaitingCapture?: ReactEventHandler | undefined; + + // MouseEvents + onAuxClick?: MouseEventHandler | undefined; + onAuxClickCapture?: MouseEventHandler | undefined; + onClick?: MouseEventHandler | undefined; + onClickCapture?: MouseEventHandler | undefined; + onContextMenu?: MouseEventHandler | undefined; + onContextMenuCapture?: MouseEventHandler | undefined; + onDoubleClick?: MouseEventHandler | undefined; + onDoubleClickCapture?: MouseEventHandler | undefined; + onDrag?: DragEventHandler | undefined; + onDragCapture?: DragEventHandler | undefined; + onDragEnd?: DragEventHandler | undefined; + onDragEndCapture?: DragEventHandler | undefined; + onDragEnter?: DragEventHandler | undefined; + onDragEnterCapture?: DragEventHandler | undefined; + onDragExit?: DragEventHandler | undefined; + onDragExitCapture?: DragEventHandler | undefined; + onDragLeave?: DragEventHandler | undefined; + onDragLeaveCapture?: DragEventHandler | undefined; + onDragOver?: DragEventHandler | undefined; + onDragOverCapture?: DragEventHandler | undefined; + onDragStart?: DragEventHandler | undefined; + onDragStartCapture?: DragEventHandler | undefined; + onDrop?: DragEventHandler | undefined; + onDropCapture?: DragEventHandler | undefined; + onMouseDown?: MouseEventHandler | undefined; + onMouseDownCapture?: MouseEventHandler | undefined; + onMouseEnter?: MouseEventHandler | undefined; + onMouseLeave?: MouseEventHandler | undefined; + onMouseMove?: MouseEventHandler | undefined; + onMouseMoveCapture?: MouseEventHandler | undefined; + onMouseOut?: MouseEventHandler | undefined; + onMouseOutCapture?: MouseEventHandler | undefined; + onMouseOver?: MouseEventHandler | undefined; + onMouseOverCapture?: MouseEventHandler | undefined; + onMouseUp?: MouseEventHandler | undefined; + onMouseUpCapture?: MouseEventHandler | undefined; + + // Selection Events + onSelect?: ReactEventHandler | undefined; + onSelectCapture?: ReactEventHandler | undefined; + + // Touch Events + onTouchCancel?: TouchEventHandler | undefined; + onTouchCancelCapture?: TouchEventHandler | undefined; + onTouchEnd?: TouchEventHandler | undefined; + onTouchEndCapture?: TouchEventHandler | undefined; + onTouchMove?: TouchEventHandler | undefined; + onTouchMoveCapture?: TouchEventHandler | undefined; + onTouchStart?: TouchEventHandler | undefined; + onTouchStartCapture?: TouchEventHandler | undefined; + + // Pointer Events + onPointerDown?: PointerEventHandler | undefined; + onPointerDownCapture?: PointerEventHandler | undefined; + onPointerMove?: PointerEventHandler | undefined; + onPointerMoveCapture?: PointerEventHandler | undefined; + onPointerUp?: PointerEventHandler | undefined; + onPointerUpCapture?: PointerEventHandler | undefined; + onPointerCancel?: PointerEventHandler | undefined; + onPointerCancelCapture?: PointerEventHandler | undefined; + onPointerEnter?: PointerEventHandler | undefined; + onPointerLeave?: PointerEventHandler | undefined; + onPointerOver?: PointerEventHandler | undefined; + onPointerOverCapture?: PointerEventHandler | undefined; + onPointerOut?: PointerEventHandler | undefined; + onPointerOutCapture?: PointerEventHandler | undefined; + onGotPointerCapture?: PointerEventHandler | undefined; + onGotPointerCaptureCapture?: PointerEventHandler | undefined; + onLostPointerCapture?: PointerEventHandler | undefined; + onLostPointerCaptureCapture?: PointerEventHandler | undefined; + + // UI Events + onScroll?: UIEventHandler | undefined; + onScrollCapture?: UIEventHandler | undefined; + onScrollEnd?: UIEventHandler | undefined; + onScrollEndCapture?: UIEventHandler | undefined; + + // Wheel Events + onWheel?: WheelEventHandler | undefined; + onWheelCapture?: WheelEventHandler | undefined; + + // Animation Events + onAnimationStart?: AnimationEventHandler | undefined; + onAnimationStartCapture?: AnimationEventHandler | undefined; + onAnimationEnd?: AnimationEventHandler | undefined; + onAnimationEndCapture?: AnimationEventHandler | undefined; + onAnimationIteration?: AnimationEventHandler | undefined; + onAnimationIterationCapture?: AnimationEventHandler | undefined; + + // Toggle Events + onToggle?: ToggleEventHandler | undefined; + onBeforeToggle?: ToggleEventHandler | undefined; + + // Transition Events + onTransitionCancel?: TransitionEventHandler | undefined; + onTransitionCancelCapture?: TransitionEventHandler | undefined; + onTransitionEnd?: TransitionEventHandler | undefined; + onTransitionEndCapture?: TransitionEventHandler | undefined; + onTransitionRun?: TransitionEventHandler | undefined; + onTransitionRunCapture?: TransitionEventHandler | undefined; + onTransitionStart?: TransitionEventHandler | undefined; + onTransitionStartCapture?: TransitionEventHandler | undefined; + } + + export interface CSSProperties extends CSS.Properties { + /** + * The index signature was removed to enable closed typing for style + * using CSSType. You're able to use type assertion or module augmentation + * to add properties or an index signature of your own. + * + * For examples and more information, visit: + * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors + */ + } + + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ + interface AriaAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + "aria-activedescendant"?: string | undefined; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + "aria-atomic"?: Booleanish | undefined; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + /** + * Defines a string value that labels the current element, which is intended to be converted into Braille. + * @see aria-label. + */ + "aria-braillelabel"?: string | undefined; + /** + * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. + * @see aria-roledescription. + */ + "aria-brailleroledescription"?: string | undefined; + "aria-busy"?: Booleanish | undefined; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + "aria-colcount"?: number | undefined; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + "aria-colindex"?: number | undefined; + /** + * Defines a human readable text alternative of aria-colindex. + * @see aria-rowindextext. + */ + "aria-colindextext"?: string | undefined; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + "aria-colspan"?: number | undefined; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + "aria-controls"?: string | undefined; + /** Indicates the element that represents the current item within a container or set of related elements. */ + "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + "aria-describedby"?: string | undefined; + /** + * Defines a string value that describes or annotates the current element. + * @see related aria-describedby. + */ + "aria-description"?: string | undefined; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + "aria-details"?: string | undefined; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + "aria-disabled"?: Booleanish | undefined; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + "aria-errormessage"?: string | undefined; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + "aria-expanded"?: Booleanish | undefined; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + "aria-flowto"?: string | undefined; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + "aria-grabbed"?: Booleanish | undefined; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + "aria-hidden"?: Booleanish | undefined; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + "aria-keyshortcuts"?: string | undefined; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + "aria-label"?: string | undefined; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + "aria-labelledby"?: string | undefined; + /** Defines the hierarchical level of an element within a structure. */ + "aria-level"?: number | undefined; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + "aria-live"?: "off" | "assertive" | "polite" | undefined; + /** Indicates whether an element is modal when displayed. */ + "aria-modal"?: Booleanish | undefined; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + "aria-multiline"?: Booleanish | undefined; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + "aria-multiselectable"?: Booleanish | undefined; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + "aria-orientation"?: "horizontal" | "vertical" | undefined; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + "aria-owns"?: string | undefined; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + "aria-placeholder"?: string | undefined; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + "aria-posinset"?: number | undefined; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + "aria-readonly"?: Booleanish | undefined; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + "aria-relevant"?: + | "additions" + | "additions removals" + | "additions text" + | "all" + | "removals" + | "removals additions" + | "removals text" + | "text" + | "text additions" + | "text removals" + | undefined; + /** Indicates that user input is required on the element before a form may be submitted. */ + "aria-required"?: Booleanish | undefined; + /** Defines a human-readable, author-localized description for the role of an element. */ + "aria-roledescription"?: string | undefined; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + "aria-rowcount"?: number | undefined; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + "aria-rowindex"?: number | undefined; + /** + * Defines a human readable text alternative of aria-rowindex. + * @see aria-colindextext. + */ + "aria-rowindextext"?: string | undefined; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + "aria-rowspan"?: number | undefined; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + "aria-selected"?: Booleanish | undefined; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + "aria-setsize"?: number | undefined; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; + /** Defines the maximum allowed value for a range widget. */ + "aria-valuemax"?: number | undefined; + /** Defines the minimum allowed value for a range widget. */ + "aria-valuemin"?: number | undefined; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + "aria-valuenow"?: number | undefined; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + "aria-valuetext"?: string | undefined; + } + + // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions + type AriaRole = + | "alert" + | "alertdialog" + | "application" + | "article" + | "banner" + | "button" + | "cell" + | "checkbox" + | "columnheader" + | "combobox" + | "complementary" + | "contentinfo" + | "definition" + | "dialog" + | "directory" + | "document" + | "feed" + | "figure" + | "form" + | "grid" + | "gridcell" + | "group" + | "heading" + | "img" + | "link" + | "list" + | "listbox" + | "listitem" + | "log" + | "main" + | "marquee" + | "math" + | "menu" + | "menubar" + | "menuitem" + | "menuitemcheckbox" + | "menuitemradio" + | "navigation" + | "none" + | "note" + | "option" + | "presentation" + | "progressbar" + | "radio" + | "radiogroup" + | "region" + | "row" + | "rowgroup" + | "rowheader" + | "scrollbar" + | "search" + | "searchbox" + | "separator" + | "slider" + | "spinbutton" + | "status" + | "switch" + | "tab" + | "table" + | "tablist" + | "tabpanel" + | "term" + | "textbox" + | "timer" + | "toolbar" + | "tooltip" + | "tree" + | "treegrid" + | "treeitem" + | (string & {}); + + interface HTMLAttributes extends AriaAttributes, DOMAttributes { + // React-specific Attributes + defaultChecked?: boolean | undefined; + defaultValue?: string | number | readonly string[] | undefined; + suppressContentEditableWarning?: boolean | undefined; + suppressHydrationWarning?: boolean | undefined; + + // Standard HTML Attributes + accessKey?: string | undefined; + autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}); + autoFocus?: boolean | undefined; + className?: string | undefined; + contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined; + contextMenu?: string | undefined; + dir?: string | undefined; + draggable?: Booleanish | undefined; + enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; + hidden?: boolean | undefined; + id?: string | undefined; + lang?: string | undefined; + nonce?: string | undefined; + slot?: string | undefined; + spellCheck?: Booleanish | undefined; + style?: CSSProperties | undefined; + tabIndex?: number | undefined; + title?: string | undefined; + translate?: "yes" | "no" | undefined; + + // Unknown + radioGroup?: string | undefined; // , + + // WAI-ARIA + role?: AriaRole | undefined; + + // RDFa Attributes + about?: string | undefined; + content?: string | undefined; + datatype?: string | undefined; + inlist?: any; + prefix?: string | undefined; + property?: string | undefined; + rel?: string | undefined; + resource?: string | undefined; + rev?: string | undefined; + typeof?: string | undefined; + vocab?: string | undefined; + + // Non-standard Attributes + autoCorrect?: string | undefined; + autoSave?: string | undefined; + color?: string | undefined; + itemProp?: string | undefined; + itemScope?: boolean | undefined; + itemType?: string | undefined; + itemID?: string | undefined; + itemRef?: string | undefined; + results?: number | undefined; + security?: string | undefined; + unselectable?: "on" | "off" | undefined; + + // Popover API + popover?: "" | "auto" | "manual" | "hint" | undefined; + popoverTargetAction?: "toggle" | "show" | "hide" | undefined; + popoverTarget?: string | undefined; + + // Living Standard + /** + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert + */ + inert?: boolean | undefined; + /** + * Hints at the type of data that might be entered by the user while editing the element or its contents + * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute} + */ + inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; + /** + * Specify that a standard HTML element should behave like a defined custom built-in element + * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is} + */ + is?: string | undefined; + /** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts} + */ + exportparts?: string | undefined; + /** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part} + */ + part?: string | undefined; + } + + /** + * For internal usage only. + * Different release channels declare additional types of ReactNode this particular release channel accepts. + * App or library types should never augment this interface. + */ + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {} + + interface AllHTMLAttributes extends HTMLAttributes { + // Standard HTML Attributes + accept?: string | undefined; + acceptCharset?: string | undefined; + action?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + allowFullScreen?: boolean | undefined; + allowTransparency?: boolean | undefined; + alt?: string | undefined; + as?: string | undefined; + async?: boolean | undefined; + autoComplete?: string | undefined; + autoPlay?: boolean | undefined; + capture?: boolean | "user" | "environment" | undefined; + cellPadding?: number | string | undefined; + cellSpacing?: number | string | undefined; + charSet?: string | undefined; + challenge?: string | undefined; + checked?: boolean | undefined; + cite?: string | undefined; + classID?: string | undefined; + cols?: number | undefined; + colSpan?: number | undefined; + controls?: boolean | undefined; + coords?: string | undefined; + crossOrigin?: CrossOrigin; + data?: string | undefined; + dateTime?: string | undefined; + default?: boolean | undefined; + defer?: boolean | undefined; + disabled?: boolean | undefined; + download?: any; + encType?: string | undefined; + form?: string | undefined; + formAction?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + frameBorder?: number | string | undefined; + headers?: string | undefined; + height?: number | string | undefined; + high?: number | undefined; + href?: string | undefined; + hrefLang?: string | undefined; + htmlFor?: string | undefined; + httpEquiv?: string | undefined; + integrity?: string | undefined; + keyParams?: string | undefined; + keyType?: string | undefined; + kind?: string | undefined; + label?: string | undefined; + list?: string | undefined; + loop?: boolean | undefined; + low?: number | undefined; + manifest?: string | undefined; + marginHeight?: number | undefined; + marginWidth?: number | undefined; + max?: number | string | undefined; + maxLength?: number | undefined; + media?: string | undefined; + mediaGroup?: string | undefined; + method?: string | undefined; + min?: number | string | undefined; + minLength?: number | undefined; + multiple?: boolean | undefined; + muted?: boolean | undefined; + name?: string | undefined; + noValidate?: boolean | undefined; + open?: boolean | undefined; + optimum?: number | undefined; + pattern?: string | undefined; + placeholder?: string | undefined; + playsInline?: boolean | undefined; + poster?: string | undefined; + preload?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + reversed?: boolean | undefined; + rows?: number | undefined; + rowSpan?: number | undefined; + sandbox?: string | undefined; + scope?: string | undefined; + scoped?: boolean | undefined; + scrolling?: string | undefined; + seamless?: boolean | undefined; + selected?: boolean | undefined; + shape?: string | undefined; + size?: number | undefined; + sizes?: string | undefined; + span?: number | undefined; + src?: string | undefined; + srcDoc?: string | undefined; + srcLang?: string | undefined; + srcSet?: string | undefined; + start?: number | undefined; + step?: number | string | undefined; + summary?: string | undefined; + target?: string | undefined; + type?: string | undefined; + useMap?: string | undefined; + value?: string | readonly string[] | number | undefined; + width?: number | string | undefined; + wmode?: string | undefined; + wrap?: string | undefined; + } + + type HTMLAttributeReferrerPolicy = + | "" + | "no-referrer" + | "no-referrer-when-downgrade" + | "origin" + | "origin-when-cross-origin" + | "same-origin" + | "strict-origin" + | "strict-origin-when-cross-origin" + | "unsafe-url"; + + type HTMLAttributeAnchorTarget = + | "_self" + | "_blank" + | "_parent" + | "_top" + | (string & {}); + + interface AnchorHTMLAttributes extends HTMLAttributes { + download?: any; + href?: string | undefined; + hrefLang?: string | undefined; + media?: string | undefined; + ping?: string | undefined; + target?: HTMLAttributeAnchorTarget | undefined; + type?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + } + + interface AudioHTMLAttributes extends MediaHTMLAttributes {} + + interface AreaHTMLAttributes extends HTMLAttributes { + alt?: string | undefined; + coords?: string | undefined; + download?: any; + href?: string | undefined; + hrefLang?: string | undefined; + media?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + shape?: string | undefined; + target?: string | undefined; + } + + interface BaseHTMLAttributes extends HTMLAttributes { + href?: string | undefined; + target?: string | undefined; + } + + interface BlockquoteHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + } + + interface ButtonHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + form?: string | undefined; + formAction?: + | string + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ] + | undefined; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + name?: string | undefined; + type?: "submit" | "reset" | "button" | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface CanvasHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + width?: number | string | undefined; + } + + interface ColHTMLAttributes extends HTMLAttributes { + span?: number | undefined; + width?: number | string | undefined; + } + + interface ColgroupHTMLAttributes extends HTMLAttributes { + span?: number | undefined; + } + + interface DataHTMLAttributes extends HTMLAttributes { + value?: string | readonly string[] | number | undefined; + } + + interface DetailsHTMLAttributes extends HTMLAttributes { + open?: boolean | undefined; + name?: string | undefined; + } + + interface DelHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + dateTime?: string | undefined; + } + + interface DialogHTMLAttributes extends HTMLAttributes { + closedby?: "any" | "closerequest" | "none" | undefined; + onCancel?: ReactEventHandler | undefined; + onClose?: ReactEventHandler | undefined; + open?: boolean | undefined; + } + + interface EmbedHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + src?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + } + + interface FieldsetHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + form?: string | undefined; + name?: string | undefined; + } + + interface FormHTMLAttributes extends HTMLAttributes { + acceptCharset?: string | undefined; + action?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + autoComplete?: string | undefined; + encType?: string | undefined; + method?: string | undefined; + name?: string | undefined; + noValidate?: boolean | undefined; + target?: string | undefined; + } + + interface HtmlHTMLAttributes extends HTMLAttributes { + manifest?: string | undefined; + } + + interface IframeHTMLAttributes extends HTMLAttributes { + allow?: string | undefined; + allowFullScreen?: boolean | undefined; + allowTransparency?: boolean | undefined; + /** @deprecated */ + frameBorder?: number | string | undefined; + height?: number | string | undefined; + loading?: "eager" | "lazy" | undefined; + /** @deprecated */ + marginHeight?: number | undefined; + /** @deprecated */ + marginWidth?: number | undefined; + name?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sandbox?: string | undefined; + /** @deprecated */ + scrolling?: string | undefined; + seamless?: boolean | undefined; + src?: string | undefined; + srcDoc?: string | undefined; + width?: number | string | undefined; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {} + + interface ImgHTMLAttributes extends HTMLAttributes { + alt?: string | undefined; + crossOrigin?: CrossOrigin; + decoding?: "async" | "auto" | "sync" | undefined; + fetchPriority?: "high" | "low" | "auto"; + height?: number | string | undefined; + loading?: "eager" | "lazy" | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sizes?: string | undefined; + src?: + | string + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES + ] + | undefined; + srcSet?: string | undefined; + useMap?: string | undefined; + width?: number | string | undefined; + } + + interface InsHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + dateTime?: string | undefined; + } + + type HTMLInputTypeAttribute = + | "button" + | "checkbox" + | "color" + | "date" + | "datetime-local" + | "email" + | "file" + | "hidden" + | "image" + | "month" + | "number" + | "password" + | "radio" + | "range" + | "reset" + | "search" + | "submit" + | "tel" + | "text" + | "time" + | "url" + | "week" + | (string & {}); + + type AutoFillAddressKind = "billing" | "shipping"; + type AutoFillBase = "" | "off" | "on"; + type AutoFillContactField = + | "email" + | "tel" + | "tel-area-code" + | "tel-country-code" + | "tel-extension" + | "tel-local" + | "tel-local-prefix" + | "tel-local-suffix" + | "tel-national"; + type AutoFillContactKind = "home" | "mobile" | "work"; + type AutoFillCredentialField = "webauthn"; + type AutoFillNormalField = + | "additional-name" + | "address-level1" + | "address-level2" + | "address-level3" + | "address-level4" + | "address-line1" + | "address-line2" + | "address-line3" + | "bday-day" + | "bday-month" + | "bday-year" + | "cc-csc" + | "cc-exp" + | "cc-exp-month" + | "cc-exp-year" + | "cc-family-name" + | "cc-given-name" + | "cc-name" + | "cc-number" + | "cc-type" + | "country" + | "country-name" + | "current-password" + | "family-name" + | "given-name" + | "honorific-prefix" + | "honorific-suffix" + | "name" + | "new-password" + | "one-time-code" + | "organization" + | "postal-code" + | "street-address" + | "transaction-amount" + | "transaction-currency" + | "username"; + type OptionalPrefixToken = `${T} ` | ""; + type OptionalPostfixToken = ` ${T}` | ""; + type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken}${AutoFillContactField}`; + type AutoFillSection = `section-${string}`; + type AutoFill = + | AutoFillBase + | `${OptionalPrefixToken}${OptionalPrefixToken< + AutoFillAddressKind + >}${AutoFillField}${OptionalPostfixToken}`; + type HTMLInputAutoCompleteAttribute = AutoFill | (string & {}); + + interface InputHTMLAttributes extends HTMLAttributes { + accept?: string | undefined; + alt?: string | undefined; + autoComplete?: HTMLInputAutoCompleteAttribute | undefined; + capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute + checked?: boolean | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + formAction?: + | string + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ] + | undefined; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + height?: number | string | undefined; + list?: string | undefined; + max?: number | string | undefined; + maxLength?: number | undefined; + min?: number | string | undefined; + minLength?: number | undefined; + multiple?: boolean | undefined; + name?: string | undefined; + pattern?: string | undefined; + placeholder?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + size?: number | undefined; + src?: string | undefined; + step?: number | string | undefined; + type?: HTMLInputTypeAttribute | undefined; + value?: string | readonly string[] | number | undefined; + width?: number | string | undefined; + + onChange?: ChangeEventHandler | undefined; + } + + interface KeygenHTMLAttributes extends HTMLAttributes { + challenge?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + keyType?: string | undefined; + keyParams?: string | undefined; + name?: string | undefined; + } + + interface LabelHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + htmlFor?: string | undefined; + } + + interface LiHTMLAttributes extends HTMLAttributes { + value?: string | readonly string[] | number | undefined; + } + + interface LinkHTMLAttributes extends HTMLAttributes { + as?: string | undefined; + blocking?: "render" | (string & {}) | undefined; + crossOrigin?: CrossOrigin; + fetchPriority?: "high" | "low" | "auto"; + href?: string | undefined; + hrefLang?: string | undefined; + integrity?: string | undefined; + media?: string | undefined; + imageSrcSet?: string | undefined; + imageSizes?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sizes?: string | undefined; + type?: string | undefined; + charSet?: string | undefined; + + // React props + precedence?: string | undefined; + } + + interface MapHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + } + + interface MenuHTMLAttributes extends HTMLAttributes { + type?: string | undefined; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {} + + interface MediaHTMLAttributes extends HTMLAttributes { + autoPlay?: boolean | undefined; + controls?: boolean | undefined; + controlsList?: string | undefined; + crossOrigin?: CrossOrigin; + loop?: boolean | undefined; + mediaGroup?: string | undefined; + muted?: boolean | undefined; + playsInline?: boolean | undefined; + preload?: string | undefined; + src?: + | string + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES + ] + | undefined; + } + + interface MetaHTMLAttributes extends HTMLAttributes { + charSet?: string | undefined; + content?: string | undefined; + httpEquiv?: string | undefined; + media?: string | undefined; + name?: string | undefined; + } + + interface MeterHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + high?: number | undefined; + low?: number | undefined; + max?: number | string | undefined; + min?: number | string | undefined; + optimum?: number | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface QuoteHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + } + + interface ObjectHTMLAttributes extends HTMLAttributes { + classID?: string | undefined; + data?: string | undefined; + form?: string | undefined; + height?: number | string | undefined; + name?: string | undefined; + type?: string | undefined; + useMap?: string | undefined; + width?: number | string | undefined; + wmode?: string | undefined; + } + + interface OlHTMLAttributes extends HTMLAttributes { + reversed?: boolean | undefined; + start?: number | undefined; + type?: "1" | "a" | "A" | "i" | "I" | undefined; + } + + interface OptgroupHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + label?: string | undefined; + } + + interface OptionHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + label?: string | undefined; + selected?: boolean | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface OutputHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + htmlFor?: string | undefined; + name?: string | undefined; + } + + interface ParamHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface ProgressHTMLAttributes extends HTMLAttributes { + max?: number | string | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface SlotHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + } + + interface ScriptHTMLAttributes extends HTMLAttributes { + async?: boolean | undefined; + blocking?: "render" | (string & {}) | undefined; + /** @deprecated */ + charSet?: string | undefined; + crossOrigin?: CrossOrigin; + defer?: boolean | undefined; + fetchPriority?: "high" | "low" | "auto" | undefined; + integrity?: string | undefined; + noModule?: boolean | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + src?: string | undefined; + type?: string | undefined; + } + + interface SelectHTMLAttributes extends HTMLAttributes { + autoComplete?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + multiple?: boolean | undefined; + name?: string | undefined; + required?: boolean | undefined; + size?: number | undefined; + value?: string | readonly string[] | number | undefined; + onChange?: ChangeEventHandler | undefined; + } + + interface SourceHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + media?: string | undefined; + sizes?: string | undefined; + src?: string | undefined; + srcSet?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + } + + interface StyleHTMLAttributes extends HTMLAttributes { + blocking?: "render" | (string & {}) | undefined; + media?: string | undefined; + scoped?: boolean | undefined; + type?: string | undefined; + + // React props + href?: string | undefined; + precedence?: string | undefined; + } + + interface TableHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | undefined; + bgcolor?: string | undefined; + border?: number | undefined; + cellPadding?: number | string | undefined; + cellSpacing?: number | string | undefined; + frame?: boolean | undefined; + rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined; + summary?: string | undefined; + width?: number | string | undefined; + } + + interface TextareaHTMLAttributes extends HTMLAttributes { + autoComplete?: string | undefined; + cols?: number | undefined; + dirName?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + maxLength?: number | undefined; + minLength?: number | undefined; + name?: string | undefined; + placeholder?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + rows?: number | undefined; + value?: string | readonly string[] | number | undefined; + wrap?: string | undefined; + + onChange?: ChangeEventHandler | undefined; + } + + interface TdHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | "justify" | "char" | undefined; + colSpan?: number | undefined; + headers?: string | undefined; + rowSpan?: number | undefined; + scope?: string | undefined; + abbr?: string | undefined; + height?: number | string | undefined; + width?: number | string | undefined; + valign?: "top" | "middle" | "bottom" | "baseline" | undefined; + } + + interface ThHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | "justify" | "char" | undefined; + colSpan?: number | undefined; + headers?: string | undefined; + rowSpan?: number | undefined; + scope?: string | undefined; + abbr?: string | undefined; + } + + interface TimeHTMLAttributes extends HTMLAttributes { + dateTime?: string | undefined; + } + + interface TrackHTMLAttributes extends HTMLAttributes { + default?: boolean | undefined; + kind?: string | undefined; + label?: string | undefined; + src?: string | undefined; + srcLang?: string | undefined; + } + + interface VideoHTMLAttributes extends MediaHTMLAttributes { + height?: number | string | undefined; + playsInline?: boolean | undefined; + poster?: string | undefined; + width?: number | string | undefined; + disablePictureInPicture?: boolean | undefined; + disableRemotePlayback?: boolean | undefined; + + onResize?: ReactEventHandler | undefined; + onResizeCapture?: ReactEventHandler | undefined; + } + + // this list is "complete" in that it contains every SVG attribute + // that React supports, but the types can be improved. + // Full list here: https://facebook.github.io/react/docs/dom-elements.html + // + // The three broad type categories are (in order of restrictiveness): + // - "number | string" + // - "string" + // - union of string literals + interface SVGAttributes extends AriaAttributes, DOMAttributes { + // React-specific Attributes + suppressHydrationWarning?: boolean | undefined; + + // Attributes which also defined in HTMLAttributes + // See comment in SVGDOMPropertyConfig.js + className?: string | undefined; + color?: string | undefined; + height?: number | string | undefined; + id?: string | undefined; + lang?: string | undefined; + max?: number | string | undefined; + media?: string | undefined; + method?: string | undefined; + min?: number | string | undefined; + name?: string | undefined; + style?: CSSProperties | undefined; + target?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + + // Other HTML properties supported by SVG elements in browsers + role?: AriaRole | undefined; + tabIndex?: number | undefined; + crossOrigin?: CrossOrigin; + + // SVG Specific attributes + accentHeight?: number | string | undefined; + accumulate?: "none" | "sum" | undefined; + additive?: "replace" | "sum" | undefined; + alignmentBaseline?: + | "auto" + | "baseline" + | "before-edge" + | "text-before-edge" + | "middle" + | "central" + | "after-edge" + | "text-after-edge" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "inherit" + | undefined; + allowReorder?: "no" | "yes" | undefined; + alphabetic?: number | string | undefined; + amplitude?: number | string | undefined; + arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined; + ascent?: number | string | undefined; + attributeName?: string | undefined; + attributeType?: string | undefined; + autoReverse?: Booleanish | undefined; + azimuth?: number | string | undefined; + baseFrequency?: number | string | undefined; + baselineShift?: number | string | undefined; + baseProfile?: number | string | undefined; + bbox?: number | string | undefined; + begin?: number | string | undefined; + bias?: number | string | undefined; + by?: number | string | undefined; + calcMode?: number | string | undefined; + capHeight?: number | string | undefined; + clip?: number | string | undefined; + clipPath?: string | undefined; + clipPathUnits?: number | string | undefined; + clipRule?: number | string | undefined; + colorInterpolation?: number | string | undefined; + colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined; + colorProfile?: number | string | undefined; + colorRendering?: number | string | undefined; + contentScriptType?: number | string | undefined; + contentStyleType?: number | string | undefined; + cursor?: number | string | undefined; + cx?: number | string | undefined; + cy?: number | string | undefined; + d?: string | undefined; + decelerate?: number | string | undefined; + descent?: number | string | undefined; + diffuseConstant?: number | string | undefined; + direction?: number | string | undefined; + display?: number | string | undefined; + divisor?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; + dur?: number | string | undefined; + dx?: number | string | undefined; + dy?: number | string | undefined; + edgeMode?: number | string | undefined; + elevation?: number | string | undefined; + enableBackground?: number | string | undefined; + end?: number | string | undefined; + exponent?: number | string | undefined; + externalResourcesRequired?: Booleanish | undefined; + fill?: string | undefined; + fillOpacity?: number | string | undefined; + fillRule?: "nonzero" | "evenodd" | "inherit" | undefined; + filter?: string | undefined; + filterRes?: number | string | undefined; + filterUnits?: number | string | undefined; + floodColor?: number | string | undefined; + floodOpacity?: number | string | undefined; + focusable?: Booleanish | "auto" | undefined; + fontFamily?: string | undefined; + fontSize?: number | string | undefined; + fontSizeAdjust?: number | string | undefined; + fontStretch?: number | string | undefined; + fontStyle?: number | string | undefined; + fontVariant?: number | string | undefined; + fontWeight?: number | string | undefined; + format?: number | string | undefined; + fr?: number | string | undefined; + from?: number | string | undefined; + fx?: number | string | undefined; + fy?: number | string | undefined; + g1?: number | string | undefined; + g2?: number | string | undefined; + glyphName?: number | string | undefined; + glyphOrientationHorizontal?: number | string | undefined; + glyphOrientationVertical?: number | string | undefined; + glyphRef?: number | string | undefined; + gradientTransform?: string | undefined; + gradientUnits?: string | undefined; + hanging?: number | string | undefined; + horizAdvX?: number | string | undefined; + horizOriginX?: number | string | undefined; + href?: string | undefined; + ideographic?: number | string | undefined; + imageRendering?: number | string | undefined; + in2?: number | string | undefined; + in?: string | undefined; + intercept?: number | string | undefined; + k1?: number | string | undefined; + k2?: number | string | undefined; + k3?: number | string | undefined; + k4?: number | string | undefined; + k?: number | string | undefined; + kernelMatrix?: number | string | undefined; + kernelUnitLength?: number | string | undefined; + kerning?: number | string | undefined; + keyPoints?: number | string | undefined; + keySplines?: number | string | undefined; + keyTimes?: number | string | undefined; + lengthAdjust?: number | string | undefined; + letterSpacing?: number | string | undefined; + lightingColor?: number | string | undefined; + limitingConeAngle?: number | string | undefined; + local?: number | string | undefined; + markerEnd?: string | undefined; + markerHeight?: number | string | undefined; + markerMid?: string | undefined; + markerStart?: string | undefined; + markerUnits?: number | string | undefined; + markerWidth?: number | string | undefined; + mask?: string | undefined; + maskContentUnits?: number | string | undefined; + maskUnits?: number | string | undefined; + mathematical?: number | string | undefined; + mode?: number | string | undefined; + numOctaves?: number | string | undefined; + offset?: number | string | undefined; + opacity?: number | string | undefined; + operator?: number | string | undefined; + order?: number | string | undefined; + orient?: number | string | undefined; + orientation?: number | string | undefined; + origin?: number | string | undefined; + overflow?: number | string | undefined; + overlinePosition?: number | string | undefined; + overlineThickness?: number | string | undefined; + paintOrder?: number | string | undefined; + panose1?: number | string | undefined; + path?: string | undefined; + pathLength?: number | string | undefined; + patternContentUnits?: string | undefined; + patternTransform?: number | string | undefined; + patternUnits?: string | undefined; + pointerEvents?: number | string | undefined; + points?: string | undefined; + pointsAtX?: number | string | undefined; + pointsAtY?: number | string | undefined; + pointsAtZ?: number | string | undefined; + preserveAlpha?: Booleanish | undefined; + preserveAspectRatio?: string | undefined; + primitiveUnits?: number | string | undefined; + r?: number | string | undefined; + radius?: number | string | undefined; + refX?: number | string | undefined; + refY?: number | string | undefined; + renderingIntent?: number | string | undefined; + repeatCount?: number | string | undefined; + repeatDur?: number | string | undefined; + requiredExtensions?: number | string | undefined; + requiredFeatures?: number | string | undefined; + restart?: number | string | undefined; + result?: string | undefined; + rotate?: number | string | undefined; + rx?: number | string | undefined; + ry?: number | string | undefined; + scale?: number | string | undefined; + seed?: number | string | undefined; + shapeRendering?: number | string | undefined; + slope?: number | string | undefined; + spacing?: number | string | undefined; + specularConstant?: number | string | undefined; + specularExponent?: number | string | undefined; + speed?: number | string | undefined; + spreadMethod?: string | undefined; + startOffset?: number | string | undefined; + stdDeviation?: number | string | undefined; + stemh?: number | string | undefined; + stemv?: number | string | undefined; + stitchTiles?: number | string | undefined; + stopColor?: string | undefined; + stopOpacity?: number | string | undefined; + strikethroughPosition?: number | string | undefined; + strikethroughThickness?: number | string | undefined; + string?: number | string | undefined; + stroke?: string | undefined; + strokeDasharray?: string | number | undefined; + strokeDashoffset?: string | number | undefined; + strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined; + strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined; + strokeMiterlimit?: number | string | undefined; + strokeOpacity?: number | string | undefined; + strokeWidth?: number | string | undefined; + surfaceScale?: number | string | undefined; + systemLanguage?: number | string | undefined; + tableValues?: number | string | undefined; + targetX?: number | string | undefined; + targetY?: number | string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; + textDecoration?: number | string | undefined; + textLength?: number | string | undefined; + textRendering?: number | string | undefined; + to?: number | string | undefined; + transform?: string | undefined; + u1?: number | string | undefined; + u2?: number | string | undefined; + underlinePosition?: number | string | undefined; + underlineThickness?: number | string | undefined; + unicode?: number | string | undefined; + unicodeBidi?: number | string | undefined; + unicodeRange?: number | string | undefined; + unitsPerEm?: number | string | undefined; + vAlphabetic?: number | string | undefined; + values?: string | undefined; + vectorEffect?: number | string | undefined; + version?: string | undefined; + vertAdvY?: number | string | undefined; + vertOriginX?: number | string | undefined; + vertOriginY?: number | string | undefined; + vHanging?: number | string | undefined; + vIdeographic?: number | string | undefined; + viewBox?: string | undefined; + viewTarget?: number | string | undefined; + visibility?: number | string | undefined; + vMathematical?: number | string | undefined; + widths?: number | string | undefined; + wordSpacing?: number | string | undefined; + writingMode?: number | string | undefined; + x1?: number | string | undefined; + x2?: number | string | undefined; + x?: number | string | undefined; + xChannelSelector?: string | undefined; + xHeight?: number | string | undefined; + xlinkActuate?: string | undefined; + xlinkArcrole?: string | undefined; + xlinkHref?: string | undefined; + xlinkRole?: string | undefined; + xlinkShow?: string | undefined; + xlinkTitle?: string | undefined; + xlinkType?: string | undefined; + xmlBase?: string | undefined; + xmlLang?: string | undefined; + xmlns?: string | undefined; + xmlnsXlink?: string | undefined; + xmlSpace?: string | undefined; + y1?: number | string | undefined; + y2?: number | string | undefined; + y?: number | string | undefined; + yChannelSelector?: string | undefined; + z?: number | string | undefined; + zoomAndPan?: string | undefined; + } + + interface WebViewHTMLAttributes extends HTMLAttributes { + allowFullScreen?: boolean | undefined; + allowpopups?: boolean | undefined; + autosize?: boolean | undefined; + blinkfeatures?: string | undefined; + disableblinkfeatures?: string | undefined; + disableguestresize?: boolean | undefined; + disablewebsecurity?: boolean | undefined; + guestinstance?: string | undefined; + httpreferrer?: string | undefined; + nodeintegration?: boolean | undefined; + partition?: string | undefined; + plugins?: boolean | undefined; + preload?: string | undefined; + src?: string | undefined; + useragent?: string | undefined; + webpreferences?: string | undefined; + } + + // TODO: Move to react-dom + type HTMLElementType = + | "a" + | "abbr" + | "address" + | "area" + | "article" + | "aside" + | "audio" + | "b" + | "base" + | "bdi" + | "bdo" + | "big" + | "blockquote" + | "body" + | "br" + | "button" + | "canvas" + | "caption" + | "center" + | "cite" + | "code" + | "col" + | "colgroup" + | "data" + | "datalist" + | "dd" + | "del" + | "details" + | "dfn" + | "dialog" + | "div" + | "dl" + | "dt" + | "em" + | "embed" + | "fieldset" + | "figcaption" + | "figure" + | "footer" + | "form" + | "h1" + | "h2" + | "h3" + | "h4" + | "h5" + | "h6" + | "head" + | "header" + | "hgroup" + | "hr" + | "html" + | "i" + | "iframe" + | "img" + | "input" + | "ins" + | "kbd" + | "keygen" + | "label" + | "legend" + | "li" + | "link" + | "main" + | "map" + | "mark" + | "menu" + | "menuitem" + | "meta" + | "meter" + | "nav" + | "noscript" + | "object" + | "ol" + | "optgroup" + | "option" + | "output" + | "p" + | "param" + | "picture" + | "pre" + | "progress" + | "q" + | "rp" + | "rt" + | "ruby" + | "s" + | "samp" + | "search" + | "slot" + | "script" + | "section" + | "select" + | "small" + | "source" + | "span" + | "strong" + | "style" + | "sub" + | "summary" + | "sup" + | "table" + | "template" + | "tbody" + | "td" + | "textarea" + | "tfoot" + | "th" + | "thead" + | "time" + | "title" + | "tr" + | "track" + | "u" + | "ul" + | "var" + | "video" + | "wbr" + | "webview"; + + // TODO: Move to react-dom + type SVGElementType = + | "animate" + | "circle" + | "clipPath" + | "defs" + | "desc" + | "ellipse" + | "feBlend" + | "feColorMatrix" + | "feComponentTransfer" + | "feComposite" + | "feConvolveMatrix" + | "feDiffuseLighting" + | "feDisplacementMap" + | "feDistantLight" + | "feDropShadow" + | "feFlood" + | "feFuncA" + | "feFuncB" + | "feFuncG" + | "feFuncR" + | "feGaussianBlur" + | "feImage" + | "feMerge" + | "feMergeNode" + | "feMorphology" + | "feOffset" + | "fePointLight" + | "feSpecularLighting" + | "feSpotLight" + | "feTile" + | "feTurbulence" + | "filter" + | "foreignObject" + | "g" + | "image" + | "line" + | "linearGradient" + | "marker" + | "mask" + | "metadata" + | "path" + | "pattern" + | "polygon" + | "polyline" + | "radialGradient" + | "rect" + | "stop" + | "svg" + | "switch" + | "symbol" + | "text" + | "textPath" + | "tspan" + | "use" + | "view"; + + // + // Browser Interfaces + // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts + // ---------------------------------------------------------------------- + + interface AbstractView { + styleMedia: StyleMedia; + document: Document; + } + + interface Touch { + identifier: number; + target: EventTarget; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + pageX: number; + pageY: number; + } + + interface TouchList { + [index: number]: Touch; + length: number; + item(index: number): Touch; + identifiedTouch(identifier: number): Touch; + } + + // + // Error Interfaces + // ---------------------------------------------------------------------- + interface ErrorInfo { + /** + * Captures which component contained the exception, and its ancestors. + */ + componentStack?: string | null; + } + + // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts + namespace JSX { + // We don't just alias React.ElementType because React.ElementType + // historically does more than we need it to. + // E.g. it also contains .propTypes and so TS also verifies the declared + // props type does match the declared .propTypes. + // But if libraries declared their .propTypes but not props type, + // or they mismatch, you won't be able to use the class component + // as a JSX.ElementType. + // We could fix this everywhere but we're ultimately not interested in + // .propTypes assignability so we might as well drop it entirely here to + // reduce the work of the type-checker. + // TODO: Check impact of making React.ElementType

= React.JSXElementConstructor

+ type ElementType = string | React.JSXElementConstructor; + interface Element extends React.ReactElement {} + interface ElementClass extends React.Component { + render(): React.ReactNode; + } + interface ElementAttributesProperty { + props: {}; + } + interface ElementChildrenAttribute { + children: {}; + } + + // We can't recurse forever because `type` can't be self-referential; + // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa + type LibraryManagedAttributes = C extends + React.MemoExoticComponent | React.LazyExoticComponent + ? T extends React.MemoExoticComponent | React.LazyExoticComponent + ? ReactManagedAttributes + : ReactManagedAttributes + : ReactManagedAttributes; + + interface IntrinsicAttributes extends React.Attributes {} + interface IntrinsicClassAttributes extends React.ClassAttributes {} + + interface IntrinsicElements { + // HTML + a: React.DetailedHTMLProps, HTMLAnchorElement>; + abbr: React.DetailedHTMLProps, HTMLElement>; + address: React.DetailedHTMLProps, HTMLElement>; + area: React.DetailedHTMLProps, HTMLAreaElement>; + article: React.DetailedHTMLProps, HTMLElement>; + aside: React.DetailedHTMLProps, HTMLElement>; + audio: React.DetailedHTMLProps, HTMLAudioElement>; + b: React.DetailedHTMLProps, HTMLElement>; + base: React.DetailedHTMLProps, HTMLBaseElement>; + bdi: React.DetailedHTMLProps, HTMLElement>; + bdo: React.DetailedHTMLProps, HTMLElement>; + big: React.DetailedHTMLProps, HTMLElement>; + blockquote: React.DetailedHTMLProps, HTMLQuoteElement>; + body: React.DetailedHTMLProps, HTMLBodyElement>; + br: React.DetailedHTMLProps, HTMLBRElement>; + button: React.DetailedHTMLProps, HTMLButtonElement>; + canvas: React.DetailedHTMLProps, HTMLCanvasElement>; + caption: React.DetailedHTMLProps, HTMLElement>; + center: React.DetailedHTMLProps, HTMLElement>; + cite: React.DetailedHTMLProps, HTMLElement>; + code: React.DetailedHTMLProps, HTMLElement>; + col: React.DetailedHTMLProps, HTMLTableColElement>; + colgroup: React.DetailedHTMLProps, HTMLTableColElement>; + data: React.DetailedHTMLProps, HTMLDataElement>; + datalist: React.DetailedHTMLProps, HTMLDataListElement>; + dd: React.DetailedHTMLProps, HTMLElement>; + del: React.DetailedHTMLProps, HTMLModElement>; + details: React.DetailedHTMLProps, HTMLDetailsElement>; + dfn: React.DetailedHTMLProps, HTMLElement>; + dialog: React.DetailedHTMLProps, HTMLDialogElement>; + div: React.DetailedHTMLProps, HTMLDivElement>; + dl: React.DetailedHTMLProps, HTMLDListElement>; + dt: React.DetailedHTMLProps, HTMLElement>; + em: React.DetailedHTMLProps, HTMLElement>; + embed: React.DetailedHTMLProps, HTMLEmbedElement>; + fieldset: React.DetailedHTMLProps, HTMLFieldSetElement>; + figcaption: React.DetailedHTMLProps, HTMLElement>; + figure: React.DetailedHTMLProps, HTMLElement>; + footer: React.DetailedHTMLProps, HTMLElement>; + form: React.DetailedHTMLProps, HTMLFormElement>; + h1: React.DetailedHTMLProps, HTMLHeadingElement>; + h2: React.DetailedHTMLProps, HTMLHeadingElement>; + h3: React.DetailedHTMLProps, HTMLHeadingElement>; + h4: React.DetailedHTMLProps, HTMLHeadingElement>; + h5: React.DetailedHTMLProps, HTMLHeadingElement>; + h6: React.DetailedHTMLProps, HTMLHeadingElement>; + head: React.DetailedHTMLProps, HTMLHeadElement>; + header: React.DetailedHTMLProps, HTMLElement>; + hgroup: React.DetailedHTMLProps, HTMLElement>; + hr: React.DetailedHTMLProps, HTMLHRElement>; + html: React.DetailedHTMLProps, HTMLHtmlElement>; + i: React.DetailedHTMLProps, HTMLElement>; + iframe: React.DetailedHTMLProps, HTMLIFrameElement>; + img: React.DetailedHTMLProps, HTMLImageElement>; + input: React.DetailedHTMLProps, HTMLInputElement>; + ins: React.DetailedHTMLProps, HTMLModElement>; + kbd: React.DetailedHTMLProps, HTMLElement>; + keygen: React.DetailedHTMLProps, HTMLElement>; + label: React.DetailedHTMLProps, HTMLLabelElement>; + legend: React.DetailedHTMLProps, HTMLLegendElement>; + li: React.DetailedHTMLProps, HTMLLIElement>; + link: React.DetailedHTMLProps, HTMLLinkElement>; + main: React.DetailedHTMLProps, HTMLElement>; + map: React.DetailedHTMLProps, HTMLMapElement>; + mark: React.DetailedHTMLProps, HTMLElement>; + menu: React.DetailedHTMLProps, HTMLElement>; + menuitem: React.DetailedHTMLProps, HTMLElement>; + meta: React.DetailedHTMLProps, HTMLMetaElement>; + meter: React.DetailedHTMLProps, HTMLMeterElement>; + nav: React.DetailedHTMLProps, HTMLElement>; + noindex: React.DetailedHTMLProps, HTMLElement>; + noscript: React.DetailedHTMLProps, HTMLElement>; + object: React.DetailedHTMLProps, HTMLObjectElement>; + ol: React.DetailedHTMLProps, HTMLOListElement>; + optgroup: React.DetailedHTMLProps, HTMLOptGroupElement>; + option: React.DetailedHTMLProps, HTMLOptionElement>; + output: React.DetailedHTMLProps, HTMLOutputElement>; + p: React.DetailedHTMLProps, HTMLParagraphElement>; + param: React.DetailedHTMLProps, HTMLParamElement>; + picture: React.DetailedHTMLProps, HTMLElement>; + pre: React.DetailedHTMLProps, HTMLPreElement>; + progress: React.DetailedHTMLProps, HTMLProgressElement>; + q: React.DetailedHTMLProps, HTMLQuoteElement>; + rp: React.DetailedHTMLProps, HTMLElement>; + rt: React.DetailedHTMLProps, HTMLElement>; + ruby: React.DetailedHTMLProps, HTMLElement>; + s: React.DetailedHTMLProps, HTMLElement>; + samp: React.DetailedHTMLProps, HTMLElement>; + search: React.DetailedHTMLProps, HTMLElement>; + slot: React.DetailedHTMLProps, HTMLSlotElement>; + script: React.DetailedHTMLProps, HTMLScriptElement>; + section: React.DetailedHTMLProps, HTMLElement>; + select: React.DetailedHTMLProps, HTMLSelectElement>; + small: React.DetailedHTMLProps, HTMLElement>; + source: React.DetailedHTMLProps, HTMLSourceElement>; + span: React.DetailedHTMLProps, HTMLSpanElement>; + strong: React.DetailedHTMLProps, HTMLElement>; + style: React.DetailedHTMLProps, HTMLStyleElement>; + sub: React.DetailedHTMLProps, HTMLElement>; + summary: React.DetailedHTMLProps, HTMLElement>; + sup: React.DetailedHTMLProps, HTMLElement>; + table: React.DetailedHTMLProps, HTMLTableElement>; + template: React.DetailedHTMLProps, HTMLTemplateElement>; + tbody: React.DetailedHTMLProps, HTMLTableSectionElement>; + td: React.DetailedHTMLProps, HTMLTableDataCellElement>; + textarea: React.DetailedHTMLProps, HTMLTextAreaElement>; + tfoot: React.DetailedHTMLProps, HTMLTableSectionElement>; + th: React.DetailedHTMLProps, HTMLTableHeaderCellElement>; + thead: React.DetailedHTMLProps, HTMLTableSectionElement>; + time: React.DetailedHTMLProps, HTMLTimeElement>; + title: React.DetailedHTMLProps, HTMLTitleElement>; + tr: React.DetailedHTMLProps, HTMLTableRowElement>; + track: React.DetailedHTMLProps, HTMLTrackElement>; + u: React.DetailedHTMLProps, HTMLElement>; + ul: React.DetailedHTMLProps, HTMLUListElement>; + "var": React.DetailedHTMLProps, HTMLElement>; + video: React.DetailedHTMLProps, HTMLVideoElement>; + wbr: React.DetailedHTMLProps, HTMLElement>; + webview: React.DetailedHTMLProps, HTMLWebViewElement>; + + // SVG + svg: React.SVGProps; + + animate: React.SVGProps; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now. + animateMotion: React.SVGProps; + animateTransform: React.SVGProps; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now. + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + desc: React.SVGProps; + ellipse: React.SVGProps; + feBlend: React.SVGProps; + feColorMatrix: React.SVGProps; + feComponentTransfer: React.SVGProps; + feComposite: React.SVGProps; + feConvolveMatrix: React.SVGProps; + feDiffuseLighting: React.SVGProps; + feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; + feDropShadow: React.SVGProps; + feFlood: React.SVGProps; + feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; + feGaussianBlur: React.SVGProps; + feImage: React.SVGProps; + feMerge: React.SVGProps; + feMergeNode: React.SVGProps; + feMorphology: React.SVGProps; + feOffset: React.SVGProps; + fePointLight: React.SVGProps; + feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; + feTile: React.SVGProps; + feTurbulence: React.SVGProps; + filter: React.SVGProps; + foreignObject: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGLineElementAttributes; + linearGradient: React.SVGProps; + marker: React.SVGProps; + mask: React.SVGProps; + metadata: React.SVGProps; + mpath: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + set: React.SVGProps; + stop: React.SVGProps; + switch: React.SVGProps; + symbol: React.SVGProps; + text: React.SVGTextElementAttributes; + textPath: React.SVGProps; + tspan: React.SVGProps; + use: React.SVGProps; + view: React.SVGProps; + } + } +} + +type InexactPartial = { [K in keyof T]?: T[K] | undefined }; + +// Any prop that has a default prop becomes optional, but its type is unchanged +// Undeclared default props are augmented into the resulting allowable attributes +// If declared props have indexed properties, ignore default props entirely as keyof gets widened +// Wrap in an outer-level conditional type to allow distribution over props that are unions +type Defaultize = P extends any ? string extends keyof P ? P + : + & Pick> + & InexactPartial>> + & InexactPartial>> + : never; + +type ReactManagedAttributes = C extends { defaultProps: infer D } ? Defaultize + : P; diff --git a/node_modules/@types/react/jsx-dev-runtime.d.ts b/node_modules/@types/react/jsx-dev-runtime.d.ts new file mode 100644 index 00000000..d28644c6 --- /dev/null +++ b/node_modules/@types/react/jsx-dev-runtime.d.ts @@ -0,0 +1,45 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + type ElementType = React.JSX.ElementType; + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +export interface JSXSource { + /** + * The source file where the element originates from. + */ + fileName?: string | undefined; + + /** + * The line number where the element was created. + */ + lineNumber?: number | undefined; + + /** + * The column number where the element was created. + */ + columnNumber?: number | undefined; +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxDEV( + type: React.ElementType, + props: unknown, + key: React.Key | undefined, + isStatic: boolean, + source?: JSXSource, + self?: unknown, +): React.ReactElement; diff --git a/node_modules/@types/react/jsx-runtime.d.ts b/node_modules/@types/react/jsx-runtime.d.ts new file mode 100644 index 00000000..e9fea27d --- /dev/null +++ b/node_modules/@types/react/jsx-runtime.d.ts @@ -0,0 +1,36 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + type ElementType = React.JSX.ElementType; + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsx( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxs( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; diff --git a/node_modules/@types/react/package.json b/node_modules/@types/react/package.json new file mode 100644 index 00000000..7be3ba8d --- /dev/null +++ b/node_modules/@types/react/package.json @@ -0,0 +1,210 @@ +{ + "name": "@types/react", + "version": "19.2.7", + "description": "TypeScript definitions for react", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react", + "license": "MIT", + "contributors": [ + { + "name": "Asana", + "url": "https://asana.com" + }, + { + "name": "AssureSign", + "url": "http://www.assuresign.com" + }, + { + "name": "Microsoft", + "url": "https://microsoft.com" + }, + { + "name": "John Reilly", + "githubUsername": "johnnyreilly", + "url": "https://github.com/johnnyreilly" + }, + { + "name": "Benoit Benezech", + "githubUsername": "bbenezech", + "url": "https://github.com/bbenezech" + }, + { + "name": "Patricio Zavolinsky", + "githubUsername": "pzavolinsky", + "url": "https://github.com/pzavolinsky" + }, + { + "name": "Eric Anderson", + "githubUsername": "ericanderson", + "url": "https://github.com/ericanderson" + }, + { + "name": "Dovydas Navickas", + "githubUsername": "DovydasNavickas", + "url": "https://github.com/DovydasNavickas" + }, + { + "name": "Josh Rutherford", + "githubUsername": "theruther4d", + "url": "https://github.com/theruther4d" + }, + { + "name": "Guilherme Hübner", + "githubUsername": "guilhermehubner", + "url": "https://github.com/guilhermehubner" + }, + { + "name": "Ferdy Budhidharma", + "githubUsername": "ferdaber", + "url": "https://github.com/ferdaber" + }, + { + "name": "Johann Rakotoharisoa", + "githubUsername": "jrakotoharisoa", + "url": "https://github.com/jrakotoharisoa" + }, + { + "name": "Olivier Pascal", + "githubUsername": "pascaloliv", + "url": "https://github.com/pascaloliv" + }, + { + "name": "Martin Hochel", + "githubUsername": "hotell", + "url": "https://github.com/hotell" + }, + { + "name": "Frank Li", + "githubUsername": "franklixuefei", + "url": "https://github.com/franklixuefei" + }, + { + "name": "Jessica Franco", + "githubUsername": "Jessidhia", + "url": "https://github.com/Jessidhia" + }, + { + "name": "Saransh Kataria", + "githubUsername": "saranshkataria", + "url": "https://github.com/saranshkataria" + }, + { + "name": "Kanitkorn Sujautra", + "githubUsername": "lukyth", + "url": "https://github.com/lukyth" + }, + { + "name": "Sebastian Silbermann", + "githubUsername": "eps1lon", + "url": "https://github.com/eps1lon" + }, + { + "name": "Kyle Scully", + "githubUsername": "zieka", + "url": "https://github.com/zieka" + }, + { + "name": "Cong Zhang", + "githubUsername": "dancerphil", + "url": "https://github.com/dancerphil" + }, + { + "name": "Dimitri Mitropoulos", + "githubUsername": "dimitropoulos", + "url": "https://github.com/dimitropoulos" + }, + { + "name": "JongChan Choi", + "githubUsername": "disjukr", + "url": "https://github.com/disjukr" + }, + { + "name": "Victor Magalhães", + "githubUsername": "vhfmag", + "url": "https://github.com/vhfmag" + }, + { + "name": "Priyanshu Rav", + "githubUsername": "priyanshurav", + "url": "https://github.com/priyanshurav" + }, + { + "name": "Dmitry Semigradsky", + "githubUsername": "Semigradsky", + "url": "https://github.com/Semigradsky" + }, + { + "name": "Matt Pocock", + "githubUsername": "mattpocock", + "url": "https://github.com/mattpocock" + } + ], + "main": "", + "types": "index.d.ts", + "typesVersions": { + "<=5.0": { + "*": [ + "ts5.0/*" + ] + } + }, + "exports": { + ".": { + "types@<=5.0": { + "default": "./ts5.0/index.d.ts" + }, + "types": { + "default": "./index.d.ts" + } + }, + "./canary": { + "types@<=5.0": { + "default": "./ts5.0/canary.d.ts" + }, + "types": { + "default": "./canary.d.ts" + } + }, + "./compiler-runtime": { + "types": { + "default": "./compiler-runtime.d.ts" + } + }, + "./experimental": { + "types@<=5.0": { + "default": "./ts5.0/experimental.d.ts" + }, + "types": { + "default": "./experimental.d.ts" + } + }, + "./jsx-runtime": { + "types@<=5.0": { + "default": "./ts5.0/jsx-runtime.d.ts" + }, + "types": { + "default": "./jsx-runtime.d.ts" + } + }, + "./jsx-dev-runtime": { + "types@<=5.0": { + "default": "./ts5.0/jsx-dev-runtime.d.ts" + }, + "types": { + "default": "./jsx-dev-runtime.d.ts" + } + }, + "./package.json": "./package.json" + }, + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/react" + }, + "scripts": {}, + "dependencies": { + "csstype": "^3.2.2" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "fd69ea47f2fc8e9d139677eb6bcca67ee4b3ac279ce5ceb2e6e23ce8403c356d", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/react/ts5.0/canary.d.ts b/node_modules/@types/react/ts5.0/canary.d.ts new file mode 100644 index 00000000..22b1807e --- /dev/null +++ b/node_modules/@types/react/ts5.0/canary.d.ts @@ -0,0 +1,120 @@ +/** + * These are types for things that are present in the React `canary` release channel. + * + * To load the types declared here in an actual project, there are three ways. The easiest one, + * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, + * is to add `"react/canary"` to the `"types"` array. + * + * Alternatively, a specific import syntax can to be used from a typescript file. + * This module does not exist in reality, which is why the {} is important: + * + * ```ts + * import {} from 'react/canary' + * ``` + * + * It is also possible to include it through a triple-slash reference: + * + * ```ts + * /// + * ``` + * + * Either the import or the reference only needs to appear once, anywhere in the project. + */ + +// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared, + +import React = require("."); + +export {}; + +declare const UNDEFINED_VOID_ONLY: unique symbol; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +declare module "." { + export function unstable_useCacheRefresh(): () => void; + + // @enableViewTransition + export interface ViewTransitionInstance { + /** + * The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted. + */ + name: string; + } + + export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>; + export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string]; + + export interface ViewTransitionProps { + children?: ReactNode | undefined; + /** + * Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node. + */ + default?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if this `` or its parent Component is mounted and there's no other with the same name being deleted. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + enter?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if this `` or its parent Component is unmounted and there's no other with the same name being deleted. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + exit?: ViewTransitionClass | undefined; + /** + * "auto" will automatically assign a view-transition-name to the inner DOM node. + * That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise. + * + * A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter. + * @default "auto" + */ + name?: "auto" | (string & {}) | undefined; + /** + * The `` or its parent Component is mounted and there's no other `` with the same name being deleted. + */ + onEnter?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * The `` or its parent Component is unmounted and there's no other `` with the same name being deleted. + */ + onExit?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * This `` is being mounted and another `` instance with the same name is being unmounted elsewhere. + */ + onShare?: (instance: ViewTransitionInstance, types: Array) => void; + /** + * The content of `` has changed either due to DOM mutations or because an inner child `` has resized. + */ + onUpdate?: (instance: ViewTransitionInstance, types: Array) => void; + ref?: Ref | undefined; + /** + * Combined with {@link className} if this `` is being mounted and another instance with the same name is being unmounted elsewhere. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + share?: ViewTransitionClass | undefined; + /** + * Combined with {@link className} if the content of this `` has changed either due to DOM mutations or because an inner child has resized. + * `"none"` is a special value that deactivates the view transition name under that condition. + */ + update?: ViewTransitionClass | undefined; + } + + /** + * Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React. + * View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content. + * Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't. + * + * @see {@link https://react.dev/reference/react/ViewTransition `` reference documentation} + */ + export const ViewTransition: ExoticComponent; + + /** + * @see {@link https://react.dev/reference/react/addTransitionType `addTransitionType` reference documentation} + */ + export function addTransitionType(type: string): void; + + // @enableFragmentRefs + export interface FragmentInstance {} + + export interface FragmentProps { + ref?: Ref | undefined; + } +} diff --git a/node_modules/@types/react/ts5.0/experimental.d.ts b/node_modules/@types/react/ts5.0/experimental.d.ts new file mode 100644 index 00000000..e6ebe931 --- /dev/null +++ b/node_modules/@types/react/ts5.0/experimental.d.ts @@ -0,0 +1,147 @@ +/** + * These are types for things that are present in the `experimental` builds of React but not yet + * on a stable build. + * + * Once they are promoted to stable they can just be moved to the main index file. + * + * To load the types declared here in an actual project, there are three ways. The easiest one, + * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, + * is to add `"react/experimental"` to the `"types"` array. + * + * Alternatively, a specific import syntax can to be used from a typescript file. + * This module does not exist in reality, which is why the {} is important: + * + * ```ts + * import {} from 'react/experimental' + * ``` + * + * It is also possible to include it through a triple-slash reference: + * + * ```ts + * /// + * ``` + * + * Either the import or the reference only needs to appear once, anywhere in the project. + */ + +// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared, +// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are +// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`. +// +// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js +// is a good place to start looking for details; it generally calls prop validation functions or delegates +// all tasks done as part of the render phase (the concurrent part of the React update cycle). +// +// Suspense-related handling can be found in ReactFiberThrow.js. + +import React = require("./canary"); + +export {}; + +declare const UNDEFINED_VOID_ONLY: unique symbol; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +declare module "." { + export interface SuspenseProps { + // @enableCPUSuspense + /** + * The presence of this prop indicates that the content is computationally expensive to render. + * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data). + * @see {@link https://github.com/facebook/react/pull/19936} + */ + defer?: boolean | undefined; + } + + export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent"; + export type SuspenseListTailMode = "collapsed" | "hidden" | "visible"; + + export interface SuspenseListCommonProps { + } + + interface DirectionalSuspenseListProps extends SuspenseListCommonProps { + /** + * Note that SuspenseList require more than one child; + * it is a runtime warning to provide only a single child. + * + * It does, however, allow those children to be wrapped inside a single + * level of ``. + */ + children: Iterable | AsyncIterable; + /** + * Defines the order in which the `SuspenseList` children should be revealed. + * @default "forwards" + */ + revealOrder?: "forwards" | "backwards" | "unstable_legacy-backwards" | undefined; + /** + * Dictates how unloaded items in a SuspenseList is shown. + * + * - `collapsed` shows only the next fallback in the list. + * - `hidden` doesn't show any unloaded items. + * - `visible` shows all fallbacks in the list. + * + * @default "hidden" + */ + tail?: SuspenseListTailMode | undefined; + } + + interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps { + children: ReactNode; + /** + * Defines the order in which the `SuspenseList` children should be revealed. + */ + revealOrder: Exclude; + /** + * The tail property is invalid when not using the `forwards` or `backwards` reveal orders. + */ + tail?: never; + } + + export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps; + + /** + * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order + * in which these components are revealed to the user. + * + * When multiple components need to fetch data, this data may arrive in an unpredictable order. + * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list + * until previous items have been displayed (this behavior is adjustable). + * + * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist + * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist + */ + export const unstable_SuspenseList: ExoticComponent; + + type Reference = object; + type TaintableUniqueValue = string | bigint | ArrayBufferView; + function experimental_taintUniqueValue( + message: string | undefined, + lifetime: Reference, + value: TaintableUniqueValue, + ): void; + function experimental_taintObjectReference(message: string | undefined, object: Reference): void; + + // @enableGestureTransition + // Implemented by the specific renderer e.g. `react-dom`. + // Keep in mind that augmented interfaces merge their JSDoc so if you put + // JSDoc here and in the renderer, the IDE will display both. + export interface GestureProvider {} + export interface GestureOptions { + rangeStart?: number | undefined; + rangeEnd?: number | undefined; + } + /** */ + export function unstable_startGestureTransition( + provider: GestureProvider, + scope: () => void, + options?: GestureOptions, + ): () => void; + + // @enableSrcObject + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES { + srcObject: Blob; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES { + srcObject: Blob | MediaSource | MediaStream; + } +} diff --git a/node_modules/@types/react/ts5.0/global.d.ts b/node_modules/@types/react/ts5.0/global.d.ts new file mode 100644 index 00000000..6770d08e --- /dev/null +++ b/node_modules/@types/react/ts5.0/global.d.ts @@ -0,0 +1,165 @@ +/* +React projects that don't include the DOM library need these interfaces to compile. +React Native applications use React, but there is no DOM available. The JavaScript runtime +is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`. + +Warning: all of these interfaces are empty. If you want type definitions for various properties +(such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json). +*/ + +interface Event {} +interface AnimationEvent extends Event {} +interface ClipboardEvent extends Event {} +interface CompositionEvent extends Event {} +interface DragEvent extends Event {} +interface FocusEvent extends Event {} +interface InputEvent extends Event {} +interface KeyboardEvent extends Event {} +interface MouseEvent extends Event {} +interface TouchEvent extends Event {} +interface PointerEvent extends Event {} +interface ToggleEvent extends Event {} +interface TransitionEvent extends Event {} +interface UIEvent extends Event {} +interface WheelEvent extends Event {} + +interface EventTarget {} +interface Document {} +interface DataTransfer {} +interface StyleMedia {} + +interface Element {} +interface DocumentFragment {} + +interface HTMLElement extends Element {} +interface HTMLAnchorElement extends HTMLElement {} +interface HTMLAreaElement extends HTMLElement {} +interface HTMLAudioElement extends HTMLElement {} +interface HTMLBaseElement extends HTMLElement {} +interface HTMLBodyElement extends HTMLElement {} +interface HTMLBRElement extends HTMLElement {} +interface HTMLButtonElement extends HTMLElement {} +interface HTMLCanvasElement extends HTMLElement {} +interface HTMLDataElement extends HTMLElement {} +interface HTMLDataListElement extends HTMLElement {} +interface HTMLDetailsElement extends HTMLElement {} +interface HTMLDialogElement extends HTMLElement {} +interface HTMLDivElement extends HTMLElement {} +interface HTMLDListElement extends HTMLElement {} +interface HTMLEmbedElement extends HTMLElement {} +interface HTMLFieldSetElement extends HTMLElement {} +interface HTMLFormElement extends HTMLElement {} +interface HTMLHeadingElement extends HTMLElement {} +interface HTMLHeadElement extends HTMLElement {} +interface HTMLHRElement extends HTMLElement {} +interface HTMLHtmlElement extends HTMLElement {} +interface HTMLIFrameElement extends HTMLElement {} +interface HTMLImageElement extends HTMLElement {} +interface HTMLInputElement extends HTMLElement {} +interface HTMLModElement extends HTMLElement {} +interface HTMLLabelElement extends HTMLElement {} +interface HTMLLegendElement extends HTMLElement {} +interface HTMLLIElement extends HTMLElement {} +interface HTMLLinkElement extends HTMLElement {} +interface HTMLMapElement extends HTMLElement {} +interface HTMLMetaElement extends HTMLElement {} +interface HTMLMeterElement extends HTMLElement {} +interface HTMLObjectElement extends HTMLElement {} +interface HTMLOListElement extends HTMLElement {} +interface HTMLOptGroupElement extends HTMLElement {} +interface HTMLOptionElement extends HTMLElement {} +interface HTMLOutputElement extends HTMLElement {} +interface HTMLParagraphElement extends HTMLElement {} +interface HTMLParamElement extends HTMLElement {} +interface HTMLPreElement extends HTMLElement {} +interface HTMLProgressElement extends HTMLElement {} +interface HTMLQuoteElement extends HTMLElement {} +interface HTMLSlotElement extends HTMLElement {} +interface HTMLScriptElement extends HTMLElement {} +interface HTMLSelectElement extends HTMLElement {} +interface HTMLSourceElement extends HTMLElement {} +interface HTMLSpanElement extends HTMLElement {} +interface HTMLStyleElement extends HTMLElement {} +interface HTMLTableElement extends HTMLElement {} +interface HTMLTableColElement extends HTMLElement {} +interface HTMLTableDataCellElement extends HTMLElement {} +interface HTMLTableHeaderCellElement extends HTMLElement {} +interface HTMLTableRowElement extends HTMLElement {} +interface HTMLTableSectionElement extends HTMLElement {} +interface HTMLTemplateElement extends HTMLElement {} +interface HTMLTextAreaElement extends HTMLElement {} +interface HTMLTimeElement extends HTMLElement {} +interface HTMLTitleElement extends HTMLElement {} +interface HTMLTrackElement extends HTMLElement {} +interface HTMLUListElement extends HTMLElement {} +interface HTMLVideoElement extends HTMLElement {} +interface HTMLWebViewElement extends HTMLElement {} + +interface SVGElement extends Element {} +interface SVGSVGElement extends SVGElement {} +interface SVGCircleElement extends SVGElement {} +interface SVGClipPathElement extends SVGElement {} +interface SVGDefsElement extends SVGElement {} +interface SVGDescElement extends SVGElement {} +interface SVGEllipseElement extends SVGElement {} +interface SVGFEBlendElement extends SVGElement {} +interface SVGFEColorMatrixElement extends SVGElement {} +interface SVGFEComponentTransferElement extends SVGElement {} +interface SVGFECompositeElement extends SVGElement {} +interface SVGFEConvolveMatrixElement extends SVGElement {} +interface SVGFEDiffuseLightingElement extends SVGElement {} +interface SVGFEDisplacementMapElement extends SVGElement {} +interface SVGFEDistantLightElement extends SVGElement {} +interface SVGFEDropShadowElement extends SVGElement {} +interface SVGFEFloodElement extends SVGElement {} +interface SVGFEFuncAElement extends SVGElement {} +interface SVGFEFuncBElement extends SVGElement {} +interface SVGFEFuncGElement extends SVGElement {} +interface SVGFEFuncRElement extends SVGElement {} +interface SVGFEGaussianBlurElement extends SVGElement {} +interface SVGFEImageElement extends SVGElement {} +interface SVGFEMergeElement extends SVGElement {} +interface SVGFEMergeNodeElement extends SVGElement {} +interface SVGFEMorphologyElement extends SVGElement {} +interface SVGFEOffsetElement extends SVGElement {} +interface SVGFEPointLightElement extends SVGElement {} +interface SVGFESpecularLightingElement extends SVGElement {} +interface SVGFESpotLightElement extends SVGElement {} +interface SVGFETileElement extends SVGElement {} +interface SVGFETurbulenceElement extends SVGElement {} +interface SVGFilterElement extends SVGElement {} +interface SVGForeignObjectElement extends SVGElement {} +interface SVGGElement extends SVGElement {} +interface SVGImageElement extends SVGElement {} +interface SVGLineElement extends SVGElement {} +interface SVGLinearGradientElement extends SVGElement {} +interface SVGMarkerElement extends SVGElement {} +interface SVGMaskElement extends SVGElement {} +interface SVGMetadataElement extends SVGElement {} +interface SVGPathElement extends SVGElement {} +interface SVGPatternElement extends SVGElement {} +interface SVGPolygonElement extends SVGElement {} +interface SVGPolylineElement extends SVGElement {} +interface SVGRadialGradientElement extends SVGElement {} +interface SVGRectElement extends SVGElement {} +interface SVGSetElement extends SVGElement {} +interface SVGStopElement extends SVGElement {} +interface SVGSwitchElement extends SVGElement {} +interface SVGSymbolElement extends SVGElement {} +interface SVGTextElement extends SVGElement {} +interface SVGTextPathElement extends SVGElement {} +interface SVGTSpanElement extends SVGElement {} +interface SVGUseElement extends SVGElement {} +interface SVGViewElement extends SVGElement {} + +interface FormData {} +interface Text {} +interface TouchList {} +interface WebGLRenderingContext {} +interface WebGL2RenderingContext {} + +interface TrustedHTML {} + +interface Blob {} +interface MediaStream {} +interface MediaSource {} diff --git a/node_modules/@types/react/ts5.0/index.d.ts b/node_modules/@types/react/ts5.0/index.d.ts new file mode 100644 index 00000000..9433beaa --- /dev/null +++ b/node_modules/@types/react/ts5.0/index.d.ts @@ -0,0 +1,4311 @@ +// NOTE: Users of the `experimental` builds of React should add a reference +// to 'react/experimental' in their project. See experimental.d.ts's top comment +// for reference and documentation on how exactly to do it. + +/// + +import * as CSS from "csstype"; + +type NativeAnimationEvent = AnimationEvent; +type NativeClipboardEvent = ClipboardEvent; +type NativeCompositionEvent = CompositionEvent; +type NativeDragEvent = DragEvent; +type NativeFocusEvent = FocusEvent; +type NativeInputEvent = InputEvent; +type NativeKeyboardEvent = KeyboardEvent; +type NativeMouseEvent = MouseEvent; +type NativeTouchEvent = TouchEvent; +type NativePointerEvent = PointerEvent; +type NativeToggleEvent = ToggleEvent; +type NativeTransitionEvent = TransitionEvent; +type NativeUIEvent = UIEvent; +type NativeWheelEvent = WheelEvent; + +/** + * Used to represent DOM API's where users can either pass + * true or false as a boolean or as its equivalent strings. + */ +type Booleanish = boolean | "true" | "false"; + +/** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN} + */ +type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined; + +declare const UNDEFINED_VOID_ONLY: unique symbol; + +/** + * @internal Use `Awaited` instead + */ +// Helper type to enable `Awaited`. +// Must be a copy of the non-thenables of `ReactNode`. +type AwaitedReactNode = + | React.ReactElement + | string + | number + | bigint + | Iterable + | React.ReactPortal + | boolean + | null + | undefined + | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ + keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES + ]; + +/** + * The function returned from an effect passed to {@link React.useEffect useEffect}, + * which can be used to clean up the effect when the component unmounts. + * + * @see {@link https://react.dev/reference/react/useEffect React Docs} + */ +type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never }; +type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; + +// eslint-disable-next-line @definitelytyped/export-just-namespace +export = React; +export as namespace React; + +declare namespace React { + // + // React Elements + // ---------------------------------------------------------------------- + + /** + * Used to retrieve the possible components which accept a given set of props. + * + * Can be passed no type parameters to get a union of all possible components + * and tags. + * + * Is a superset of {@link ComponentType}. + * + * @template P The props to match against. If not passed, defaults to any. + * @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags. + * + * @example + * + * ```tsx + * // All components and tags (img, embed etc.) + * // which accept `src` + * type SrcComponents = ElementType<{ src: any }>; + * ``` + * + * @example + * + * ```tsx + * // All components + * type AllComponents = ElementType; + * ``` + * + * @example + * + * ```tsx + * // All custom components which match `src`, and tags which + * // match `src`, narrowed down to just `audio` and `embed` + * type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>; + * ``` + */ + type ElementType

= + | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] + | ComponentType

; + + /** + * Represents any user-defined component, either as a function or a class. + * + * Similar to {@link JSXElementConstructor}, but with extra properties like + * {@link FunctionComponent.defaultProps defaultProps }. + * + * @template P The props the component accepts. + * + * @see {@link ComponentClass} + * @see {@link FunctionComponent} + */ + type ComponentType

= ComponentClass

| FunctionComponent

; + + /** + * Represents any user-defined component, either as a function or a class. + * + * Similar to {@link ComponentType}, but without extra properties like + * {@link FunctionComponent.defaultProps defaultProps }. + * + * @template P The props the component accepts. + */ + type JSXElementConstructor

= + | (( + props: P, + ) => ReactElement | null) + // constructor signature must match React.Component + | (new(props: P, context: any) => Component); + + /** + * Created by {@link createRef}, or {@link useRef} when passed `null`. + * + * @template T The type of the ref's value. + * + * @example + * + * ```tsx + * const ref = createRef(); + * + * ref.current = document.createElement('div'); // Error + * ``` + */ + interface RefObject { + /** + * The current value of the ref. + */ + current: T; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { + } + /** + * A callback fired whenever the ref's value changes. + * + * @template T The type of the ref's value. + * + * @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs} + * + * @example + * + * ```tsx + *

console.log(node)} /> + * ``` + */ + type RefCallback = { + bivarianceHack( + instance: T | null, + ): + | void + | (() => VoidOrUndefinedOnly) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES + ]; + }["bivarianceHack"]; + + /** + * A union type of all possible shapes for React refs. + * + * @see {@link RefCallback} + * @see {@link RefObject} + */ + + type Ref = RefCallback | RefObject | null; + /** + * @deprecated Use `Ref` instead. String refs are no longer supported. + * If you're typing a library with support for React versions with string refs, use `RefAttributes['ref']` instead. + */ + type LegacyRef = Ref; + /** + * @deprecated Use `ComponentRef` instead + * + * Retrieves the type of the 'ref' prop for a given component type or tag name. + * + * @template C The component type. + * + * @example + * + * ```tsx + * type MyComponentRef = React.ElementRef; + * ``` + * + * @example + * + * ```tsx + * type DivRef = React.ElementRef<'div'>; + * ``` + */ + type ElementRef< + C extends + | ForwardRefExoticComponent + | { new(props: any, context: any): Component } + | ((props: any) => ReactElement | null) + | keyof JSX.IntrinsicElements, + > = ComponentRef; + + type ComponentState = any; + + /** + * A value which uniquely identifies a node among items in an array. + * + * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs} + */ + type Key = string | number | bigint; + + /** + * @internal The props any component can receive. + * You don't have to add this type. All components automatically accept these props. + * ```tsx + * const Component = () =>
; + * + * ``` + * + * WARNING: The implementation of a component will never have access to these attributes. + * The following example would be incorrect usage because {@link Component} would never have access to `key`: + * ```tsx + * const Component = (props: React.Attributes) => props.key; + * ``` + */ + interface Attributes { + key?: Key | null | undefined; + } + /** + * The props any component accepting refs can receive. + * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props. + * ```tsx + * const Component = forwardRef(() =>
); + * console.log(current)} /> + * ``` + * + * You only need this type if you manually author the types of props that need to be compatible with legacy refs. + * ```tsx + * interface Props extends React.RefAttributes {} + * declare const Component: React.FunctionComponent; + * ``` + * + * Otherwise it's simpler to directly use {@link Ref} since you can safely use the + * props type to describe to props that a consumer can pass to the component + * as well as describing the props the implementation of a component "sees". + * {@link RefAttributes} is generally not safe to describe both consumer and seen props. + * + * ```tsx + * interface Props extends { + * ref?: React.Ref | undefined; + * } + * declare const Component: React.FunctionComponent; + * ``` + * + * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs. + * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string` + * ```tsx + * const Component = (props: React.RefAttributes) => props.ref; + * ``` + */ + interface RefAttributes extends Attributes { + /** + * Allows getting a ref to the component instance. + * Once the component unmounts, React will set `ref.current` to `null` + * (or call the ref with `null` if you passed a callback ref). + * + * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} + */ + ref?: Ref | undefined; + } + + /** + * Represents the built-in attributes available to class components. + */ + interface ClassAttributes extends RefAttributes { + } + + /** + * Represents a JSX element. + * + * Where {@link ReactNode} represents everything that can be rendered, `ReactElement` + * only represents JSX. + * + * @template P The type of the props object + * @template T The type of the component or tag + * + * @example + * + * ```tsx + * const element: ReactElement =
; + * ``` + */ + interface ReactElement< + P = unknown, + T extends string | JSXElementConstructor = string | JSXElementConstructor, + > { + type: T; + props: P; + key: string | null; + } + + /** + * @deprecated + */ + interface ReactComponentElement< + T extends keyof JSX.IntrinsicElements | JSXElementConstructor, + P = Pick, Exclude, "key" | "ref">>, + > extends ReactElement> {} + + /** + * @deprecated Use `ReactElement>` + */ + interface FunctionComponentElement

extends ReactElement> { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined; + } + + /** + * @deprecated Use `ReactElement>` + */ + type CElement> = ComponentElement; + /** + * @deprecated Use `ReactElement>` + */ + interface ComponentElement> extends ReactElement> { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref?: Ref | undefined; + } + + /** + * @deprecated Use {@link ComponentElement} instead. + */ + type ClassicElement

= CElement>; + + // string fallback for custom web-components + /** + * @deprecated Use `ReactElement` + */ + interface DOMElement

| SVGAttributes, T extends Element> + extends ReactElement + { + /** + * @deprecated Use `element.props.ref` instead. + */ + ref: Ref; + } + + // ReactHTML for ReactHTMLElement + interface ReactHTMLElement extends DetailedReactHTMLElement, T> {} + + interface DetailedReactHTMLElement

, T extends HTMLElement> extends DOMElement { + type: HTMLElementType; + } + + // ReactSVG for ReactSVGElement + interface ReactSVGElement extends DOMElement, SVGElement> { + type: SVGElementType; + } + + interface ReactPortal extends ReactElement { + children: ReactNode; + } + + /** + * For internal usage only. + * Different release channels declare additional types of ReactNode this particular release channel accepts. + * App or library types should never augment this interface. + */ + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {} + + /** + * Represents all of the things React can render. + * + * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Typing children + * type Props = { children: ReactNode } + * + * const Component = ({ children }: Props) =>

{children}
+ * + * hello + * ``` + * + * @example + * + * ```tsx + * // Typing a custom element + * type Props = { customElement: ReactNode } + * + * const Component = ({ customElement }: Props) =>
{customElement}
+ * + * hello
} /> + * ``` + */ + // non-thenables need to be kept in sync with AwaitedReactNode + type ReactNode = + | ReactElement + | string + | number + | bigint + | Iterable + | ReactPortal + | boolean + | null + | undefined + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES + ] + | Promise; + + // + // Top Level API + // ---------------------------------------------------------------------- + + // DOM Elements + // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" + function createElement( + type: "input", + props?: InputHTMLAttributes & ClassAttributes | null, + ...children: ReactNode[] + ): DetailedReactHTMLElement, HTMLInputElement>; + function createElement

, T extends HTMLElement>( + type: HTMLElementType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): DetailedReactHTMLElement; + function createElement

, T extends SVGElement>( + type: SVGElementType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): ReactSVGElement; + function createElement

, T extends Element>( + type: string, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): DOMElement; + + // Custom components + + function createElement

( + type: FunctionComponent

, + props?: Attributes & P | null, + ...children: ReactNode[] + ): FunctionComponentElement

; + function createElement

, C extends ComponentClass

>( + type: ClassType, + props?: ClassAttributes & P | null, + ...children: ReactNode[] + ): CElement; + function createElement

( + type: FunctionComponent

| ComponentClass

| string, + props?: Attributes & P | null, + ...children: ReactNode[] + ): ReactElement

; + + // DOM Elements + // ReactHTMLElement + function cloneElement

, T extends HTMLElement>( + element: DetailedReactHTMLElement, + props?: P, + ...children: ReactNode[] + ): DetailedReactHTMLElement; + // ReactHTMLElement, less specific + function cloneElement

, T extends HTMLElement>( + element: ReactHTMLElement, + props?: P, + ...children: ReactNode[] + ): ReactHTMLElement; + // SVGElement + function cloneElement

, T extends SVGElement>( + element: ReactSVGElement, + props?: P, + ...children: ReactNode[] + ): ReactSVGElement; + // DOM Element (has to be the last, because type checking stops at first overload that fits) + function cloneElement

, T extends Element>( + element: DOMElement, + props?: DOMAttributes & P, + ...children: ReactNode[] + ): DOMElement; + + // Custom components + function cloneElement

( + element: FunctionComponentElement

, + props?: Partial

& Attributes, + ...children: ReactNode[] + ): FunctionComponentElement

; + function cloneElement>( + element: CElement, + props?: Partial

& ClassAttributes, + ...children: ReactNode[] + ): CElement; + function cloneElement

( + element: ReactElement

, + props?: Partial

& Attributes, + ...children: ReactNode[] + ): ReactElement

; + + /** + * Describes the props accepted by a Context {@link Provider}. + * + * @template T The type of the value the context provides. + */ + interface ProviderProps { + value: T; + children?: ReactNode | undefined; + } + + /** + * Describes the props accepted by a Context {@link Consumer}. + * + * @template T The type of the value the context provides. + */ + interface ConsumerProps { + children: (value: T) => ReactNode; + } + + /** + * An object masquerading as a component. These are created by functions + * like {@link forwardRef}, {@link memo}, and {@link createContext}. + * + * In order to make TypeScript work, we pretend that they are normal + * components. + * + * But they are, in fact, not callable - instead, they are objects which + * are treated specially by the renderer. + * + * @template P The props the component accepts. + */ + interface ExoticComponent

{ + (props: P): ReactElement | null; + readonly $$typeof: symbol; + } + + /** + * An {@link ExoticComponent} with a `displayName` property applied to it. + * + * @template P The props the component accepts. + */ + interface NamedExoticComponent

extends ExoticComponent

{ + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * An {@link ExoticComponent} with a `propTypes` property applied to it. + * + * @template P The props the component accepts. + */ + interface ProviderExoticComponent

extends ExoticComponent

{ + } + + /** + * Used to retrieve the type of a context object from a {@link Context}. + * + * @template C The context object. + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const MyContext = createContext({ foo: 'bar' }); + * + * type ContextType = ContextType; + * // ContextType = { foo: string } + * ``` + */ + type ContextType> = C extends Context ? T : never; + + /** + * Wraps your components to specify the value of this context for all components inside. + * + * @see {@link https://react.dev/reference/react/createContext#provider React Docs} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * + * function App() { + * return ( + * + * + * + * ); + * } + * ``` + */ + type Provider = ProviderExoticComponent>; + + /** + * The old way to read context, before {@link useContext} existed. + * + * @see {@link https://react.dev/reference/react/createContext#consumer React Docs} + * + * @example + * + * ```tsx + * import { UserContext } from './user-context'; + * + * function Avatar() { + * return ( + * + * {user => {user.name}} + * + * ); + * } + * ``` + */ + type Consumer = ExoticComponent>; + + /** + * Context lets components pass information deep down without explicitly + * passing props. + * + * Created from {@link createContext} + * + * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * ``` + */ + interface Context extends Provider { + Provider: Provider; + Consumer: Consumer; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * Lets you create a {@link Context} that components can provide or read. + * + * @param defaultValue The value you want the context to have when there is no matching + * {@link Provider} in the tree above the component reading the context. This is meant + * as a "last resort" fallback. + * + * @see {@link https://react.dev/reference/react/createContext#reference React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * import { createContext } from 'react'; + * + * const ThemeContext = createContext('light'); + * function App() { + * return ( + * + * + * + * ); + * } + * ``` + */ + function createContext( + // If you thought this should be optional, see + // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106 + defaultValue: T, + ): Context; + + function isValidElement

(object: {} | null | undefined): object is ReactElement

; + + const Children: { + map( + children: C | readonly C[], + fn: (child: C, index: number) => T, + ): C extends null | undefined ? C : Array>; + forEach(children: C | readonly C[], fn: (child: C, index: number) => void): void; + count(children: any): number; + only(children: C): C extends any[] ? never : C; + toArray(children: ReactNode | ReactNode[]): Array>; + }; + + export interface FragmentProps { + children?: React.ReactNode; + } + /** + * Lets you group elements without a wrapper node. + * + * @see {@link https://react.dev/reference/react/Fragment React Docs} + * + * @example + * + * ```tsx + * import { Fragment } from 'react'; + * + * + * Hello + * World + * + * ``` + * + * @example + * + * ```tsx + * // Using the <> shorthand syntax: + * + * <> + * Hello + * World + * + * ``` + */ + const Fragment: ExoticComponent; + + /** + * Lets you find common bugs in your components early during development. + * + * @see {@link https://react.dev/reference/react/StrictMode React Docs} + * + * @example + * + * ```tsx + * import { StrictMode } from 'react'; + * + * + * + * + * ``` + */ + const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>; + + /** + * The props accepted by {@link Suspense}. + * + * @see {@link https://react.dev/reference/react/Suspense React Docs} + */ + interface SuspenseProps { + children?: ReactNode | undefined; + + /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */ + fallback?: ReactNode; + + /** + * A name for this Suspense boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; + } + + /** + * Lets you display a fallback until its children have finished loading. + * + * @see {@link https://react.dev/reference/react/Suspense React Docs} + * + * @example + * + * ```tsx + * import { Suspense } from 'react'; + * + * }> + * + * + * ``` + */ + const Suspense: ExoticComponent; + const version: string; + + /** + * The callback passed to {@link ProfilerProps.onRender}. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + type ProfilerOnRenderCallback = ( + /** + * The string id prop of the {@link Profiler} tree that has just committed. This lets + * you identify which part of the tree was committed if you are using multiple + * profilers. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + id: string, + /** + * This lets you know whether the tree has just been mounted for the first time + * or re-rendered due to a change in props, state, or hooks. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + phase: "mount" | "update" | "nested-update", + /** + * The number of milliseconds spent rendering the {@link Profiler} and its descendants + * for the current update. This indicates how well the subtree makes use of + * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease + * significantly after the initial mount as many of the descendants will only need to + * re-render if their specific props change. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + actualDuration: number, + /** + * The number of milliseconds estimating how much time it would take to re-render the entire + * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most + * recent render durations of each component in the tree. This value estimates a worst-case + * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare + * {@link actualDuration} against it to see if memoization is working. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + baseDuration: number, + /** + * A numeric timestamp for when React began rendering the current update. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + startTime: number, + /** + * A numeric timestamp for when React committed the current update. This value is shared + * between all profilers in a commit, enabling them to be grouped if desirable. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + */ + commitTime: number, + ) => void; + + /** + * The props accepted by {@link Profiler}. + * + * @see {@link https://react.dev/reference/react/Profiler React Docs} + */ + interface ProfilerProps { + children?: ReactNode | undefined; + id: string; + onRender: ProfilerOnRenderCallback; + } + + /** + * Lets you measure rendering performance of a React tree programmatically. + * + * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} + * + * @example + * + * ```tsx + * + * + * + * ``` + */ + const Profiler: ExoticComponent; + + // + // Component API + // ---------------------------------------------------------------------- + + type ReactInstance = Component | Element; + + // Base component for plain JS classes + interface Component

extends ComponentLifecycle {} + class Component { + /** + * If set, `this.context` will be set at runtime to the current value of the given Context. + * + * @example + * + * ```ts + * type MyContext = number + * const Ctx = React.createContext(0) + * + * class Foo extends React.Component { + * static contextType = Ctx + * context!: React.ContextType + * render () { + * return <>My context's value: {this.context}; + * } + * } + * ``` + * + * @see {@link https://react.dev/reference/react/Component#static-contexttype} + */ + static contextType?: Context | undefined; + + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + static propTypes?: any; + + /** + * If using React Context, re-declare this in your class to be the + * `React.ContextType` of your `static contextType`. + * Should be used with type annotation or static contextType. + * + * @example + * ```ts + * static contextType = MyContext + * // For TS pre-3.7: + * context!: React.ContextType + * // For TS 3.7 and above: + * declare context: React.ContextType + * ``` + * + * @see {@link https://react.dev/reference/react/Component#context React Docs} + */ + context: unknown; + + // Keep in sync with constructor signature of JSXElementConstructor and ComponentClass. + constructor(props: P); + /** + * @param props + * @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified + * in `contextType`. + */ + // TODO: Ideally we'd infer the constructor signatur from `contextType`. + // Might be hard to ship without breaking existing code. + constructor(props: P, context: any); + + // We MUST keep setState() as a unified signature because it allows proper checking of the method return type. + // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257 + // Also, the ` | S` allows intellisense to not be dumbisense + setState( + state: ((prevState: Readonly, props: Readonly

) => Pick | S | null) | (Pick | S | null), + callback?: () => void, + ): void; + + forceUpdate(callback?: () => void): void; + render(): ReactNode; + + readonly props: Readonly

; + state: Readonly; + } + + class PureComponent

extends Component {} + + /** + * @deprecated Use `ClassicComponent` from `create-react-class` + * + * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} + * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} + */ + interface ClassicComponent

extends Component { + replaceState(nextState: S, callback?: () => void): void; + isMounted(): boolean; + getInitialState?(): S; + } + + // + // Class Interfaces + // ---------------------------------------------------------------------- + + /** + * Represents the type of a function component. Can optionally + * receive a type argument that represents the props the component + * receives. + * + * @template P The props the component accepts. + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} + * @alias for {@link FunctionComponent} + * + * @example + * + * ```tsx + * // With props: + * type Props = { name: string } + * + * const MyComponent: FC = (props) => { + * return

{props.name}
+ * } + * ``` + * + * @example + * + * ```tsx + * // Without props: + * const MyComponentWithoutProps: FC = () => { + * return
MyComponentWithoutProps
+ * } + * ``` + */ + type FC

= FunctionComponent

; + + /** + * Represents the type of a function component. Can optionally + * receive a type argument that represents the props the component + * accepts. + * + * @template P The props the component accepts. + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // With props: + * type Props = { name: string } + * + * const MyComponent: FunctionComponent = (props) => { + * return

{props.name}
+ * } + * ``` + * + * @example + * + * ```tsx + * // Without props: + * const MyComponentWithoutProps: FunctionComponent = () => { + * return
MyComponentWithoutProps
+ * } + * ``` + */ + interface FunctionComponent

{ + (props: P): ReactElement | null; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + * + * @example + * + * ```tsx + * + * const MyComponent: FC = () => { + * return

Hello!
+ * } + * + * MyComponent.displayName = 'MyAwesomeComponent' + * ``` + */ + displayName?: string | undefined; + } + + /** + * The type of the ref received by a {@link ForwardRefRenderFunction}. + * + * @see {@link ForwardRefRenderFunction} + */ + type ForwardedRef = ((instance: T | null) => void) | MutableRefObject | null; + + /** + * The type of the function passed to {@link forwardRef}. This is considered different + * to a normal {@link FunctionComponent} because it receives an additional argument, + * + * @param props Props passed to the component, if any. + * @param ref A ref forwarded to the component of type {@link ForwardedRef}. + * + * @template T The type of the forwarded ref. + * @template P The type of the props the component accepts. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} + * @see {@link forwardRef} + */ + interface ForwardRefRenderFunction { + (props: P, ref: ForwardedRef): ReactElement | null; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * Will show `ForwardRef(${Component.displayName || Component.name})` + * in devtools by default, but can be given its own specific name. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + } + + /** + * Represents a component class in React. + * + * @template P The props the component accepts. + * @template S The internal state of the component. + */ + interface ComponentClass

extends StaticLifecycle { + // constructor signature must match React.Component + new( + props: P, + /** + * Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified + * in `contextType`. + */ + context?: any, + ): Component; + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + contextType?: Context | undefined; + defaultProps?: Partial

| undefined; + /** + * Used in debugging messages. You might want to set it + * explicitly if you want to display a different name for + * debugging purposes. + * + * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} + */ + displayName?: string | undefined; + } + + /** + * @deprecated Use `ClassicComponentClass` from `create-react-class` + * + * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} + * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} + */ + interface ClassicComponentClass

extends ComponentClass

{ + new(props: P): ClassicComponent; + getDefaultProps?(): P; + } + + /** + * Used in {@link createElement} and {@link createFactory} to represent + * a class. + * + * An intersection type is used to infer multiple type parameters from + * a single argument, which is useful for many top-level API defs. + * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue} + * for more info. + */ + type ClassType, C extends ComponentClass

> = + & C + & (new(props: P, context: any) => T); + + // + // Component Specs and Lifecycle + // ---------------------------------------------------------------------- + + // This should actually be something like `Lifecycle | DeprecatedLifecycle`, + // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle + // methods are present. + interface ComponentLifecycle extends NewLifecycle, DeprecatedLifecycle { + /** + * Called immediately after a component is mounted. Setting state here will trigger re-rendering. + */ + componentDidMount?(): void; + /** + * Called to determine whether the change in props and state should trigger a re-render. + * + * `Component` always returns true. + * `PureComponent` implements a shallow comparison on props and state and returns true if any + * props or states have changed. + * + * If false is returned, {@link Component.render}, `componentWillUpdate` + * and `componentDidUpdate` will not be called. + */ + shouldComponentUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): boolean; + /** + * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as + * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`. + */ + componentWillUnmount?(): void; + /** + * Catches exceptions generated in descendant components. Unhandled exceptions will cause + * the entire component tree to unmount. + */ + componentDidCatch?(error: Error, errorInfo: ErrorInfo): void; + } + + // Unfortunately, we have no way of declaring that the component constructor must implement this + interface StaticLifecycle { + getDerivedStateFromProps?: GetDerivedStateFromProps | undefined; + getDerivedStateFromError?: GetDerivedStateFromError | undefined; + } + + type GetDerivedStateFromProps = + /** + * Returns an update to a component's state based on its new props and old state. + * + * Note: its presence prevents any of the deprecated lifecycle methods from being invoked + */ + (nextProps: Readonly

, prevState: S) => Partial | null; + + type GetDerivedStateFromError = + /** + * This lifecycle is invoked after an error has been thrown by a descendant component. + * It receives the error that was thrown as a parameter and should return a value to update state. + * + * Note: its presence prevents any of the deprecated lifecycle methods from being invoked + */ + (error: any) => Partial | null; + + // This should be "infer SS" but can't use it yet + interface NewLifecycle { + /** + * Runs before React applies the result of {@link Component.render render} to the document, and + * returns an object to be given to {@link componentDidUpdate}. Useful for saving + * things such as scroll position before {@link Component.render render} causes changes to it. + * + * Note: the presence of this method prevents any of the deprecated + * lifecycle events from running. + */ + getSnapshotBeforeUpdate?(prevProps: Readonly

, prevState: Readonly): SS | null; + /** + * Called immediately after updating occurs. Not called for the initial render. + * + * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null. + */ + componentDidUpdate?(prevProps: Readonly

, prevState: Readonly, snapshot?: SS): void; + } + + interface DeprecatedLifecycle { + /** + * Called immediately before mounting occurs, and before {@link Component.render}. + * Avoid introducing any side-effects or subscriptions in this method. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillMount?(): void; + /** + * Called immediately before mounting occurs, and before {@link Component.render}. + * Avoid introducing any side-effects or subscriptions in this method. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillMount?(): void; + /** + * Called when the component may be receiving new props. + * React may call this even if props have not changed, so be sure to compare new and existing + * props if you only want to handle changes. + * + * Calling {@link Component.setState} generally does not trigger this method. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; + /** + * Called when the component may be receiving new props. + * React may call this even if props have not changed, so be sure to compare new and existing + * props if you only want to handle changes. + * + * Calling {@link Component.setState} generally does not trigger this method. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; + /** + * Called immediately before rendering when new props or state is received. Not called for the initial render. + * + * Note: You cannot call {@link Component.setState} here. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17 + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; + /** + * Called immediately before rendering when new props or state is received. Not called for the initial render. + * + * Note: You cannot call {@link Component.setState} here. + * + * This method will not stop working in React 17. + * + * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} + * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents + * this from being invoked. + * + * @deprecated 16.3, use getSnapshotBeforeUpdate instead + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} + * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} + */ + UNSAFE_componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; + } + + function createRef(): RefObject; + + /** + * The type of the component returned from {@link forwardRef}. + * + * @template P The props the component accepts, if any. + * + * @see {@link ExoticComponent} + */ + interface ForwardRefExoticComponent

extends NamedExoticComponent

{ + /** + * Ignored by React. + * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release. + */ + propTypes?: any; + } + + /** + * Lets your component expose a DOM node to a parent component + * using a ref. + * + * @see {@link https://react.dev/reference/react/forwardRef React Docs} + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} + * + * @param render See the {@link ForwardRefRenderFunction}. + * + * @template T The type of the DOM node. + * @template P The props the component accepts, if any. + * + * @example + * + * ```tsx + * interface Props { + * children?: ReactNode; + * type: "submit" | "button"; + * } + * + * export const FancyButton = forwardRef((props, ref) => ( + * + * )); + * ``` + */ + function forwardRef( + render: ForwardRefRenderFunction>, + ): ForwardRefExoticComponent & RefAttributes>; + + /** + * Omits the 'ref' attribute from the given props object. + * + * @template Props The props object type. + */ + type PropsWithoutRef = + // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions. + // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types + // https://github.com/Microsoft/TypeScript/issues/28339 + Props extends any ? ("ref" extends keyof Props ? Omit : Props) : Props; + /** + * Ensures that the props do not include string ref, which cannot be forwarded + * @deprecated Use `Props` directly. `PropsWithRef` is just an alias for `Props` + */ + type PropsWithRef = Props; + + type PropsWithChildren

= P & { children?: ReactNode | undefined }; + + /** + * Used to retrieve the props a component accepts. Can either be passed a string, + * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React + * component. + * + * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef} + * instead of this type, as they let you be explicit about whether or not to include + * the `ref` prop. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentProps<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>

; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentProps = React.ComponentProps; + * ``` + */ + type ComponentProps> = T extends + JSXElementConstructor ? Props + : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] + : {}; + + /** + * Used to retrieve the props a component accepts with its ref. Can either be + * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the + * type of a React component. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentPropsWithRef<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithRef = React.ComponentPropsWithRef; + * ``` + */ + type ComponentPropsWithRef = T extends JSXElementConstructor + // If it's a class i.e. newable we're dealing with a class component + ? T extends abstract new(args: any) => any ? PropsWithoutRef & RefAttributes> + : Props + : ComponentProps; + /** + * Used to retrieve the props a custom component accepts with its ref. + * + * Unlike {@link ComponentPropsWithRef}, this only works with custom + * components, i.e. components you define yourself. This is to improve + * type-checking performance. + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef; + * ``` + */ + type CustomComponentPropsWithRef = T extends JSXElementConstructor + // If it's a class i.e. newable we're dealing with a class component + ? T extends abstract new(args: any) => any ? PropsWithoutRef & RefAttributes> + : Props + : never; + + /** + * Used to retrieve the props a component accepts without its ref. Can either be + * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the + * type of a React component. + * + * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} + * + * @example + * + * ```tsx + * // Retrieves the props an 'input' element accepts + * type InputProps = React.ComponentPropsWithoutRef<'input'>; + * ``` + * + * @example + * + * ```tsx + * const MyComponent = (props: { foo: number, bar: string }) =>
; + * + * // Retrieves the props 'MyComponent' accepts + * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef; + * ``` + */ + type ComponentPropsWithoutRef = PropsWithoutRef>; + + /** + * Retrieves the type of the 'ref' prop for a given component type or tag name. + * + * @template C The component type. + * + * @example + * + * ```tsx + * type MyComponentRef = React.ComponentRef; + * ``` + * + * @example + * + * ```tsx + * type DivRef = React.ComponentRef<'div'>; + * ``` + */ + type ComponentRef = ComponentPropsWithRef extends RefAttributes ? Method + : never; + + // will show `Memo(${Component.displayName || Component.name})` in devtools by default, + // but can be given its own specific name + type MemoExoticComponent> = NamedExoticComponent> & { + readonly type: T; + }; + + /** + * Lets you skip re-rendering a component when its props are unchanged. + * + * @see {@link https://react.dev/reference/react/memo React Docs} + * + * @param Component The component to memoize. + * @param propsAreEqual A function that will be used to determine if the props have changed. + * + * @example + * + * ```tsx + * import { memo } from 'react'; + * + * const SomeComponent = memo(function SomeComponent(props: { foo: string }) { + * // ... + * }); + * ``` + */ + function memo

( + Component: FunctionComponent

, + propsAreEqual?: (prevProps: Readonly

, nextProps: Readonly

) => boolean, + ): NamedExoticComponent

; + function memo>( + Component: T, + propsAreEqual?: (prevProps: Readonly>, nextProps: Readonly>) => boolean, + ): MemoExoticComponent; + + interface LazyExoticComponent> + extends ExoticComponent> + { + readonly _result: T; + } + + /** + * Lets you defer loading a component’s code until it is rendered for the first time. + * + * @see {@link https://react.dev/reference/react/lazy React Docs} + * + * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a + * then method). React will not call `load` until the first time you attempt to render the returned + * component. After React first calls load, it will wait for it to resolve, and then render the + * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s + * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects, + * React will throw the rejection reason for the nearest Error Boundary to handle. + * + * @example + * + * ```tsx + * import { lazy } from 'react'; + * + * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js')); + * ``` + */ + function lazy>( + load: () => Promise<{ default: T }>, + ): LazyExoticComponent; + + // + // React Hooks + // ---------------------------------------------------------------------- + + /** + * The instruction passed to a {@link Dispatch} function in {@link useState} + * to tell React what the next value of the {@link useState} should be. + * + * Often found wrapped in {@link Dispatch}. + * + * @template S The type of the state. + * + * @example + * + * ```tsx + * // This return type correctly represents the type of + * // `setCount` in the example below. + * const useCustomState = (): Dispatch> => { + * const [count, setCount] = useState(0); + * + * return setCount; + * } + * ``` + */ + type SetStateAction = S | ((prevState: S) => S); + + /** + * A function that can be used to update the state of a {@link useState} + * or {@link useReducer} hook. + */ + type Dispatch = (value: A) => void; + /** + * A {@link Dispatch} function can sometimes be called without any arguments. + */ + type DispatchWithoutAction = () => void; + // Limit the reducer to accept only 0 or 1 action arguments + // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type + type AnyActionArg = [] | [any]; + // Get the dispatch type from the reducer arguments (captures optional action argument correctly) + type ActionDispatch = (...args: ActionArg) => void; + // Unlike redux, the actions _can_ be anything + type Reducer = (prevState: S, action: A) => S; + // If useReducer accepts a reducer without action, dispatch may be called without any parameters. + type ReducerWithoutAction = (prevState: S) => S; + // types used to try and prevent the compiler from reducing S + // to a supertype common with the second argument to useReducer() + type ReducerState> = R extends Reducer ? S : never; + type DependencyList = readonly unknown[]; + + // NOTE: callbacks are _only_ allowed to return either void, or a destructor. + type EffectCallback = () => void | Destructor; + + /** + * @deprecated Use `RefObject` instead. + */ + interface MutableRefObject { + current: T; + } + + // This will technically work if you give a Consumer or Provider but it's deprecated and warns + /** + * Accepts a context object (the value returned from `React.createContext`) and returns the current + * context value, as given by the nearest context provider for the given context. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useContext} + */ + function useContext(context: Context /*, (not public API) observedBits?: number|boolean */): T; + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useState} + */ + function useState(initialState: S | (() => S)): [S, Dispatch>]; + // convenience overload when first argument is omitted + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useState} + */ + function useState(): [S | undefined, Dispatch>]; + /** + * An alternative to `useState`. + * + * `useReducer` is usually preferable to `useState` when you have complex state logic that involves + * multiple sub-values. It also lets you optimize performance for components that trigger deep + * updates because you can pass `dispatch` down instead of callbacks. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useReducer} + */ + function useReducer( + reducer: (prevState: S, ...args: A) => S, + initialState: S, + ): [S, ActionDispatch]; + /** + * An alternative to `useState`. + * + * `useReducer` is usually preferable to `useState` when you have complex state logic that involves + * multiple sub-values. It also lets you optimize performance for components that trigger deep + * updates because you can pass `dispatch` down instead of callbacks. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useReducer} + */ + function useReducer( + reducer: (prevState: S, ...args: A) => S, + initialArg: I, + init: (i: I) => S, + ): [S, ActionDispatch]; + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T): RefObject; + // convenience overload for refs given as a ref prop as they typically start with a null value + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T | null): RefObject; + // convenience overload for undefined initialValue + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useRef} + */ + function useRef(initialValue: T | undefined): RefObject; + /** + * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. + * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside + * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint. + * + * Prefer the standard `useEffect` when possible to avoid blocking visual updates. + * + * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as + * `componentDidMount` and `componentDidUpdate`. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useLayoutEffect} + */ + function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void; + /** + * Accepts a function that contains imperative, possibly effectful code. + * + * @param effect Imperative function that can return a cleanup function + * @param deps If present, effect will only activate if the values in the list change. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useEffect} + */ + function useEffect(effect: EffectCallback, deps?: DependencyList): void; + /** + * @see {@link https://react.dev/reference/react/useEffectEvent `useEffectEvent()` documentation} + * @version 19.2.0 + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + export function useEffectEvent(callback: T): T; + // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref + /** + * `useImperativeHandle` customizes the instance value that is exposed to parent components when using + * `ref`. As always, imperative code using refs should be avoided in most cases. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useImperativeHandle} + */ + function useImperativeHandle(ref: Ref | undefined, init: () => R, deps?: DependencyList): void; + // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key + // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y. + /** + * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs` + * has changed. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useCallback} + */ + // A specific function type would not trigger implicit any. + // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types. + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + function useCallback(callback: T, deps: DependencyList): T; + /** + * `useMemo` will only recompute the memoized value when one of the `deps` has changed. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useMemo} + */ + // allow undefined, but don't make it optional as that is very likely a mistake + function useMemo(factory: () => T, deps: DependencyList): T; + /** + * `useDebugValue` can be used to display a label for custom hooks in React DevTools. + * + * NOTE: We don’t recommend adding debug values to every custom hook. + * It’s most valuable for custom hooks that are part of shared libraries. + * + * @version 16.8.0 + * @see {@link https://react.dev/reference/react/useDebugValue} + */ + // the name of the custom hook is itself derived from the function name at runtime: + // it's just the function name without the "use" prefix. + function useDebugValue(value: T, format?: (value: T) => any): void; + + export type TransitionFunction = () => VoidOrUndefinedOnly | Promise; + // strange definition to allow vscode to show documentation on the invocation + export interface TransitionStartFunction { + /** + * State updates caused inside the callback are allowed to be deferred. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @param callback A function which causes state updates that can be deferred. + */ + (callback: TransitionFunction): void; + } + + /** + * Returns a deferred version of the value that may “lag behind” it. + * + * This is commonly used to keep the interface responsive when you have something that renders immediately + * based on user input and something that needs to wait for a data fetch. + * + * A good example of this is a text input. + * + * @param value The value that is going to be deferred + * @param initialValue A value to use during the initial render of a component. If this option is omitted, `useDeferredValue` will not defer during the initial render, because there’s no previous version of `value` that it can render instead. + * + * @see {@link https://react.dev/reference/react/useDeferredValue} + */ + export function useDeferredValue(value: T, initialValue?: T): T; + + /** + * Allows components to avoid undesirable loading states by waiting for content to load + * before transitioning to the next screen. It also allows components to defer slower, + * data fetching updates until subsequent renders so that more crucial updates can be + * rendered immediately. + * + * The `useTransition` hook returns two values in an array. + * + * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish. + * The second is a function that takes a callback. We can use it to tell React which state we want to defer. + * + * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** + * + * @see {@link https://react.dev/reference/react/useTransition} + */ + export function useTransition(): [boolean, TransitionStartFunction]; + + /** + * Similar to `useTransition` but allows uses where hooks are not available. + * + * @param callback A function which causes state updates that can be deferred. + */ + export function startTransition(scope: TransitionFunction): void; + + /** + * Wrap any code rendering and triggering updates to your components into `act()` calls. + * + * Ensures that the behavior in your tests matches what happens in the browser + * more closely by executing pending `useEffect`s before returning. This also + * reduces the amount of re-renders done. + * + * @param callback A synchronous, void callback that will execute as a single, complete React commit. + * + * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks + */ + // NOTES + // - the order of these signatures matters - typescript will check the signatures in source order. + // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with + // `strictNullChecks: false`. + // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true` + // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. + export function act(callback: () => VoidOrUndefinedOnly): void; + export function act(callback: () => T | Promise): Promise; + + export function useId(): string; + + /** + * @param effect Imperative function that can return a cleanup function + * @param deps If present, effect will only activate if the values in the list change. + * + * @see {@link https://github.com/facebook/react/pull/21913} + */ + export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void; + + /** + * @param subscribe + * @param getSnapshot + * + * @see {@link https://github.com/reactwg/react-18/discussions/86} + */ + // keep in sync with `useSyncExternalStore` from `use-sync-external-store` + export function useSyncExternalStore( + subscribe: (onStoreChange: () => void) => () => void, + getSnapshot: () => Snapshot, + getServerSnapshot?: () => Snapshot, + ): Snapshot; + + export function useOptimistic( + passthrough: State, + ): [State, (action: State | ((pendingState: State) => State)) => void]; + export function useOptimistic( + passthrough: State, + reducer: (state: State, action: Action) => State, + ): [State, (action: Action) => void]; + + interface UntrackedReactPromise extends PromiseLike { + status?: void; + } + + export interface PendingReactPromise extends PromiseLike { + status: "pending"; + } + + export interface FulfilledReactPromise extends PromiseLike { + status: "fulfilled"; + value: T; + } + + export interface RejectedReactPromise extends PromiseLike { + status: "rejected"; + reason: unknown; + } + + export type ReactPromise = + | UntrackedReactPromise + | PendingReactPromise + | FulfilledReactPromise + | RejectedReactPromise; + + export type Usable = ReactPromise | Context; + + export function use(usable: Usable): T; + + export function useActionState( + action: (state: Awaited) => State | Promise, + initialState: Awaited, + permalink?: string, + ): [state: Awaited, dispatch: () => void, isPending: boolean]; + export function useActionState( + action: (state: Awaited, payload: Payload) => State | Promise, + initialState: Awaited, + permalink?: string, + ): [state: Awaited, dispatch: (payload: Payload) => void, isPending: boolean]; + + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + export function cache(fn: CachedFunction): CachedFunction; + + export interface CacheSignal {} + /** + * @version 19.2.0 + */ + export function cacheSignal(): null | CacheSignal; + + export interface ActivityProps { + /** + * @default "visible" + */ + mode?: + | "hidden" + | "visible" + | undefined; + /** + * A name for this Activity boundary for instrumentation purposes. + * The name will help identify this boundary in React DevTools. + */ + name?: string | undefined; + children: ReactNode; + } + + /** + * @see {@link https://react.dev/reference/react/Activity `` documentation} + * @version 19.2.0 + */ + export const Activity: ExoticComponent; + + /** + * Warning: Only available in development builds. + * + * @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs} + * @version 19.1.0 + */ + function captureOwnerStack(): string | null; + + // + // Event System + // ---------------------------------------------------------------------- + // TODO: change any to unknown when moving to TS v3 + interface BaseSyntheticEvent { + nativeEvent: E; + currentTarget: C; + target: T; + bubbles: boolean; + cancelable: boolean; + defaultPrevented: boolean; + eventPhase: number; + isTrusted: boolean; + preventDefault(): void; + isDefaultPrevented(): boolean; + stopPropagation(): void; + isPropagationStopped(): boolean; + persist(): void; + timeStamp: number; + type: string; + } + + /** + * currentTarget - a reference to the element on which the event listener is registered. + * + * target - a reference to the element from which the event was originally dispatched. + * This might be a child element to the element on which the event listener is registered. + * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 + */ + interface SyntheticEvent extends BaseSyntheticEvent {} + + interface ClipboardEvent extends SyntheticEvent { + clipboardData: DataTransfer; + } + + interface CompositionEvent extends SyntheticEvent { + data: string; + } + + interface DragEvent extends MouseEvent { + dataTransfer: DataTransfer; + } + + interface PointerEvent extends MouseEvent { + pointerId: number; + pressure: number; + tangentialPressure: number; + tiltX: number; + tiltY: number; + twist: number; + width: number; + height: number; + pointerType: "mouse" | "pen" | "touch"; + isPrimary: boolean; + } + + interface FocusEvent extends SyntheticEvent { + relatedTarget: (EventTarget & RelatedTarget) | null; + target: EventTarget & Target; + } + + interface FormEvent extends SyntheticEvent { + } + + interface InvalidEvent extends SyntheticEvent { + target: EventTarget & T; + } + + interface ChangeEvent extends SyntheticEvent { + target: EventTarget & T; + } + + interface InputEvent extends SyntheticEvent { + data: string; + } + + export type ModifierKey = + | "Alt" + | "AltGraph" + | "CapsLock" + | "Control" + | "Fn" + | "FnLock" + | "Hyper" + | "Meta" + | "NumLock" + | "ScrollLock" + | "Shift" + | "Super" + | "Symbol" + | "SymbolLock"; + + interface KeyboardEvent extends UIEvent { + altKey: boolean; + /** @deprecated */ + charCode: number; + ctrlKey: boolean; + code: string; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + /** + * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values + */ + key: string; + /** @deprecated */ + keyCode: number; + locale: string; + location: number; + metaKey: boolean; + repeat: boolean; + shiftKey: boolean; + /** @deprecated */ + which: number; + } + + interface MouseEvent extends UIEvent { + altKey: boolean; + button: number; + buttons: number; + clientX: number; + clientY: number; + ctrlKey: boolean; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + metaKey: boolean; + movementX: number; + movementY: number; + pageX: number; + pageY: number; + relatedTarget: EventTarget | null; + screenX: number; + screenY: number; + shiftKey: boolean; + } + + interface TouchEvent extends UIEvent { + altKey: boolean; + changedTouches: TouchList; + ctrlKey: boolean; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: ModifierKey): boolean; + metaKey: boolean; + shiftKey: boolean; + targetTouches: TouchList; + touches: TouchList; + } + + interface UIEvent extends SyntheticEvent { + detail: number; + view: AbstractView; + } + + interface WheelEvent extends MouseEvent { + deltaMode: number; + deltaX: number; + deltaY: number; + deltaZ: number; + } + + interface AnimationEvent extends SyntheticEvent { + animationName: string; + elapsedTime: number; + pseudoElement: string; + } + + interface ToggleEvent extends SyntheticEvent { + oldState: "closed" | "open"; + newState: "closed" | "open"; + } + + interface TransitionEvent extends SyntheticEvent { + elapsedTime: number; + propertyName: string; + pseudoElement: string; + } + + // + // Event Handler Types + // ---------------------------------------------------------------------- + + type EventHandler> = { bivarianceHack(event: E): void }["bivarianceHack"]; + + type ReactEventHandler = EventHandler>; + + type ClipboardEventHandler = EventHandler>; + type CompositionEventHandler = EventHandler>; + type DragEventHandler = EventHandler>; + type FocusEventHandler = EventHandler>; + type FormEventHandler = EventHandler>; + type ChangeEventHandler = EventHandler>; + type InputEventHandler = EventHandler>; + type KeyboardEventHandler = EventHandler>; + type MouseEventHandler = EventHandler>; + type TouchEventHandler = EventHandler>; + type PointerEventHandler = EventHandler>; + type UIEventHandler = EventHandler>; + type WheelEventHandler = EventHandler>; + type AnimationEventHandler = EventHandler>; + type ToggleEventHandler = EventHandler>; + type TransitionEventHandler = EventHandler>; + + // + // Props / DOM Attributes + // ---------------------------------------------------------------------- + + interface HTMLProps extends AllHTMLAttributes, ClassAttributes { + } + + type DetailedHTMLProps, T> = ClassAttributes & E; + + interface SVGProps extends SVGAttributes, ClassAttributes { + } + + interface SVGLineElementAttributes extends SVGProps {} + interface SVGTextElementAttributes extends SVGProps {} + + interface DOMAttributes { + children?: ReactNode | undefined; + dangerouslySetInnerHTML?: { + // Should be InnerHTML['innerHTML']. + // But unfortunately we're mixing renderer-specific type declarations. + __html: string | TrustedHTML; + } | undefined; + + // Clipboard Events + onCopy?: ClipboardEventHandler | undefined; + onCopyCapture?: ClipboardEventHandler | undefined; + onCut?: ClipboardEventHandler | undefined; + onCutCapture?: ClipboardEventHandler | undefined; + onPaste?: ClipboardEventHandler | undefined; + onPasteCapture?: ClipboardEventHandler | undefined; + + // Composition Events + onCompositionEnd?: CompositionEventHandler | undefined; + onCompositionEndCapture?: CompositionEventHandler | undefined; + onCompositionStart?: CompositionEventHandler | undefined; + onCompositionStartCapture?: CompositionEventHandler | undefined; + onCompositionUpdate?: CompositionEventHandler | undefined; + onCompositionUpdateCapture?: CompositionEventHandler | undefined; + + // Focus Events + onFocus?: FocusEventHandler | undefined; + onFocusCapture?: FocusEventHandler | undefined; + onBlur?: FocusEventHandler | undefined; + onBlurCapture?: FocusEventHandler | undefined; + + // Form Events + onChange?: FormEventHandler | undefined; + onChangeCapture?: FormEventHandler | undefined; + onBeforeInput?: InputEventHandler | undefined; + onBeforeInputCapture?: FormEventHandler | undefined; + onInput?: FormEventHandler | undefined; + onInputCapture?: FormEventHandler | undefined; + onReset?: FormEventHandler | undefined; + onResetCapture?: FormEventHandler | undefined; + onSubmit?: FormEventHandler | undefined; + onSubmitCapture?: FormEventHandler | undefined; + onInvalid?: FormEventHandler | undefined; + onInvalidCapture?: FormEventHandler | undefined; + + // Image Events + onLoad?: ReactEventHandler | undefined; + onLoadCapture?: ReactEventHandler | undefined; + onError?: ReactEventHandler | undefined; // also a Media Event + onErrorCapture?: ReactEventHandler | undefined; // also a Media Event + + // Keyboard Events + onKeyDown?: KeyboardEventHandler | undefined; + onKeyDownCapture?: KeyboardEventHandler | undefined; + /** @deprecated Use `onKeyUp` or `onKeyDown` instead */ + onKeyPress?: KeyboardEventHandler | undefined; + /** @deprecated Use `onKeyUpCapture` or `onKeyDownCapture` instead */ + onKeyPressCapture?: KeyboardEventHandler | undefined; + onKeyUp?: KeyboardEventHandler | undefined; + onKeyUpCapture?: KeyboardEventHandler | undefined; + + // Media Events + onAbort?: ReactEventHandler | undefined; + onAbortCapture?: ReactEventHandler | undefined; + onCanPlay?: ReactEventHandler | undefined; + onCanPlayCapture?: ReactEventHandler | undefined; + onCanPlayThrough?: ReactEventHandler | undefined; + onCanPlayThroughCapture?: ReactEventHandler | undefined; + onDurationChange?: ReactEventHandler | undefined; + onDurationChangeCapture?: ReactEventHandler | undefined; + onEmptied?: ReactEventHandler | undefined; + onEmptiedCapture?: ReactEventHandler | undefined; + onEncrypted?: ReactEventHandler | undefined; + onEncryptedCapture?: ReactEventHandler | undefined; + onEnded?: ReactEventHandler | undefined; + onEndedCapture?: ReactEventHandler | undefined; + onLoadedData?: ReactEventHandler | undefined; + onLoadedDataCapture?: ReactEventHandler | undefined; + onLoadedMetadata?: ReactEventHandler | undefined; + onLoadedMetadataCapture?: ReactEventHandler | undefined; + onLoadStart?: ReactEventHandler | undefined; + onLoadStartCapture?: ReactEventHandler | undefined; + onPause?: ReactEventHandler | undefined; + onPauseCapture?: ReactEventHandler | undefined; + onPlay?: ReactEventHandler | undefined; + onPlayCapture?: ReactEventHandler | undefined; + onPlaying?: ReactEventHandler | undefined; + onPlayingCapture?: ReactEventHandler | undefined; + onProgress?: ReactEventHandler | undefined; + onProgressCapture?: ReactEventHandler | undefined; + onRateChange?: ReactEventHandler | undefined; + onRateChangeCapture?: ReactEventHandler | undefined; + onSeeked?: ReactEventHandler | undefined; + onSeekedCapture?: ReactEventHandler | undefined; + onSeeking?: ReactEventHandler | undefined; + onSeekingCapture?: ReactEventHandler | undefined; + onStalled?: ReactEventHandler | undefined; + onStalledCapture?: ReactEventHandler | undefined; + onSuspend?: ReactEventHandler | undefined; + onSuspendCapture?: ReactEventHandler | undefined; + onTimeUpdate?: ReactEventHandler | undefined; + onTimeUpdateCapture?: ReactEventHandler | undefined; + onVolumeChange?: ReactEventHandler | undefined; + onVolumeChangeCapture?: ReactEventHandler | undefined; + onWaiting?: ReactEventHandler | undefined; + onWaitingCapture?: ReactEventHandler | undefined; + + // MouseEvents + onAuxClick?: MouseEventHandler | undefined; + onAuxClickCapture?: MouseEventHandler | undefined; + onClick?: MouseEventHandler | undefined; + onClickCapture?: MouseEventHandler | undefined; + onContextMenu?: MouseEventHandler | undefined; + onContextMenuCapture?: MouseEventHandler | undefined; + onDoubleClick?: MouseEventHandler | undefined; + onDoubleClickCapture?: MouseEventHandler | undefined; + onDrag?: DragEventHandler | undefined; + onDragCapture?: DragEventHandler | undefined; + onDragEnd?: DragEventHandler | undefined; + onDragEndCapture?: DragEventHandler | undefined; + onDragEnter?: DragEventHandler | undefined; + onDragEnterCapture?: DragEventHandler | undefined; + onDragExit?: DragEventHandler | undefined; + onDragExitCapture?: DragEventHandler | undefined; + onDragLeave?: DragEventHandler | undefined; + onDragLeaveCapture?: DragEventHandler | undefined; + onDragOver?: DragEventHandler | undefined; + onDragOverCapture?: DragEventHandler | undefined; + onDragStart?: DragEventHandler | undefined; + onDragStartCapture?: DragEventHandler | undefined; + onDrop?: DragEventHandler | undefined; + onDropCapture?: DragEventHandler | undefined; + onMouseDown?: MouseEventHandler | undefined; + onMouseDownCapture?: MouseEventHandler | undefined; + onMouseEnter?: MouseEventHandler | undefined; + onMouseLeave?: MouseEventHandler | undefined; + onMouseMove?: MouseEventHandler | undefined; + onMouseMoveCapture?: MouseEventHandler | undefined; + onMouseOut?: MouseEventHandler | undefined; + onMouseOutCapture?: MouseEventHandler | undefined; + onMouseOver?: MouseEventHandler | undefined; + onMouseOverCapture?: MouseEventHandler | undefined; + onMouseUp?: MouseEventHandler | undefined; + onMouseUpCapture?: MouseEventHandler | undefined; + + // Selection Events + onSelect?: ReactEventHandler | undefined; + onSelectCapture?: ReactEventHandler | undefined; + + // Touch Events + onTouchCancel?: TouchEventHandler | undefined; + onTouchCancelCapture?: TouchEventHandler | undefined; + onTouchEnd?: TouchEventHandler | undefined; + onTouchEndCapture?: TouchEventHandler | undefined; + onTouchMove?: TouchEventHandler | undefined; + onTouchMoveCapture?: TouchEventHandler | undefined; + onTouchStart?: TouchEventHandler | undefined; + onTouchStartCapture?: TouchEventHandler | undefined; + + // Pointer Events + onPointerDown?: PointerEventHandler | undefined; + onPointerDownCapture?: PointerEventHandler | undefined; + onPointerMove?: PointerEventHandler | undefined; + onPointerMoveCapture?: PointerEventHandler | undefined; + onPointerUp?: PointerEventHandler | undefined; + onPointerUpCapture?: PointerEventHandler | undefined; + onPointerCancel?: PointerEventHandler | undefined; + onPointerCancelCapture?: PointerEventHandler | undefined; + onPointerEnter?: PointerEventHandler | undefined; + onPointerLeave?: PointerEventHandler | undefined; + onPointerOver?: PointerEventHandler | undefined; + onPointerOverCapture?: PointerEventHandler | undefined; + onPointerOut?: PointerEventHandler | undefined; + onPointerOutCapture?: PointerEventHandler | undefined; + onGotPointerCapture?: PointerEventHandler | undefined; + onGotPointerCaptureCapture?: PointerEventHandler | undefined; + onLostPointerCapture?: PointerEventHandler | undefined; + onLostPointerCaptureCapture?: PointerEventHandler | undefined; + + // UI Events + onScroll?: UIEventHandler | undefined; + onScrollCapture?: UIEventHandler | undefined; + onScrollEnd?: UIEventHandler | undefined; + onScrollEndCapture?: UIEventHandler | undefined; + + // Wheel Events + onWheel?: WheelEventHandler | undefined; + onWheelCapture?: WheelEventHandler | undefined; + + // Animation Events + onAnimationStart?: AnimationEventHandler | undefined; + onAnimationStartCapture?: AnimationEventHandler | undefined; + onAnimationEnd?: AnimationEventHandler | undefined; + onAnimationEndCapture?: AnimationEventHandler | undefined; + onAnimationIteration?: AnimationEventHandler | undefined; + onAnimationIterationCapture?: AnimationEventHandler | undefined; + + // Toggle Events + onToggle?: ToggleEventHandler | undefined; + onBeforeToggle?: ToggleEventHandler | undefined; + + // Transition Events + onTransitionCancel?: TransitionEventHandler | undefined; + onTransitionCancelCapture?: TransitionEventHandler | undefined; + onTransitionEnd?: TransitionEventHandler | undefined; + onTransitionEndCapture?: TransitionEventHandler | undefined; + onTransitionRun?: TransitionEventHandler | undefined; + onTransitionRunCapture?: TransitionEventHandler | undefined; + onTransitionStart?: TransitionEventHandler | undefined; + onTransitionStartCapture?: TransitionEventHandler | undefined; + } + + export interface CSSProperties extends CSS.Properties { + /** + * The index signature was removed to enable closed typing for style + * using CSSType. You're able to use type assertion or module augmentation + * to add properties or an index signature of your own. + * + * For examples and more information, visit: + * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors + */ + } + + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ + interface AriaAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + "aria-activedescendant"?: string | undefined; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + "aria-atomic"?: Booleanish | undefined; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + /** + * Defines a string value that labels the current element, which is intended to be converted into Braille. + * @see aria-label. + */ + "aria-braillelabel"?: string | undefined; + /** + * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. + * @see aria-roledescription. + */ + "aria-brailleroledescription"?: string | undefined; + "aria-busy"?: Booleanish | undefined; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + "aria-colcount"?: number | undefined; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + "aria-colindex"?: number | undefined; + /** + * Defines a human readable text alternative of aria-colindex. + * @see aria-rowindextext. + */ + "aria-colindextext"?: string | undefined; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + "aria-colspan"?: number | undefined; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + "aria-controls"?: string | undefined; + /** Indicates the element that represents the current item within a container or set of related elements. */ + "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + "aria-describedby"?: string | undefined; + /** + * Defines a string value that describes or annotates the current element. + * @see related aria-describedby. + */ + "aria-description"?: string | undefined; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + "aria-details"?: string | undefined; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + "aria-disabled"?: Booleanish | undefined; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + "aria-errormessage"?: string | undefined; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + "aria-expanded"?: Booleanish | undefined; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + "aria-flowto"?: string | undefined; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + "aria-grabbed"?: Booleanish | undefined; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + "aria-hidden"?: Booleanish | undefined; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + "aria-keyshortcuts"?: string | undefined; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + "aria-label"?: string | undefined; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + "aria-labelledby"?: string | undefined; + /** Defines the hierarchical level of an element within a structure. */ + "aria-level"?: number | undefined; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + "aria-live"?: "off" | "assertive" | "polite" | undefined; + /** Indicates whether an element is modal when displayed. */ + "aria-modal"?: Booleanish | undefined; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + "aria-multiline"?: Booleanish | undefined; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + "aria-multiselectable"?: Booleanish | undefined; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + "aria-orientation"?: "horizontal" | "vertical" | undefined; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + "aria-owns"?: string | undefined; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + "aria-placeholder"?: string | undefined; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + "aria-posinset"?: number | undefined; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + "aria-readonly"?: Booleanish | undefined; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + "aria-relevant"?: + | "additions" + | "additions removals" + | "additions text" + | "all" + | "removals" + | "removals additions" + | "removals text" + | "text" + | "text additions" + | "text removals" + | undefined; + /** Indicates that user input is required on the element before a form may be submitted. */ + "aria-required"?: Booleanish | undefined; + /** Defines a human-readable, author-localized description for the role of an element. */ + "aria-roledescription"?: string | undefined; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + "aria-rowcount"?: number | undefined; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + "aria-rowindex"?: number | undefined; + /** + * Defines a human readable text alternative of aria-rowindex. + * @see aria-colindextext. + */ + "aria-rowindextext"?: string | undefined; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + "aria-rowspan"?: number | undefined; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + "aria-selected"?: Booleanish | undefined; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + "aria-setsize"?: number | undefined; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; + /** Defines the maximum allowed value for a range widget. */ + "aria-valuemax"?: number | undefined; + /** Defines the minimum allowed value for a range widget. */ + "aria-valuemin"?: number | undefined; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + "aria-valuenow"?: number | undefined; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + "aria-valuetext"?: string | undefined; + } + + // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions + type AriaRole = + | "alert" + | "alertdialog" + | "application" + | "article" + | "banner" + | "button" + | "cell" + | "checkbox" + | "columnheader" + | "combobox" + | "complementary" + | "contentinfo" + | "definition" + | "dialog" + | "directory" + | "document" + | "feed" + | "figure" + | "form" + | "grid" + | "gridcell" + | "group" + | "heading" + | "img" + | "link" + | "list" + | "listbox" + | "listitem" + | "log" + | "main" + | "marquee" + | "math" + | "menu" + | "menubar" + | "menuitem" + | "menuitemcheckbox" + | "menuitemradio" + | "navigation" + | "none" + | "note" + | "option" + | "presentation" + | "progressbar" + | "radio" + | "radiogroup" + | "region" + | "row" + | "rowgroup" + | "rowheader" + | "scrollbar" + | "search" + | "searchbox" + | "separator" + | "slider" + | "spinbutton" + | "status" + | "switch" + | "tab" + | "table" + | "tablist" + | "tabpanel" + | "term" + | "textbox" + | "timer" + | "toolbar" + | "tooltip" + | "tree" + | "treegrid" + | "treeitem" + | (string & {}); + + interface HTMLAttributes extends AriaAttributes, DOMAttributes { + // React-specific Attributes + defaultChecked?: boolean | undefined; + defaultValue?: string | number | readonly string[] | undefined; + suppressContentEditableWarning?: boolean | undefined; + suppressHydrationWarning?: boolean | undefined; + + // Standard HTML Attributes + accessKey?: string | undefined; + autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}); + autoFocus?: boolean | undefined; + className?: string | undefined; + contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined; + contextMenu?: string | undefined; + dir?: string | undefined; + draggable?: Booleanish | undefined; + enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; + hidden?: boolean | undefined; + id?: string | undefined; + lang?: string | undefined; + nonce?: string | undefined; + slot?: string | undefined; + spellCheck?: Booleanish | undefined; + style?: CSSProperties | undefined; + tabIndex?: number | undefined; + title?: string | undefined; + translate?: "yes" | "no" | undefined; + + // Unknown + radioGroup?: string | undefined; // , + + // WAI-ARIA + role?: AriaRole | undefined; + + // RDFa Attributes + about?: string | undefined; + content?: string | undefined; + datatype?: string | undefined; + inlist?: any; + prefix?: string | undefined; + property?: string | undefined; + rel?: string | undefined; + resource?: string | undefined; + rev?: string | undefined; + typeof?: string | undefined; + vocab?: string | undefined; + + // Non-standard Attributes + autoCorrect?: string | undefined; + autoSave?: string | undefined; + color?: string | undefined; + itemProp?: string | undefined; + itemScope?: boolean | undefined; + itemType?: string | undefined; + itemID?: string | undefined; + itemRef?: string | undefined; + results?: number | undefined; + security?: string | undefined; + unselectable?: "on" | "off" | undefined; + + // Popover API + popover?: "" | "auto" | "manual" | "hint" | undefined; + popoverTargetAction?: "toggle" | "show" | "hide" | undefined; + popoverTarget?: string | undefined; + + // Living Standard + /** + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert + */ + inert?: boolean | undefined; + /** + * Hints at the type of data that might be entered by the user while editing the element or its contents + * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute} + */ + inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; + /** + * Specify that a standard HTML element should behave like a defined custom built-in element + * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is} + */ + is?: string | undefined; + /** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts} + */ + exportparts?: string | undefined; + /** + * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part} + */ + part?: string | undefined; + } + + /** + * For internal usage only. + * Different release channels declare additional types of ReactNode this particular release channel accepts. + * App or library types should never augment this interface. + */ + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {} + + interface AllHTMLAttributes extends HTMLAttributes { + // Standard HTML Attributes + accept?: string | undefined; + acceptCharset?: string | undefined; + action?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + allowFullScreen?: boolean | undefined; + allowTransparency?: boolean | undefined; + alt?: string | undefined; + as?: string | undefined; + async?: boolean | undefined; + autoComplete?: string | undefined; + autoPlay?: boolean | undefined; + capture?: boolean | "user" | "environment" | undefined; + cellPadding?: number | string | undefined; + cellSpacing?: number | string | undefined; + charSet?: string | undefined; + challenge?: string | undefined; + checked?: boolean | undefined; + cite?: string | undefined; + classID?: string | undefined; + cols?: number | undefined; + colSpan?: number | undefined; + controls?: boolean | undefined; + coords?: string | undefined; + crossOrigin?: CrossOrigin; + data?: string | undefined; + dateTime?: string | undefined; + default?: boolean | undefined; + defer?: boolean | undefined; + disabled?: boolean | undefined; + download?: any; + encType?: string | undefined; + form?: string | undefined; + formAction?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + frameBorder?: number | string | undefined; + headers?: string | undefined; + height?: number | string | undefined; + high?: number | undefined; + href?: string | undefined; + hrefLang?: string | undefined; + htmlFor?: string | undefined; + httpEquiv?: string | undefined; + integrity?: string | undefined; + keyParams?: string | undefined; + keyType?: string | undefined; + kind?: string | undefined; + label?: string | undefined; + list?: string | undefined; + loop?: boolean | undefined; + low?: number | undefined; + manifest?: string | undefined; + marginHeight?: number | undefined; + marginWidth?: number | undefined; + max?: number | string | undefined; + maxLength?: number | undefined; + media?: string | undefined; + mediaGroup?: string | undefined; + method?: string | undefined; + min?: number | string | undefined; + minLength?: number | undefined; + multiple?: boolean | undefined; + muted?: boolean | undefined; + name?: string | undefined; + noValidate?: boolean | undefined; + open?: boolean | undefined; + optimum?: number | undefined; + pattern?: string | undefined; + placeholder?: string | undefined; + playsInline?: boolean | undefined; + poster?: string | undefined; + preload?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + reversed?: boolean | undefined; + rows?: number | undefined; + rowSpan?: number | undefined; + sandbox?: string | undefined; + scope?: string | undefined; + scoped?: boolean | undefined; + scrolling?: string | undefined; + seamless?: boolean | undefined; + selected?: boolean | undefined; + shape?: string | undefined; + size?: number | undefined; + sizes?: string | undefined; + span?: number | undefined; + src?: string | undefined; + srcDoc?: string | undefined; + srcLang?: string | undefined; + srcSet?: string | undefined; + start?: number | undefined; + step?: number | string | undefined; + summary?: string | undefined; + target?: string | undefined; + type?: string | undefined; + useMap?: string | undefined; + value?: string | readonly string[] | number | undefined; + width?: number | string | undefined; + wmode?: string | undefined; + wrap?: string | undefined; + } + + type HTMLAttributeReferrerPolicy = + | "" + | "no-referrer" + | "no-referrer-when-downgrade" + | "origin" + | "origin-when-cross-origin" + | "same-origin" + | "strict-origin" + | "strict-origin-when-cross-origin" + | "unsafe-url"; + + type HTMLAttributeAnchorTarget = + | "_self" + | "_blank" + | "_parent" + | "_top" + | (string & {}); + + interface AnchorHTMLAttributes extends HTMLAttributes { + download?: any; + href?: string | undefined; + hrefLang?: string | undefined; + media?: string | undefined; + ping?: string | undefined; + target?: HTMLAttributeAnchorTarget | undefined; + type?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + } + + interface AudioHTMLAttributes extends MediaHTMLAttributes {} + + interface AreaHTMLAttributes extends HTMLAttributes { + alt?: string | undefined; + coords?: string | undefined; + download?: any; + href?: string | undefined; + hrefLang?: string | undefined; + media?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + shape?: string | undefined; + target?: string | undefined; + } + + interface BaseHTMLAttributes extends HTMLAttributes { + href?: string | undefined; + target?: string | undefined; + } + + interface BlockquoteHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + } + + interface ButtonHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + form?: string | undefined; + formAction?: + | string + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ] + | undefined; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + name?: string | undefined; + type?: "submit" | "reset" | "button" | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface CanvasHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + width?: number | string | undefined; + } + + interface ColHTMLAttributes extends HTMLAttributes { + span?: number | undefined; + width?: number | string | undefined; + } + + interface ColgroupHTMLAttributes extends HTMLAttributes { + span?: number | undefined; + } + + interface DataHTMLAttributes extends HTMLAttributes { + value?: string | readonly string[] | number | undefined; + } + + interface DetailsHTMLAttributes extends HTMLAttributes { + open?: boolean | undefined; + name?: string | undefined; + } + + interface DelHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + dateTime?: string | undefined; + } + + interface DialogHTMLAttributes extends HTMLAttributes { + closedby?: "any" | "closerequest" | "none" | undefined; + onCancel?: ReactEventHandler | undefined; + onClose?: ReactEventHandler | undefined; + open?: boolean | undefined; + } + + interface EmbedHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + src?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + } + + interface FieldsetHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + form?: string | undefined; + name?: string | undefined; + } + + interface FormHTMLAttributes extends HTMLAttributes { + acceptCharset?: string | undefined; + action?: + | string + | undefined + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ]; + autoComplete?: string | undefined; + encType?: string | undefined; + method?: string | undefined; + name?: string | undefined; + noValidate?: boolean | undefined; + target?: string | undefined; + } + + interface HtmlHTMLAttributes extends HTMLAttributes { + manifest?: string | undefined; + } + + interface IframeHTMLAttributes extends HTMLAttributes { + allow?: string | undefined; + allowFullScreen?: boolean | undefined; + allowTransparency?: boolean | undefined; + /** @deprecated */ + frameBorder?: number | string | undefined; + height?: number | string | undefined; + loading?: "eager" | "lazy" | undefined; + /** @deprecated */ + marginHeight?: number | undefined; + /** @deprecated */ + marginWidth?: number | undefined; + name?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sandbox?: string | undefined; + /** @deprecated */ + scrolling?: string | undefined; + seamless?: boolean | undefined; + src?: string | undefined; + srcDoc?: string | undefined; + width?: number | string | undefined; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {} + + interface ImgHTMLAttributes extends HTMLAttributes { + alt?: string | undefined; + crossOrigin?: CrossOrigin; + decoding?: "async" | "auto" | "sync" | undefined; + fetchPriority?: "high" | "low" | "auto"; + height?: number | string | undefined; + loading?: "eager" | "lazy" | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sizes?: string | undefined; + src?: + | string + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES + ] + | undefined; + srcSet?: string | undefined; + useMap?: string | undefined; + width?: number | string | undefined; + } + + interface InsHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + dateTime?: string | undefined; + } + + type HTMLInputTypeAttribute = + | "button" + | "checkbox" + | "color" + | "date" + | "datetime-local" + | "email" + | "file" + | "hidden" + | "image" + | "month" + | "number" + | "password" + | "radio" + | "range" + | "reset" + | "search" + | "submit" + | "tel" + | "text" + | "time" + | "url" + | "week" + | (string & {}); + + type AutoFillAddressKind = "billing" | "shipping"; + type AutoFillBase = "" | "off" | "on"; + type AutoFillContactField = + | "email" + | "tel" + | "tel-area-code" + | "tel-country-code" + | "tel-extension" + | "tel-local" + | "tel-local-prefix" + | "tel-local-suffix" + | "tel-national"; + type AutoFillContactKind = "home" | "mobile" | "work"; + type AutoFillCredentialField = "webauthn"; + type AutoFillNormalField = + | "additional-name" + | "address-level1" + | "address-level2" + | "address-level3" + | "address-level4" + | "address-line1" + | "address-line2" + | "address-line3" + | "bday-day" + | "bday-month" + | "bday-year" + | "cc-csc" + | "cc-exp" + | "cc-exp-month" + | "cc-exp-year" + | "cc-family-name" + | "cc-given-name" + | "cc-name" + | "cc-number" + | "cc-type" + | "country" + | "country-name" + | "current-password" + | "family-name" + | "given-name" + | "honorific-prefix" + | "honorific-suffix" + | "name" + | "new-password" + | "one-time-code" + | "organization" + | "postal-code" + | "street-address" + | "transaction-amount" + | "transaction-currency" + | "username"; + type OptionalPrefixToken = `${T} ` | ""; + type OptionalPostfixToken = ` ${T}` | ""; + type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken}${AutoFillContactField}`; + type AutoFillSection = `section-${string}`; + type AutoFill = + | AutoFillBase + | `${OptionalPrefixToken}${OptionalPrefixToken< + AutoFillAddressKind + >}${AutoFillField}${OptionalPostfixToken}`; + type HTMLInputAutoCompleteAttribute = AutoFill | (string & {}); + + interface InputHTMLAttributes extends HTMLAttributes { + accept?: string | undefined; + alt?: string | undefined; + autoComplete?: HTMLInputAutoCompleteAttribute | undefined; + capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute + checked?: boolean | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + formAction?: + | string + | ((formData: FormData) => void | Promise) + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS + ] + | undefined; + formEncType?: string | undefined; + formMethod?: string | undefined; + formNoValidate?: boolean | undefined; + formTarget?: string | undefined; + height?: number | string | undefined; + list?: string | undefined; + max?: number | string | undefined; + maxLength?: number | undefined; + min?: number | string | undefined; + minLength?: number | undefined; + multiple?: boolean | undefined; + name?: string | undefined; + pattern?: string | undefined; + placeholder?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + size?: number | undefined; + src?: string | undefined; + step?: number | string | undefined; + type?: HTMLInputTypeAttribute | undefined; + value?: string | readonly string[] | number | undefined; + width?: number | string | undefined; + + onChange?: ChangeEventHandler | undefined; + } + + interface KeygenHTMLAttributes extends HTMLAttributes { + challenge?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + keyType?: string | undefined; + keyParams?: string | undefined; + name?: string | undefined; + } + + interface LabelHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + htmlFor?: string | undefined; + } + + interface LiHTMLAttributes extends HTMLAttributes { + value?: string | readonly string[] | number | undefined; + } + + interface LinkHTMLAttributes extends HTMLAttributes { + as?: string | undefined; + blocking?: "render" | (string & {}) | undefined; + crossOrigin?: CrossOrigin; + fetchPriority?: "high" | "low" | "auto"; + href?: string | undefined; + hrefLang?: string | undefined; + integrity?: string | undefined; + media?: string | undefined; + imageSrcSet?: string | undefined; + imageSizes?: string | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + sizes?: string | undefined; + type?: string | undefined; + charSet?: string | undefined; + + // React props + precedence?: string | undefined; + } + + interface MapHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + } + + interface MenuHTMLAttributes extends HTMLAttributes { + type?: string | undefined; + } + + interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {} + + interface MediaHTMLAttributes extends HTMLAttributes { + autoPlay?: boolean | undefined; + controls?: boolean | undefined; + controlsList?: string | undefined; + crossOrigin?: CrossOrigin; + loop?: boolean | undefined; + mediaGroup?: string | undefined; + muted?: boolean | undefined; + playsInline?: boolean | undefined; + preload?: string | undefined; + src?: + | string + | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES[ + keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES + ] + | undefined; + } + + interface MetaHTMLAttributes extends HTMLAttributes { + charSet?: string | undefined; + content?: string | undefined; + httpEquiv?: string | undefined; + media?: string | undefined; + name?: string | undefined; + } + + interface MeterHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + high?: number | undefined; + low?: number | undefined; + max?: number | string | undefined; + min?: number | string | undefined; + optimum?: number | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface QuoteHTMLAttributes extends HTMLAttributes { + cite?: string | undefined; + } + + interface ObjectHTMLAttributes extends HTMLAttributes { + classID?: string | undefined; + data?: string | undefined; + form?: string | undefined; + height?: number | string | undefined; + name?: string | undefined; + type?: string | undefined; + useMap?: string | undefined; + width?: number | string | undefined; + wmode?: string | undefined; + } + + interface OlHTMLAttributes extends HTMLAttributes { + reversed?: boolean | undefined; + start?: number | undefined; + type?: "1" | "a" | "A" | "i" | "I" | undefined; + } + + interface OptgroupHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + label?: string | undefined; + } + + interface OptionHTMLAttributes extends HTMLAttributes { + disabled?: boolean | undefined; + label?: string | undefined; + selected?: boolean | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface OutputHTMLAttributes extends HTMLAttributes { + form?: string | undefined; + htmlFor?: string | undefined; + name?: string | undefined; + } + + interface ParamHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface ProgressHTMLAttributes extends HTMLAttributes { + max?: number | string | undefined; + value?: string | readonly string[] | number | undefined; + } + + interface SlotHTMLAttributes extends HTMLAttributes { + name?: string | undefined; + } + + interface ScriptHTMLAttributes extends HTMLAttributes { + async?: boolean | undefined; + blocking?: "render" | (string & {}) | undefined; + /** @deprecated */ + charSet?: string | undefined; + crossOrigin?: CrossOrigin; + defer?: boolean | undefined; + fetchPriority?: "high" | "low" | "auto" | undefined; + integrity?: string | undefined; + noModule?: boolean | undefined; + referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; + src?: string | undefined; + type?: string | undefined; + } + + interface SelectHTMLAttributes extends HTMLAttributes { + autoComplete?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + multiple?: boolean | undefined; + name?: string | undefined; + required?: boolean | undefined; + size?: number | undefined; + value?: string | readonly string[] | number | undefined; + onChange?: ChangeEventHandler | undefined; + } + + interface SourceHTMLAttributes extends HTMLAttributes { + height?: number | string | undefined; + media?: string | undefined; + sizes?: string | undefined; + src?: string | undefined; + srcSet?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + } + + interface StyleHTMLAttributes extends HTMLAttributes { + blocking?: "render" | (string & {}) | undefined; + media?: string | undefined; + scoped?: boolean | undefined; + type?: string | undefined; + + // React props + href?: string | undefined; + precedence?: string | undefined; + } + + interface TableHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | undefined; + bgcolor?: string | undefined; + border?: number | undefined; + cellPadding?: number | string | undefined; + cellSpacing?: number | string | undefined; + frame?: boolean | undefined; + rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined; + summary?: string | undefined; + width?: number | string | undefined; + } + + interface TextareaHTMLAttributes extends HTMLAttributes { + autoComplete?: string | undefined; + cols?: number | undefined; + dirName?: string | undefined; + disabled?: boolean | undefined; + form?: string | undefined; + maxLength?: number | undefined; + minLength?: number | undefined; + name?: string | undefined; + placeholder?: string | undefined; + readOnly?: boolean | undefined; + required?: boolean | undefined; + rows?: number | undefined; + value?: string | readonly string[] | number | undefined; + wrap?: string | undefined; + + onChange?: ChangeEventHandler | undefined; + } + + interface TdHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | "justify" | "char" | undefined; + colSpan?: number | undefined; + headers?: string | undefined; + rowSpan?: number | undefined; + scope?: string | undefined; + abbr?: string | undefined; + height?: number | string | undefined; + width?: number | string | undefined; + valign?: "top" | "middle" | "bottom" | "baseline" | undefined; + } + + interface ThHTMLAttributes extends HTMLAttributes { + align?: "left" | "center" | "right" | "justify" | "char" | undefined; + colSpan?: number | undefined; + headers?: string | undefined; + rowSpan?: number | undefined; + scope?: string | undefined; + abbr?: string | undefined; + } + + interface TimeHTMLAttributes extends HTMLAttributes { + dateTime?: string | undefined; + } + + interface TrackHTMLAttributes extends HTMLAttributes { + default?: boolean | undefined; + kind?: string | undefined; + label?: string | undefined; + src?: string | undefined; + srcLang?: string | undefined; + } + + interface VideoHTMLAttributes extends MediaHTMLAttributes { + height?: number | string | undefined; + playsInline?: boolean | undefined; + poster?: string | undefined; + width?: number | string | undefined; + disablePictureInPicture?: boolean | undefined; + disableRemotePlayback?: boolean | undefined; + + onResize?: ReactEventHandler | undefined; + onResizeCapture?: ReactEventHandler | undefined; + } + + // this list is "complete" in that it contains every SVG attribute + // that React supports, but the types can be improved. + // Full list here: https://facebook.github.io/react/docs/dom-elements.html + // + // The three broad type categories are (in order of restrictiveness): + // - "number | string" + // - "string" + // - union of string literals + interface SVGAttributes extends AriaAttributes, DOMAttributes { + // React-specific Attributes + suppressHydrationWarning?: boolean | undefined; + + // Attributes which also defined in HTMLAttributes + // See comment in SVGDOMPropertyConfig.js + className?: string | undefined; + color?: string | undefined; + height?: number | string | undefined; + id?: string | undefined; + lang?: string | undefined; + max?: number | string | undefined; + media?: string | undefined; + method?: string | undefined; + min?: number | string | undefined; + name?: string | undefined; + style?: CSSProperties | undefined; + target?: string | undefined; + type?: string | undefined; + width?: number | string | undefined; + + // Other HTML properties supported by SVG elements in browsers + role?: AriaRole | undefined; + tabIndex?: number | undefined; + crossOrigin?: CrossOrigin; + + // SVG Specific attributes + accentHeight?: number | string | undefined; + accumulate?: "none" | "sum" | undefined; + additive?: "replace" | "sum" | undefined; + alignmentBaseline?: + | "auto" + | "baseline" + | "before-edge" + | "text-before-edge" + | "middle" + | "central" + | "after-edge" + | "text-after-edge" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "inherit" + | undefined; + allowReorder?: "no" | "yes" | undefined; + alphabetic?: number | string | undefined; + amplitude?: number | string | undefined; + arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined; + ascent?: number | string | undefined; + attributeName?: string | undefined; + attributeType?: string | undefined; + autoReverse?: Booleanish | undefined; + azimuth?: number | string | undefined; + baseFrequency?: number | string | undefined; + baselineShift?: number | string | undefined; + baseProfile?: number | string | undefined; + bbox?: number | string | undefined; + begin?: number | string | undefined; + bias?: number | string | undefined; + by?: number | string | undefined; + calcMode?: number | string | undefined; + capHeight?: number | string | undefined; + clip?: number | string | undefined; + clipPath?: string | undefined; + clipPathUnits?: number | string | undefined; + clipRule?: number | string | undefined; + colorInterpolation?: number | string | undefined; + colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined; + colorProfile?: number | string | undefined; + colorRendering?: number | string | undefined; + contentScriptType?: number | string | undefined; + contentStyleType?: number | string | undefined; + cursor?: number | string | undefined; + cx?: number | string | undefined; + cy?: number | string | undefined; + d?: string | undefined; + decelerate?: number | string | undefined; + descent?: number | string | undefined; + diffuseConstant?: number | string | undefined; + direction?: number | string | undefined; + display?: number | string | undefined; + divisor?: number | string | undefined; + dominantBaseline?: + | "auto" + | "use-script" + | "no-change" + | "reset-size" + | "ideographic" + | "alphabetic" + | "hanging" + | "mathematical" + | "central" + | "middle" + | "text-after-edge" + | "text-before-edge" + | "inherit" + | undefined; + dur?: number | string | undefined; + dx?: number | string | undefined; + dy?: number | string | undefined; + edgeMode?: number | string | undefined; + elevation?: number | string | undefined; + enableBackground?: number | string | undefined; + end?: number | string | undefined; + exponent?: number | string | undefined; + externalResourcesRequired?: Booleanish | undefined; + fill?: string | undefined; + fillOpacity?: number | string | undefined; + fillRule?: "nonzero" | "evenodd" | "inherit" | undefined; + filter?: string | undefined; + filterRes?: number | string | undefined; + filterUnits?: number | string | undefined; + floodColor?: number | string | undefined; + floodOpacity?: number | string | undefined; + focusable?: Booleanish | "auto" | undefined; + fontFamily?: string | undefined; + fontSize?: number | string | undefined; + fontSizeAdjust?: number | string | undefined; + fontStretch?: number | string | undefined; + fontStyle?: number | string | undefined; + fontVariant?: number | string | undefined; + fontWeight?: number | string | undefined; + format?: number | string | undefined; + fr?: number | string | undefined; + from?: number | string | undefined; + fx?: number | string | undefined; + fy?: number | string | undefined; + g1?: number | string | undefined; + g2?: number | string | undefined; + glyphName?: number | string | undefined; + glyphOrientationHorizontal?: number | string | undefined; + glyphOrientationVertical?: number | string | undefined; + glyphRef?: number | string | undefined; + gradientTransform?: string | undefined; + gradientUnits?: string | undefined; + hanging?: number | string | undefined; + horizAdvX?: number | string | undefined; + horizOriginX?: number | string | undefined; + href?: string | undefined; + ideographic?: number | string | undefined; + imageRendering?: number | string | undefined; + in2?: number | string | undefined; + in?: string | undefined; + intercept?: number | string | undefined; + k1?: number | string | undefined; + k2?: number | string | undefined; + k3?: number | string | undefined; + k4?: number | string | undefined; + k?: number | string | undefined; + kernelMatrix?: number | string | undefined; + kernelUnitLength?: number | string | undefined; + kerning?: number | string | undefined; + keyPoints?: number | string | undefined; + keySplines?: number | string | undefined; + keyTimes?: number | string | undefined; + lengthAdjust?: number | string | undefined; + letterSpacing?: number | string | undefined; + lightingColor?: number | string | undefined; + limitingConeAngle?: number | string | undefined; + local?: number | string | undefined; + markerEnd?: string | undefined; + markerHeight?: number | string | undefined; + markerMid?: string | undefined; + markerStart?: string | undefined; + markerUnits?: number | string | undefined; + markerWidth?: number | string | undefined; + mask?: string | undefined; + maskContentUnits?: number | string | undefined; + maskUnits?: number | string | undefined; + mathematical?: number | string | undefined; + mode?: number | string | undefined; + numOctaves?: number | string | undefined; + offset?: number | string | undefined; + opacity?: number | string | undefined; + operator?: number | string | undefined; + order?: number | string | undefined; + orient?: number | string | undefined; + orientation?: number | string | undefined; + origin?: number | string | undefined; + overflow?: number | string | undefined; + overlinePosition?: number | string | undefined; + overlineThickness?: number | string | undefined; + paintOrder?: number | string | undefined; + panose1?: number | string | undefined; + path?: string | undefined; + pathLength?: number | string | undefined; + patternContentUnits?: string | undefined; + patternTransform?: number | string | undefined; + patternUnits?: string | undefined; + pointerEvents?: number | string | undefined; + points?: string | undefined; + pointsAtX?: number | string | undefined; + pointsAtY?: number | string | undefined; + pointsAtZ?: number | string | undefined; + preserveAlpha?: Booleanish | undefined; + preserveAspectRatio?: string | undefined; + primitiveUnits?: number | string | undefined; + r?: number | string | undefined; + radius?: number | string | undefined; + refX?: number | string | undefined; + refY?: number | string | undefined; + renderingIntent?: number | string | undefined; + repeatCount?: number | string | undefined; + repeatDur?: number | string | undefined; + requiredExtensions?: number | string | undefined; + requiredFeatures?: number | string | undefined; + restart?: number | string | undefined; + result?: string | undefined; + rotate?: number | string | undefined; + rx?: number | string | undefined; + ry?: number | string | undefined; + scale?: number | string | undefined; + seed?: number | string | undefined; + shapeRendering?: number | string | undefined; + slope?: number | string | undefined; + spacing?: number | string | undefined; + specularConstant?: number | string | undefined; + specularExponent?: number | string | undefined; + speed?: number | string | undefined; + spreadMethod?: string | undefined; + startOffset?: number | string | undefined; + stdDeviation?: number | string | undefined; + stemh?: number | string | undefined; + stemv?: number | string | undefined; + stitchTiles?: number | string | undefined; + stopColor?: string | undefined; + stopOpacity?: number | string | undefined; + strikethroughPosition?: number | string | undefined; + strikethroughThickness?: number | string | undefined; + string?: number | string | undefined; + stroke?: string | undefined; + strokeDasharray?: string | number | undefined; + strokeDashoffset?: string | number | undefined; + strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined; + strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined; + strokeMiterlimit?: number | string | undefined; + strokeOpacity?: number | string | undefined; + strokeWidth?: number | string | undefined; + surfaceScale?: number | string | undefined; + systemLanguage?: number | string | undefined; + tableValues?: number | string | undefined; + targetX?: number | string | undefined; + targetY?: number | string | undefined; + textAnchor?: "start" | "middle" | "end" | "inherit" | undefined; + textDecoration?: number | string | undefined; + textLength?: number | string | undefined; + textRendering?: number | string | undefined; + to?: number | string | undefined; + transform?: string | undefined; + u1?: number | string | undefined; + u2?: number | string | undefined; + underlinePosition?: number | string | undefined; + underlineThickness?: number | string | undefined; + unicode?: number | string | undefined; + unicodeBidi?: number | string | undefined; + unicodeRange?: number | string | undefined; + unitsPerEm?: number | string | undefined; + vAlphabetic?: number | string | undefined; + values?: string | undefined; + vectorEffect?: number | string | undefined; + version?: string | undefined; + vertAdvY?: number | string | undefined; + vertOriginX?: number | string | undefined; + vertOriginY?: number | string | undefined; + vHanging?: number | string | undefined; + vIdeographic?: number | string | undefined; + viewBox?: string | undefined; + viewTarget?: number | string | undefined; + visibility?: number | string | undefined; + vMathematical?: number | string | undefined; + widths?: number | string | undefined; + wordSpacing?: number | string | undefined; + writingMode?: number | string | undefined; + x1?: number | string | undefined; + x2?: number | string | undefined; + x?: number | string | undefined; + xChannelSelector?: string | undefined; + xHeight?: number | string | undefined; + xlinkActuate?: string | undefined; + xlinkArcrole?: string | undefined; + xlinkHref?: string | undefined; + xlinkRole?: string | undefined; + xlinkShow?: string | undefined; + xlinkTitle?: string | undefined; + xlinkType?: string | undefined; + xmlBase?: string | undefined; + xmlLang?: string | undefined; + xmlns?: string | undefined; + xmlnsXlink?: string | undefined; + xmlSpace?: string | undefined; + y1?: number | string | undefined; + y2?: number | string | undefined; + y?: number | string | undefined; + yChannelSelector?: string | undefined; + z?: number | string | undefined; + zoomAndPan?: string | undefined; + } + + interface WebViewHTMLAttributes extends HTMLAttributes { + allowFullScreen?: boolean | undefined; + allowpopups?: boolean | undefined; + autosize?: boolean | undefined; + blinkfeatures?: string | undefined; + disableblinkfeatures?: string | undefined; + disableguestresize?: boolean | undefined; + disablewebsecurity?: boolean | undefined; + guestinstance?: string | undefined; + httpreferrer?: string | undefined; + nodeintegration?: boolean | undefined; + partition?: string | undefined; + plugins?: boolean | undefined; + preload?: string | undefined; + src?: string | undefined; + useragent?: string | undefined; + webpreferences?: string | undefined; + } + + // TODO: Move to react-dom + type HTMLElementType = + | "a" + | "abbr" + | "address" + | "area" + | "article" + | "aside" + | "audio" + | "b" + | "base" + | "bdi" + | "bdo" + | "big" + | "blockquote" + | "body" + | "br" + | "button" + | "canvas" + | "caption" + | "center" + | "cite" + | "code" + | "col" + | "colgroup" + | "data" + | "datalist" + | "dd" + | "del" + | "details" + | "dfn" + | "dialog" + | "div" + | "dl" + | "dt" + | "em" + | "embed" + | "fieldset" + | "figcaption" + | "figure" + | "footer" + | "form" + | "h1" + | "h2" + | "h3" + | "h4" + | "h5" + | "h6" + | "head" + | "header" + | "hgroup" + | "hr" + | "html" + | "i" + | "iframe" + | "img" + | "input" + | "ins" + | "kbd" + | "keygen" + | "label" + | "legend" + | "li" + | "link" + | "main" + | "map" + | "mark" + | "menu" + | "menuitem" + | "meta" + | "meter" + | "nav" + | "noscript" + | "object" + | "ol" + | "optgroup" + | "option" + | "output" + | "p" + | "param" + | "picture" + | "pre" + | "progress" + | "q" + | "rp" + | "rt" + | "ruby" + | "s" + | "samp" + | "search" + | "slot" + | "script" + | "section" + | "select" + | "small" + | "source" + | "span" + | "strong" + | "style" + | "sub" + | "summary" + | "sup" + | "table" + | "template" + | "tbody" + | "td" + | "textarea" + | "tfoot" + | "th" + | "thead" + | "time" + | "title" + | "tr" + | "track" + | "u" + | "ul" + | "var" + | "video" + | "wbr" + | "webview"; + + // TODO: Move to react-dom + type SVGElementType = + | "animate" + | "circle" + | "clipPath" + | "defs" + | "desc" + | "ellipse" + | "feBlend" + | "feColorMatrix" + | "feComponentTransfer" + | "feComposite" + | "feConvolveMatrix" + | "feDiffuseLighting" + | "feDisplacementMap" + | "feDistantLight" + | "feDropShadow" + | "feFlood" + | "feFuncA" + | "feFuncB" + | "feFuncG" + | "feFuncR" + | "feGaussianBlur" + | "feImage" + | "feMerge" + | "feMergeNode" + | "feMorphology" + | "feOffset" + | "fePointLight" + | "feSpecularLighting" + | "feSpotLight" + | "feTile" + | "feTurbulence" + | "filter" + | "foreignObject" + | "g" + | "image" + | "line" + | "linearGradient" + | "marker" + | "mask" + | "metadata" + | "path" + | "pattern" + | "polygon" + | "polyline" + | "radialGradient" + | "rect" + | "stop" + | "svg" + | "switch" + | "symbol" + | "text" + | "textPath" + | "tspan" + | "use" + | "view"; + + // + // Browser Interfaces + // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts + // ---------------------------------------------------------------------- + + interface AbstractView { + styleMedia: StyleMedia; + document: Document; + } + + interface Touch { + identifier: number; + target: EventTarget; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + pageX: number; + pageY: number; + } + + interface TouchList { + [index: number]: Touch; + length: number; + item(index: number): Touch; + identifiedTouch(identifier: number): Touch; + } + + // + // Error Interfaces + // ---------------------------------------------------------------------- + interface ErrorInfo { + /** + * Captures which component contained the exception, and its ancestors. + */ + componentStack?: string | null; + } + + // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts + namespace JSX { + interface Element extends React.ReactElement {} + interface ElementClass extends React.Component { + render(): React.ReactNode; + } + interface ElementAttributesProperty { + props: {}; + } + interface ElementChildrenAttribute { + children: {}; + } + + // We can't recurse forever because `type` can't be self-referential; + // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa + type LibraryManagedAttributes = C extends + React.MemoExoticComponent | React.LazyExoticComponent + ? T extends React.MemoExoticComponent | React.LazyExoticComponent + ? ReactManagedAttributes + : ReactManagedAttributes + : ReactManagedAttributes; + + interface IntrinsicAttributes extends React.Attributes {} + interface IntrinsicClassAttributes extends React.ClassAttributes {} + + interface IntrinsicElements { + // HTML + a: React.DetailedHTMLProps, HTMLAnchorElement>; + abbr: React.DetailedHTMLProps, HTMLElement>; + address: React.DetailedHTMLProps, HTMLElement>; + area: React.DetailedHTMLProps, HTMLAreaElement>; + article: React.DetailedHTMLProps, HTMLElement>; + aside: React.DetailedHTMLProps, HTMLElement>; + audio: React.DetailedHTMLProps, HTMLAudioElement>; + b: React.DetailedHTMLProps, HTMLElement>; + base: React.DetailedHTMLProps, HTMLBaseElement>; + bdi: React.DetailedHTMLProps, HTMLElement>; + bdo: React.DetailedHTMLProps, HTMLElement>; + big: React.DetailedHTMLProps, HTMLElement>; + blockquote: React.DetailedHTMLProps, HTMLQuoteElement>; + body: React.DetailedHTMLProps, HTMLBodyElement>; + br: React.DetailedHTMLProps, HTMLBRElement>; + button: React.DetailedHTMLProps, HTMLButtonElement>; + canvas: React.DetailedHTMLProps, HTMLCanvasElement>; + caption: React.DetailedHTMLProps, HTMLElement>; + center: React.DetailedHTMLProps, HTMLElement>; + cite: React.DetailedHTMLProps, HTMLElement>; + code: React.DetailedHTMLProps, HTMLElement>; + col: React.DetailedHTMLProps, HTMLTableColElement>; + colgroup: React.DetailedHTMLProps, HTMLTableColElement>; + data: React.DetailedHTMLProps, HTMLDataElement>; + datalist: React.DetailedHTMLProps, HTMLDataListElement>; + dd: React.DetailedHTMLProps, HTMLElement>; + del: React.DetailedHTMLProps, HTMLModElement>; + details: React.DetailedHTMLProps, HTMLDetailsElement>; + dfn: React.DetailedHTMLProps, HTMLElement>; + dialog: React.DetailedHTMLProps, HTMLDialogElement>; + div: React.DetailedHTMLProps, HTMLDivElement>; + dl: React.DetailedHTMLProps, HTMLDListElement>; + dt: React.DetailedHTMLProps, HTMLElement>; + em: React.DetailedHTMLProps, HTMLElement>; + embed: React.DetailedHTMLProps, HTMLEmbedElement>; + fieldset: React.DetailedHTMLProps, HTMLFieldSetElement>; + figcaption: React.DetailedHTMLProps, HTMLElement>; + figure: React.DetailedHTMLProps, HTMLElement>; + footer: React.DetailedHTMLProps, HTMLElement>; + form: React.DetailedHTMLProps, HTMLFormElement>; + h1: React.DetailedHTMLProps, HTMLHeadingElement>; + h2: React.DetailedHTMLProps, HTMLHeadingElement>; + h3: React.DetailedHTMLProps, HTMLHeadingElement>; + h4: React.DetailedHTMLProps, HTMLHeadingElement>; + h5: React.DetailedHTMLProps, HTMLHeadingElement>; + h6: React.DetailedHTMLProps, HTMLHeadingElement>; + head: React.DetailedHTMLProps, HTMLHeadElement>; + header: React.DetailedHTMLProps, HTMLElement>; + hgroup: React.DetailedHTMLProps, HTMLElement>; + hr: React.DetailedHTMLProps, HTMLHRElement>; + html: React.DetailedHTMLProps, HTMLHtmlElement>; + i: React.DetailedHTMLProps, HTMLElement>; + iframe: React.DetailedHTMLProps, HTMLIFrameElement>; + img: React.DetailedHTMLProps, HTMLImageElement>; + input: React.DetailedHTMLProps, HTMLInputElement>; + ins: React.DetailedHTMLProps, HTMLModElement>; + kbd: React.DetailedHTMLProps, HTMLElement>; + keygen: React.DetailedHTMLProps, HTMLElement>; + label: React.DetailedHTMLProps, HTMLLabelElement>; + legend: React.DetailedHTMLProps, HTMLLegendElement>; + li: React.DetailedHTMLProps, HTMLLIElement>; + link: React.DetailedHTMLProps, HTMLLinkElement>; + main: React.DetailedHTMLProps, HTMLElement>; + map: React.DetailedHTMLProps, HTMLMapElement>; + mark: React.DetailedHTMLProps, HTMLElement>; + menu: React.DetailedHTMLProps, HTMLElement>; + menuitem: React.DetailedHTMLProps, HTMLElement>; + meta: React.DetailedHTMLProps, HTMLMetaElement>; + meter: React.DetailedHTMLProps, HTMLMeterElement>; + nav: React.DetailedHTMLProps, HTMLElement>; + noindex: React.DetailedHTMLProps, HTMLElement>; + noscript: React.DetailedHTMLProps, HTMLElement>; + object: React.DetailedHTMLProps, HTMLObjectElement>; + ol: React.DetailedHTMLProps, HTMLOListElement>; + optgroup: React.DetailedHTMLProps, HTMLOptGroupElement>; + option: React.DetailedHTMLProps, HTMLOptionElement>; + output: React.DetailedHTMLProps, HTMLOutputElement>; + p: React.DetailedHTMLProps, HTMLParagraphElement>; + param: React.DetailedHTMLProps, HTMLParamElement>; + picture: React.DetailedHTMLProps, HTMLElement>; + pre: React.DetailedHTMLProps, HTMLPreElement>; + progress: React.DetailedHTMLProps, HTMLProgressElement>; + q: React.DetailedHTMLProps, HTMLQuoteElement>; + rp: React.DetailedHTMLProps, HTMLElement>; + rt: React.DetailedHTMLProps, HTMLElement>; + ruby: React.DetailedHTMLProps, HTMLElement>; + s: React.DetailedHTMLProps, HTMLElement>; + samp: React.DetailedHTMLProps, HTMLElement>; + search: React.DetailedHTMLProps, HTMLElement>; + slot: React.DetailedHTMLProps, HTMLSlotElement>; + script: React.DetailedHTMLProps, HTMLScriptElement>; + section: React.DetailedHTMLProps, HTMLElement>; + select: React.DetailedHTMLProps, HTMLSelectElement>; + small: React.DetailedHTMLProps, HTMLElement>; + source: React.DetailedHTMLProps, HTMLSourceElement>; + span: React.DetailedHTMLProps, HTMLSpanElement>; + strong: React.DetailedHTMLProps, HTMLElement>; + style: React.DetailedHTMLProps, HTMLStyleElement>; + sub: React.DetailedHTMLProps, HTMLElement>; + summary: React.DetailedHTMLProps, HTMLElement>; + sup: React.DetailedHTMLProps, HTMLElement>; + table: React.DetailedHTMLProps, HTMLTableElement>; + template: React.DetailedHTMLProps, HTMLTemplateElement>; + tbody: React.DetailedHTMLProps, HTMLTableSectionElement>; + td: React.DetailedHTMLProps, HTMLTableDataCellElement>; + textarea: React.DetailedHTMLProps, HTMLTextAreaElement>; + tfoot: React.DetailedHTMLProps, HTMLTableSectionElement>; + th: React.DetailedHTMLProps, HTMLTableHeaderCellElement>; + thead: React.DetailedHTMLProps, HTMLTableSectionElement>; + time: React.DetailedHTMLProps, HTMLTimeElement>; + title: React.DetailedHTMLProps, HTMLTitleElement>; + tr: React.DetailedHTMLProps, HTMLTableRowElement>; + track: React.DetailedHTMLProps, HTMLTrackElement>; + u: React.DetailedHTMLProps, HTMLElement>; + ul: React.DetailedHTMLProps, HTMLUListElement>; + "var": React.DetailedHTMLProps, HTMLElement>; + video: React.DetailedHTMLProps, HTMLVideoElement>; + wbr: React.DetailedHTMLProps, HTMLElement>; + webview: React.DetailedHTMLProps, HTMLWebViewElement>; + + // SVG + svg: React.SVGProps; + + animate: React.SVGProps; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now. + animateMotion: React.SVGProps; + animateTransform: React.SVGProps; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now. + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + desc: React.SVGProps; + ellipse: React.SVGProps; + feBlend: React.SVGProps; + feColorMatrix: React.SVGProps; + feComponentTransfer: React.SVGProps; + feComposite: React.SVGProps; + feConvolveMatrix: React.SVGProps; + feDiffuseLighting: React.SVGProps; + feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; + feDropShadow: React.SVGProps; + feFlood: React.SVGProps; + feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; + feGaussianBlur: React.SVGProps; + feImage: React.SVGProps; + feMerge: React.SVGProps; + feMergeNode: React.SVGProps; + feMorphology: React.SVGProps; + feOffset: React.SVGProps; + fePointLight: React.SVGProps; + feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; + feTile: React.SVGProps; + feTurbulence: React.SVGProps; + filter: React.SVGProps; + foreignObject: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGLineElementAttributes; + linearGradient: React.SVGProps; + marker: React.SVGProps; + mask: React.SVGProps; + metadata: React.SVGProps; + mpath: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + set: React.SVGProps; + stop: React.SVGProps; + switch: React.SVGProps; + symbol: React.SVGProps; + text: React.SVGTextElementAttributes; + textPath: React.SVGProps; + tspan: React.SVGProps; + use: React.SVGProps; + view: React.SVGProps; + } + } +} + +type InexactPartial = { [K in keyof T]?: T[K] | undefined }; + +// Any prop that has a default prop becomes optional, but its type is unchanged +// Undeclared default props are augmented into the resulting allowable attributes +// If declared props have indexed properties, ignore default props entirely as keyof gets widened +// Wrap in an outer-level conditional type to allow distribution over props that are unions +type Defaultize = P extends any ? string extends keyof P ? P + : + & Pick> + & InexactPartial>> + & InexactPartial>> + : never; + +type ReactManagedAttributes = C extends { defaultProps: infer D } ? Defaultize + : P; diff --git a/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts b/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts new file mode 100644 index 00000000..87d1dfe3 --- /dev/null +++ b/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts @@ -0,0 +1,44 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +export interface JSXSource { + /** + * The source file where the element originates from. + */ + fileName?: string | undefined; + + /** + * The line number where the element was created. + */ + lineNumber?: number | undefined; + + /** + * The column number where the element was created. + */ + columnNumber?: number | undefined; +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxDEV( + type: React.ElementType, + props: unknown, + key: React.Key | undefined, + isStatic: boolean, + source?: JSXSource, + self?: unknown, +): React.ReactElement; diff --git a/node_modules/@types/react/ts5.0/jsx-runtime.d.ts b/node_modules/@types/react/ts5.0/jsx-runtime.d.ts new file mode 100644 index 00000000..8cc3b974 --- /dev/null +++ b/node_modules/@types/react/ts5.0/jsx-runtime.d.ts @@ -0,0 +1,35 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsx( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxs( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; diff --git a/node_modules/@types/unist/LICENSE b/node_modules/@types/unist/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/unist/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/unist/README.md b/node_modules/@types/unist/README.md new file mode 100644 index 00000000..3beb9b3c --- /dev/null +++ b/node_modules/@types/unist/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/unist` + +# Summary +This package contains type definitions for unist (https://github.com/syntax-tree/unist). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist. + +### Additional Details + * Last updated: Thu, 15 Aug 2024 02:18:53 GMT + * Dependencies: none + +# Credits +These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), [JounQin](https://github.com/JounQin), and [Remco Haszing](https://github.com/remcohaszing). diff --git a/node_modules/@types/unist/index.d.ts b/node_modules/@types/unist/index.d.ts new file mode 100644 index 00000000..513ddee5 --- /dev/null +++ b/node_modules/@types/unist/index.d.ts @@ -0,0 +1,119 @@ +// ## Interfaces + +/** + * Info associated with nodes by the ecosystem. + * + * This space is guaranteed to never be specified by unist or specifications + * implementing unist. + * But you can use it in utilities and plugins to store data. + * + * This type can be augmented to register custom data. + * For example: + * + * ```ts + * declare module 'unist' { + * interface Data { + * // `someNode.data.myId` is typed as `number | undefined` + * myId?: number | undefined + * } + * } + * ``` + */ +export interface Data {} + +/** + * One place in a source file. + */ +export interface Point { + /** + * Line in a source file (1-indexed integer). + */ + line: number; + + /** + * Column in a source file (1-indexed integer). + */ + column: number; + /** + * Character in a source file (0-indexed integer). + */ + offset?: number | undefined; +} + +/** + * Position of a node in a source document. + * + * A position is a range between two points. + */ +export interface Position { + /** + * Place of the first character of the parsed source region. + */ + start: Point; + + /** + * Place of the first character after the parsed source region. + */ + end: Point; +} + +// ## Abstract nodes + +/** + * Abstract unist node that contains the smallest possible value. + * + * This interface is supposed to be extended. + * + * For example, in HTML, a `text` node is a leaf that contains text. + */ +export interface Literal extends Node { + /** + * Plain value. + */ + value: unknown; +} + +/** + * Abstract unist node. + * + * The syntactic unit in unist syntax trees are called nodes. + * + * This interface is supposed to be extended. + * If you can use {@link Literal} or {@link Parent}, you should. + * But for example in markdown, a `thematicBreak` (`***`), is neither literal + * nor parent, but still a node. + */ +export interface Node { + /** + * Node type. + */ + type: string; + + /** + * Info from the ecosystem. + */ + data?: Data | undefined; + + /** + * Position of a node in a source document. + * + * Nodes that are generated (not in the original source document) must not + * have a position. + */ + position?: Position | undefined; +} + +/** + * Abstract unist node that contains other nodes (*children*). + * + * This interface is supposed to be extended. + * + * For example, in XML, an element is a parent of different things, such as + * comments, text, and further elements. + */ +export interface Parent extends Node { + /** + * List of children. + */ + children: Node[]; +} diff --git a/node_modules/@types/unist/package.json b/node_modules/@types/unist/package.json new file mode 100644 index 00000000..d2092dba --- /dev/null +++ b/node_modules/@types/unist/package.json @@ -0,0 +1,60 @@ +{ + "name": "@types/unist", + "version": "3.0.3", + "description": "TypeScript definitions for unist", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist", + "license": "MIT", + "contributors": [ + { + "name": "bizen241", + "githubUsername": "bizen241", + "url": "https://github.com/bizen241" + }, + { + "name": "Jun Lu", + "githubUsername": "lujun2", + "url": "https://github.com/lujun2" + }, + { + "name": "Hernan Rajchert", + "githubUsername": "hrajchert", + "url": "https://github.com/hrajchert" + }, + { + "name": "Titus Wormer", + "githubUsername": "wooorm", + "url": "https://github.com/wooorm" + }, + { + "name": "Junyoung Choi", + "githubUsername": "rokt33r", + "url": "https://github.com/rokt33r" + }, + { + "name": "Ben Moon", + "githubUsername": "GuiltyDolphin", + "url": "https://github.com/GuiltyDolphin" + }, + { + "name": "JounQin", + "githubUsername": "JounQin", + "url": "https://github.com/JounQin" + }, + { + "name": "Remco Haszing", + "githubUsername": "remcohaszing", + "url": "https://github.com/remcohaszing" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/unist" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "7f3d5ce8d56003f3583a5317f98d444bdc99910c7b486c6b10af4f38694e61fe", + "typeScriptVersion": "4.8" +} \ No newline at end of file diff --git a/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml b/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml new file mode 100644 index 00000000..73cf8d65 --- /dev/null +++ b/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: build + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test + - run: npm run coverage --if-present + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/@ungap/structured-clone/LICENSE b/node_modules/@ungap/structured-clone/LICENSE new file mode 100644 index 00000000..48afbe52 --- /dev/null +++ b/node_modules/@ungap/structured-clone/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2021, Andrea Giammarchi, @WebReflection + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@ungap/structured-clone/README.md b/node_modules/@ungap/structured-clone/README.md new file mode 100644 index 00000000..07d15a25 --- /dev/null +++ b/node_modules/@ungap/structured-clone/README.md @@ -0,0 +1,95 @@ +# structuredClone polyfill + +[![Downloads](https://img.shields.io/npm/dm/@ungap/structured-clone.svg)](https://www.npmjs.com/package/@ungap/structured-clone) [![build status](https://github.com/ungap/structured-clone/actions/workflows/node.js.yml/badge.svg)](https://github.com/ungap/structured-clone/actions) [![Coverage Status](https://coveralls.io/repos/github/ungap/structured-clone/badge.svg?branch=main)](https://coveralls.io/github/ungap/structured-clone?branch=main) + +An env agnostic serializer and deserializer with recursion ability and types beyond *JSON* from the *HTML* standard itself. + + * [Supported Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types) + * *not supported yet*: Blob, File, FileList, ImageBitmap, ImageData or others non *JS* types but typed arrays are supported without major issues, but u/int8, u/int16, and u/int32 are the only safely suppored (right now). + * *not possible to implement*: the `{transfer: []}` option can be passed but it's completely ignored. + * [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) + * [Serializer](https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal) + * [Deserializer](https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize) + +Serialized values can be safely stringified as *JSON* too, and deserialization resurrect all values, even recursive, or more complex than what *JSON* allows. + + +### Examples + +Check the [100% test coverage](./test/index.js) to know even more. + +```js +// as default export +import structuredClone from '@ungap/structured-clone'; +const cloned = structuredClone({any: 'serializable'}); + +// as independent serializer/deserializer +import {serialize, deserialize} from '@ungap/structured-clone'; + +// the result can be stringified as JSON without issues +// even if there is recursive data, bigint values, +// typed arrays, and so on +const serialized = serialize({any: 'serializable'}); + +// the result will be a replica of the original object +const deserialized = deserialize(serialized); +``` + +#### Global Polyfill +Note: Only monkey patch the global if needed. This polyfill works just fine as an explicit import: `import structuredClone from "@ungap/structured-clone"` +```js +// Attach the polyfill as a Global function +import structuredClone from "@ungap/structured-clone"; +if (!("structuredClone" in globalThis)) { + globalThis.structuredClone = structuredClone; +} + +// Or don't monkey patch +import structuredClone from "@ungap/structured-clone" +// Just use it in the file +structuredClone() +``` + +**Note**: Do not attach this module's default export directly to the global scope, whithout a conditional guard to detect a native implementation. In environments where there is a native global implementation of `structuredClone()` already, assignment to the global object will result in an infinite loop when `globalThis.structuredClone()` is called. See the example above for a safe way to provide the polyfill globally in your project. + +### Extra Features + +There is no middle-ground between the structured clone algorithm and JSON: + + * JSON is more relaxed about incompatible values: it just ignores these + * Structured clone is inflexible regarding incompatible values, yet it makes specialized instances impossible to reconstruct, plus it doesn't offer any helper, such as `toJSON()`, to make serialization possible, or better, with specific cases + +This module specialized `serialize` export offers, within the optional extra argument, a **lossy** property to avoid throwing when incompatible types are found down the road (function, symbol, ...), so that it is possible to send with less worrying about thrown errors. + +```js +// as default export +import structuredClone from '@ungap/structured-clone'; +const cloned = structuredClone( + { + method() { + // ignored, won't be cloned + }, + special: Symbol('also ignored') + }, + { + // avoid throwing + lossy: true, + // avoid throwing *and* looks for toJSON + json: true + } +); +``` + +The behavior is the same found in *JSON* when it comes to *Array*, so that unsupported values will result as `null` placeholders instead. + +#### toJSON + +If `lossy` option is not enough, `json` will actually enforce `lossy` and also check for `toJSON` method when objects are parsed. + +Alternative, the `json` exports combines all features: + +```js +import {stringify, parse} from '@ungap/structured-clone/json'; + +parse(stringify({any: 'serializable'})); +``` diff --git a/node_modules/@ungap/structured-clone/cjs/deserialize.js b/node_modules/@ungap/structured-clone/cjs/deserialize.js new file mode 100644 index 00000000..331b4b63 --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/deserialize.js @@ -0,0 +1,84 @@ +'use strict'; +const { + VOID, PRIMITIVE, ARRAY, OBJECT, DATE, REGEXP, MAP, SET, ERROR, BIGINT +} = require('./types.js'); + +const env = typeof self === 'object' ? self : globalThis; + +const deserializer = ($, _) => { + const as = (out, index) => { + $.set(index, out); + return out; + }; + + const unpair = index => { + if ($.has(index)) + return $.get(index); + + const [type, value] = _[index]; + switch (type) { + case PRIMITIVE: + case VOID: + return as(value, index); + case ARRAY: { + const arr = as([], index); + for (const index of value) + arr.push(unpair(index)); + return arr; + } + case OBJECT: { + const object = as({}, index); + for (const [key, index] of value) + object[unpair(key)] = unpair(index); + return object; + } + case DATE: + return as(new Date(value), index); + case REGEXP: { + const {source, flags} = value; + return as(new RegExp(source, flags), index); + } + case MAP: { + const map = as(new Map, index); + for (const [key, index] of value) + map.set(unpair(key), unpair(index)); + return map; + } + case SET: { + const set = as(new Set, index); + for (const index of value) + set.add(unpair(index)); + return set; + } + case ERROR: { + const {name, message} = value; + return as(new env[name](message), index); + } + case BIGINT: + return as(BigInt(value), index); + case 'BigInt': + return as(Object(BigInt(value)), index); + case 'ArrayBuffer': + return as(new Uint8Array(value).buffer, value); + case 'DataView': { + const { buffer } = new Uint8Array(value); + return as(new DataView(buffer), value); + } + } + return as(new env[type](value), index); + }; + + return unpair; +}; + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns a deserialized value from a serialized array of Records. + * @param {Record[]} serialized a previously serialized value. + * @returns {any} + */ +const deserialize = serialized => deserializer(new Map, serialized)(0); +exports.deserialize = deserialize; diff --git a/node_modules/@ungap/structured-clone/cjs/index.js b/node_modules/@ungap/structured-clone/cjs/index.js new file mode 100644 index 00000000..13d747c5 --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/index.js @@ -0,0 +1,27 @@ +'use strict'; +const {deserialize} = require('./deserialize.js'); +const {serialize} = require('./serialize.js'); + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns an array of serialized Records. + * @param {any} any a serializable value. + * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with + * a transfer option (ignored when polyfilled) and/or non standard fields that + * fallback to the polyfill if present. + * @returns {Record[]} + */ +Object.defineProperty(exports, '__esModule', {value: true}).default = typeof structuredClone === "function" ? + /* c8 ignore start */ + (any, options) => ( + options && ('json' in options || 'lossy' in options) ? + deserialize(serialize(any, options)) : structuredClone(any) + ) : + (any, options) => deserialize(serialize(any, options)); + /* c8 ignore stop */ + +exports.deserialize = deserialize; +exports.serialize = serialize; diff --git a/node_modules/@ungap/structured-clone/cjs/json.js b/node_modules/@ungap/structured-clone/cjs/json.js new file mode 100644 index 00000000..0038dcf9 --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/json.js @@ -0,0 +1,24 @@ +'use strict'; +/*! (c) Andrea Giammarchi - ISC */ + +const {deserialize} = require('./deserialize.js'); +const {serialize} = require('./serialize.js'); + +const {parse: $parse, stringify: $stringify} = JSON; +const options = {json: true, lossy: true}; + +/** + * Revive a previously stringified structured clone. + * @param {string} str previously stringified data as string. + * @returns {any} whatever was previously stringified as clone. + */ +const parse = str => deserialize($parse(str)); +exports.parse = parse; + +/** + * Represent a structured clone value as string. + * @param {any} any some clone-able value to stringify. + * @returns {string} the value stringified. + */ +const stringify = any => $stringify(serialize(any, options)); +exports.stringify = stringify; diff --git a/node_modules/@ungap/structured-clone/cjs/package.json b/node_modules/@ungap/structured-clone/cjs/package.json new file mode 100644 index 00000000..0292b995 --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/@ungap/structured-clone/cjs/serialize.js b/node_modules/@ungap/structured-clone/cjs/serialize.js new file mode 100644 index 00000000..59b2d383 --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/serialize.js @@ -0,0 +1,170 @@ +'use strict'; +const { + VOID, PRIMITIVE, ARRAY, OBJECT, DATE, REGEXP, MAP, SET, ERROR, BIGINT +} = require('./types.js'); + +const EMPTY = ''; + +const {toString} = {}; +const {keys} = Object; + +const typeOf = value => { + const type = typeof value; + if (type !== 'object' || !value) + return [PRIMITIVE, type]; + + const asString = toString.call(value).slice(8, -1); + switch (asString) { + case 'Array': + return [ARRAY, EMPTY]; + case 'Object': + return [OBJECT, EMPTY]; + case 'Date': + return [DATE, EMPTY]; + case 'RegExp': + return [REGEXP, EMPTY]; + case 'Map': + return [MAP, EMPTY]; + case 'Set': + return [SET, EMPTY]; + case 'DataView': + return [ARRAY, asString]; + } + + if (asString.includes('Array')) + return [ARRAY, asString]; + + if (asString.includes('Error')) + return [ERROR, asString]; + + return [OBJECT, asString]; +}; + +const shouldSkip = ([TYPE, type]) => ( + TYPE === PRIMITIVE && + (type === 'function' || type === 'symbol') +); + +const serializer = (strict, json, $, _) => { + + const as = (out, value) => { + const index = _.push(out) - 1; + $.set(value, index); + return index; + }; + + const pair = value => { + if ($.has(value)) + return $.get(value); + + let [TYPE, type] = typeOf(value); + switch (TYPE) { + case PRIMITIVE: { + let entry = value; + switch (type) { + case 'bigint': + TYPE = BIGINT; + entry = value.toString(); + break; + case 'function': + case 'symbol': + if (strict) + throw new TypeError('unable to serialize ' + type); + entry = null; + break; + case 'undefined': + return as([VOID], value); + } + return as([TYPE, entry], value); + } + case ARRAY: { + if (type) { + let spread = value; + if (type === 'DataView') { + spread = new Uint8Array(value.buffer); + } + else if (type === 'ArrayBuffer') { + spread = new Uint8Array(value); + } + return as([type, [...spread]], value); + } + + const arr = []; + const index = as([TYPE, arr], value); + for (const entry of value) + arr.push(pair(entry)); + return index; + } + case OBJECT: { + if (type) { + switch (type) { + case 'BigInt': + return as([type, value.toString()], value); + case 'Boolean': + case 'Number': + case 'String': + return as([type, value.valueOf()], value); + } + } + + if (json && ('toJSON' in value)) + return pair(value.toJSON()); + + const entries = []; + const index = as([TYPE, entries], value); + for (const key of keys(value)) { + if (strict || !shouldSkip(typeOf(value[key]))) + entries.push([pair(key), pair(value[key])]); + } + return index; + } + case DATE: + return as([TYPE, value.toISOString()], value); + case REGEXP: { + const {source, flags} = value; + return as([TYPE, {source, flags}], value); + } + case MAP: { + const entries = []; + const index = as([TYPE, entries], value); + for (const [key, entry] of value) { + if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) + entries.push([pair(key), pair(entry)]); + } + return index; + } + case SET: { + const entries = []; + const index = as([TYPE, entries], value); + for (const entry of value) { + if (strict || !shouldSkip(typeOf(entry))) + entries.push(pair(entry)); + } + return index; + } + } + + const {message} = value; + return as([TYPE, {name: type, message}], value); + }; + + return pair; +}; + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns an array of serialized Records. + * @param {any} value a serializable value. + * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that, + * if `true`, will not throw errors on incompatible types, and behave more + * like JSON stringify would behave. Symbol and Function will be discarded. + * @returns {Record[]} + */ + const serialize = (value, {json, lossy} = {}) => { + const _ = []; + return serializer(!(json || lossy), !!json, new Map, _)(value), _; +}; +exports.serialize = serialize; diff --git a/node_modules/@ungap/structured-clone/cjs/types.js b/node_modules/@ungap/structured-clone/cjs/types.js new file mode 100644 index 00000000..8284be3d --- /dev/null +++ b/node_modules/@ungap/structured-clone/cjs/types.js @@ -0,0 +1,22 @@ +'use strict'; +const VOID = -1; +exports.VOID = VOID; +const PRIMITIVE = 0; +exports.PRIMITIVE = PRIMITIVE; +const ARRAY = 1; +exports.ARRAY = ARRAY; +const OBJECT = 2; +exports.OBJECT = OBJECT; +const DATE = 3; +exports.DATE = DATE; +const REGEXP = 4; +exports.REGEXP = REGEXP; +const MAP = 5; +exports.MAP = MAP; +const SET = 6; +exports.SET = SET; +const ERROR = 7; +exports.ERROR = ERROR; +const BIGINT = 8; +exports.BIGINT = BIGINT; +// export const SYMBOL = 9; diff --git a/node_modules/@ungap/structured-clone/esm/deserialize.js b/node_modules/@ungap/structured-clone/esm/deserialize.js new file mode 100644 index 00000000..2e73eeab --- /dev/null +++ b/node_modules/@ungap/structured-clone/esm/deserialize.js @@ -0,0 +1,85 @@ +import { + VOID, PRIMITIVE, + ARRAY, OBJECT, + DATE, REGEXP, MAP, SET, + ERROR, BIGINT +} from './types.js'; + +const env = typeof self === 'object' ? self : globalThis; + +const deserializer = ($, _) => { + const as = (out, index) => { + $.set(index, out); + return out; + }; + + const unpair = index => { + if ($.has(index)) + return $.get(index); + + const [type, value] = _[index]; + switch (type) { + case PRIMITIVE: + case VOID: + return as(value, index); + case ARRAY: { + const arr = as([], index); + for (const index of value) + arr.push(unpair(index)); + return arr; + } + case OBJECT: { + const object = as({}, index); + for (const [key, index] of value) + object[unpair(key)] = unpair(index); + return object; + } + case DATE: + return as(new Date(value), index); + case REGEXP: { + const {source, flags} = value; + return as(new RegExp(source, flags), index); + } + case MAP: { + const map = as(new Map, index); + for (const [key, index] of value) + map.set(unpair(key), unpair(index)); + return map; + } + case SET: { + const set = as(new Set, index); + for (const index of value) + set.add(unpair(index)); + return set; + } + case ERROR: { + const {name, message} = value; + return as(new env[name](message), index); + } + case BIGINT: + return as(BigInt(value), index); + case 'BigInt': + return as(Object(BigInt(value)), index); + case 'ArrayBuffer': + return as(new Uint8Array(value).buffer, value); + case 'DataView': { + const { buffer } = new Uint8Array(value); + return as(new DataView(buffer), value); + } + } + return as(new env[type](value), index); + }; + + return unpair; +}; + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns a deserialized value from a serialized array of Records. + * @param {Record[]} serialized a previously serialized value. + * @returns {any} + */ +export const deserialize = serialized => deserializer(new Map, serialized)(0); diff --git a/node_modules/@ungap/structured-clone/esm/index.js b/node_modules/@ungap/structured-clone/esm/index.js new file mode 100644 index 00000000..d3b47479 --- /dev/null +++ b/node_modules/@ungap/structured-clone/esm/index.js @@ -0,0 +1,25 @@ +import {deserialize} from './deserialize.js'; +import {serialize} from './serialize.js'; + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns an array of serialized Records. + * @param {any} any a serializable value. + * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with + * a transfer option (ignored when polyfilled) and/or non standard fields that + * fallback to the polyfill if present. + * @returns {Record[]} + */ +export default typeof structuredClone === "function" ? + /* c8 ignore start */ + (any, options) => ( + options && ('json' in options || 'lossy' in options) ? + deserialize(serialize(any, options)) : structuredClone(any) + ) : + (any, options) => deserialize(serialize(any, options)); + /* c8 ignore stop */ + +export {deserialize, serialize}; diff --git a/node_modules/@ungap/structured-clone/esm/json.js b/node_modules/@ungap/structured-clone/esm/json.js new file mode 100644 index 00000000..23eb9522 --- /dev/null +++ b/node_modules/@ungap/structured-clone/esm/json.js @@ -0,0 +1,21 @@ +/*! (c) Andrea Giammarchi - ISC */ + +import {deserialize} from './deserialize.js'; +import {serialize} from './serialize.js'; + +const {parse: $parse, stringify: $stringify} = JSON; +const options = {json: true, lossy: true}; + +/** + * Revive a previously stringified structured clone. + * @param {string} str previously stringified data as string. + * @returns {any} whatever was previously stringified as clone. + */ +export const parse = str => deserialize($parse(str)); + +/** + * Represent a structured clone value as string. + * @param {any} any some clone-able value to stringify. + * @returns {string} the value stringified. + */ +export const stringify = any => $stringify(serialize(any, options)); diff --git a/node_modules/@ungap/structured-clone/esm/serialize.js b/node_modules/@ungap/structured-clone/esm/serialize.js new file mode 100644 index 00000000..6286047a --- /dev/null +++ b/node_modules/@ungap/structured-clone/esm/serialize.js @@ -0,0 +1,171 @@ +import { + VOID, PRIMITIVE, + ARRAY, OBJECT, + DATE, REGEXP, MAP, SET, + ERROR, BIGINT +} from './types.js'; + +const EMPTY = ''; + +const {toString} = {}; +const {keys} = Object; + +const typeOf = value => { + const type = typeof value; + if (type !== 'object' || !value) + return [PRIMITIVE, type]; + + const asString = toString.call(value).slice(8, -1); + switch (asString) { + case 'Array': + return [ARRAY, EMPTY]; + case 'Object': + return [OBJECT, EMPTY]; + case 'Date': + return [DATE, EMPTY]; + case 'RegExp': + return [REGEXP, EMPTY]; + case 'Map': + return [MAP, EMPTY]; + case 'Set': + return [SET, EMPTY]; + case 'DataView': + return [ARRAY, asString]; + } + + if (asString.includes('Array')) + return [ARRAY, asString]; + + if (asString.includes('Error')) + return [ERROR, asString]; + + return [OBJECT, asString]; +}; + +const shouldSkip = ([TYPE, type]) => ( + TYPE === PRIMITIVE && + (type === 'function' || type === 'symbol') +); + +const serializer = (strict, json, $, _) => { + + const as = (out, value) => { + const index = _.push(out) - 1; + $.set(value, index); + return index; + }; + + const pair = value => { + if ($.has(value)) + return $.get(value); + + let [TYPE, type] = typeOf(value); + switch (TYPE) { + case PRIMITIVE: { + let entry = value; + switch (type) { + case 'bigint': + TYPE = BIGINT; + entry = value.toString(); + break; + case 'function': + case 'symbol': + if (strict) + throw new TypeError('unable to serialize ' + type); + entry = null; + break; + case 'undefined': + return as([VOID], value); + } + return as([TYPE, entry], value); + } + case ARRAY: { + if (type) { + let spread = value; + if (type === 'DataView') { + spread = new Uint8Array(value.buffer); + } + else if (type === 'ArrayBuffer') { + spread = new Uint8Array(value); + } + return as([type, [...spread]], value); + } + + const arr = []; + const index = as([TYPE, arr], value); + for (const entry of value) + arr.push(pair(entry)); + return index; + } + case OBJECT: { + if (type) { + switch (type) { + case 'BigInt': + return as([type, value.toString()], value); + case 'Boolean': + case 'Number': + case 'String': + return as([type, value.valueOf()], value); + } + } + + if (json && ('toJSON' in value)) + return pair(value.toJSON()); + + const entries = []; + const index = as([TYPE, entries], value); + for (const key of keys(value)) { + if (strict || !shouldSkip(typeOf(value[key]))) + entries.push([pair(key), pair(value[key])]); + } + return index; + } + case DATE: + return as([TYPE, value.toISOString()], value); + case REGEXP: { + const {source, flags} = value; + return as([TYPE, {source, flags}], value); + } + case MAP: { + const entries = []; + const index = as([TYPE, entries], value); + for (const [key, entry] of value) { + if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) + entries.push([pair(key), pair(entry)]); + } + return index; + } + case SET: { + const entries = []; + const index = as([TYPE, entries], value); + for (const entry of value) { + if (strict || !shouldSkip(typeOf(entry))) + entries.push(pair(entry)); + } + return index; + } + } + + const {message} = value; + return as([TYPE, {name: type, message}], value); + }; + + return pair; +}; + +/** + * @typedef {Array} Record a type representation + */ + +/** + * Returns an array of serialized Records. + * @param {any} value a serializable value. + * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that, + * if `true`, will not throw errors on incompatible types, and behave more + * like JSON stringify would behave. Symbol and Function will be discarded. + * @returns {Record[]} + */ + export const serialize = (value, {json, lossy} = {}) => { + const _ = []; + return serializer(!(json || lossy), !!json, new Map, _)(value), _; +}; diff --git a/node_modules/@ungap/structured-clone/esm/types.js b/node_modules/@ungap/structured-clone/esm/types.js new file mode 100644 index 00000000..50e60ca0 --- /dev/null +++ b/node_modules/@ungap/structured-clone/esm/types.js @@ -0,0 +1,11 @@ +export const VOID = -1; +export const PRIMITIVE = 0; +export const ARRAY = 1; +export const OBJECT = 2; +export const DATE = 3; +export const REGEXP = 4; +export const MAP = 5; +export const SET = 6; +export const ERROR = 7; +export const BIGINT = 8; +// export const SYMBOL = 9; diff --git a/node_modules/@ungap/structured-clone/package.json b/node_modules/@ungap/structured-clone/package.json new file mode 100644 index 00000000..d85636f1 --- /dev/null +++ b/node_modules/@ungap/structured-clone/package.json @@ -0,0 +1,54 @@ +{ + "name": "@ungap/structured-clone", + "version": "1.3.0", + "description": "A structuredClone polyfill", + "main": "./cjs/index.js", + "scripts": { + "build": "npm run cjs && npm run rollup:json && npm run test", + "cjs": "ascjs esm cjs", + "coverage": "c8 report --reporter=text-lcov > ./coverage/lcov.info", + "rollup:json": "rollup --config rollup/json.config.js", + "test": "c8 node test/index.js" + }, + "keywords": [ + "recursion", + "structured", + "clone", + "algorithm" + ], + "author": "Andrea Giammarchi", + "license": "ISC", + "devDependencies": { + "@rollup/plugin-node-resolve": "^16.0.0", + "@rollup/plugin-terser": "^0.4.4", + "ascjs": "^6.0.3", + "c8": "^10.1.3", + "coveralls": "^3.1.1", + "rollup": "^4.31.0" + }, + "module": "./esm/index.js", + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "import": "./esm/index.js", + "default": "./cjs/index.js" + }, + "./json": { + "import": "./esm/json.js", + "default": "./cjs/json.js" + }, + "./package.json": "./package.json" + }, + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ungap/structured-clone.git" + }, + "bugs": { + "url": "https://github.com/ungap/structured-clone/issues" + }, + "homepage": "https://github.com/ungap/structured-clone#readme" +} diff --git a/node_modules/@ungap/structured-clone/structured-json.js b/node_modules/@ungap/structured-clone/structured-json.js new file mode 100644 index 00000000..d5f7d9c7 --- /dev/null +++ b/node_modules/@ungap/structured-clone/structured-json.js @@ -0,0 +1 @@ +var StructuredJSON=function(e){"use strict";const r="object"==typeof self?self:globalThis,t=e=>((e,t)=>{const n=(r,t)=>(e.set(t,r),r),s=c=>{if(e.has(c))return e.get(c);const[a,o]=t[c];switch(a){case 0:case-1:return n(o,c);case 1:{const e=n([],c);for(const r of o)e.push(s(r));return e}case 2:{const e=n({},c);for(const[r,t]of o)e[s(r)]=s(t);return e}case 3:return n(new Date(o),c);case 4:{const{source:e,flags:r}=o;return n(new RegExp(e,r),c)}case 5:{const e=n(new Map,c);for(const[r,t]of o)e.set(s(r),s(t));return e}case 6:{const e=n(new Set,c);for(const r of o)e.add(s(r));return e}case 7:{const{name:e,message:t}=o;return n(new r[e](t),c)}case 8:return n(BigInt(o),c);case"BigInt":return n(Object(BigInt(o)),c);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new r[a](o),c)};return s})(new Map,e)(0),n="",{toString:s}={},{keys:c}=Object,a=e=>{const r=typeof e;if("object"!==r||!e)return[0,r];const t=s.call(e).slice(8,-1);switch(t){case"Array":return[1,n];case"Object":return[2,n];case"Date":return[3,n];case"RegExp":return[4,n];case"Map":return[5,n];case"Set":return[6,n];case"DataView":return[1,t]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},o=([e,r])=>0===e&&("function"===r||"symbol"===r),u=(e,{json:r,lossy:t}={})=>{const n=[];return((e,r,t,n)=>{const s=(e,r)=>{const s=n.push(e)-1;return t.set(r,s),s},u=n=>{if(t.has(n))return t.get(n);let[f,i]=a(n);switch(f){case 0:{let r=n;switch(i){case"bigint":f=8,r=n.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+i);r=null;break;case"undefined":return s([-1],n)}return s([f,r],n)}case 1:{if(i){let e=n;return"DataView"===i?e=new Uint8Array(n.buffer):"ArrayBuffer"===i&&(e=new Uint8Array(n)),s([i,[...e]],n)}const e=[],r=s([f,e],n);for(const r of n)e.push(u(r));return r}case 2:{if(i)switch(i){case"BigInt":return s([i,n.toString()],n);case"Boolean":case"Number":case"String":return s([i,n.valueOf()],n)}if(r&&"toJSON"in n)return u(n.toJSON());const t=[],l=s([f,t],n);for(const r of c(n))!e&&o(a(n[r]))||t.push([u(r),u(n[r])]);return l}case 3:return s([f,n.toISOString()],n);case 4:{const{source:e,flags:r}=n;return s([f,{source:e,flags:r}],n)}case 5:{const r=[],t=s([f,r],n);for(const[t,s]of n)(e||!o(a(t))&&!o(a(s)))&&r.push([u(t),u(s)]);return t}case 6:{const r=[],t=s([f,r],n);for(const t of n)!e&&o(a(t))||r.push(u(t));return t}}const{message:l}=n;return s([f,{name:i,message:l}],n)};return u})(!(r||t),!!r,new Map,n)(e),n},{parse:f,stringify:i}=JSON,l={json:!0,lossy:!0};return e.parse=e=>t(f(e)),e.stringify=e=>i(u(e,l)),e}({}); diff --git a/node_modules/bail/index.d.ts b/node_modules/bail/index.d.ts new file mode 100644 index 00000000..88fe9aa6 --- /dev/null +++ b/node_modules/bail/index.d.ts @@ -0,0 +1,10 @@ +/** + * Throw a given error. + * + * @param {Error|null|undefined} [error] + * Maybe error. + * @returns {asserts error is null|undefined} + */ +export function bail( + error?: Error | null | undefined +): asserts error is null | undefined diff --git a/node_modules/bail/index.js b/node_modules/bail/index.js new file mode 100644 index 00000000..d0bc4424 --- /dev/null +++ b/node_modules/bail/index.js @@ -0,0 +1,12 @@ +/** + * Throw a given error. + * + * @param {Error|null|undefined} [error] + * Maybe error. + * @returns {asserts error is null|undefined} + */ +export function bail(error) { + if (error) { + throw error + } +} diff --git a/node_modules/bail/license b/node_modules/bail/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/bail/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/bail/package.json b/node_modules/bail/package.json new file mode 100644 index 00000000..d56f6faf --- /dev/null +++ b/node_modules/bail/package.json @@ -0,0 +1,73 @@ +{ + "name": "bail", + "version": "2.0.2", + "description": "Throw a given error", + "license": "MIT", + "keywords": [ + "fail", + "bail", + "throw", + "callback", + "error" + ], + "repository": "wooorm/bail", + "bugs": "https://github.com/wooorm/bail/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "tsd": "^0.18.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && tsd && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true + } +} diff --git a/node_modules/bail/readme.md b/node_modules/bail/readme.md new file mode 100644 index 00000000..8cd18235 --- /dev/null +++ b/node_modules/bail/readme.md @@ -0,0 +1,147 @@ +# bail + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Throw if given an error. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`bail(err?)`](#bailerr) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package throws a given error. + +## When should I use this? + +Use this package if you’re building some scripts that might theoretically get +errors but frequently don’t and you keep writing `if (error) throw error` over +and over again and you’re just really done with that. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install bail +``` + +In Deno with [Skypack][]: + +```js +import {bail} from 'https://cdn.skypack.dev/bail@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {bail} from 'bail' + +bail() + +bail(new Error('failure')) +// Error: failure +// at repl:1:6 +// at REPLServer.defaultEval (repl.js:154:27) +// … +``` + +## API + +This package exports the following identifier: `bail`. +There is no default export. + +### `bail(err?)` + +Throw a given error (`Error?`). + +## Types + +This package is fully typed with [TypeScript][]. +There are no extra exported types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`noop`][noop] +* [`noop2`][noop2] +* [`noop3`][noop3] + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/bail/workflows/main/badge.svg + +[build]: https://github.com/wooorm/bail/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/bail.svg + +[coverage]: https://codecov.io/github/wooorm/bail + +[downloads-badge]: https://img.shields.io/npm/dm/bail.svg + +[downloads]: https://www.npmjs.com/package/bail + +[size-badge]: https://img.shields.io/bundlephobia/minzip/bail.svg + +[size]: https://bundlephobia.com/result?p=bail + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[noop]: https://www.npmjs.com/package/noop + +[noop2]: https://www.npmjs.com/package/noop2 + +[noop3]: https://www.npmjs.com/package/noop3 diff --git a/node_modules/ccount/index.d.ts b/node_modules/ccount/index.d.ts new file mode 100644 index 00000000..4688e5ca --- /dev/null +++ b/node_modules/ccount/index.d.ts @@ -0,0 +1,11 @@ +/** + * Count how often a character (or substring) is used in a string. + * + * @param {string} value + * Value to search in. + * @param {string} character + * Character (or substring) to look for. + * @return {number} + * Number of times `character` occurred in `value`. + */ +export function ccount(value: string, character: string): number diff --git a/node_modules/ccount/index.js b/node_modules/ccount/index.js new file mode 100644 index 00000000..6d9a4841 --- /dev/null +++ b/node_modules/ccount/index.js @@ -0,0 +1,27 @@ +/** + * Count how often a character (or substring) is used in a string. + * + * @param {string} value + * Value to search in. + * @param {string} character + * Character (or substring) to look for. + * @return {number} + * Number of times `character` occurred in `value`. + */ +export function ccount(value, character) { + const source = String(value) + + if (typeof character !== 'string') { + throw new TypeError('Expected character') + } + + let count = 0 + let index = source.indexOf(character) + + while (index !== -1) { + count++ + index = source.indexOf(character, index + character.length) + } + + return count +} diff --git a/node_modules/ccount/license b/node_modules/ccount/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/ccount/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ccount/package.json b/node_modules/ccount/package.json new file mode 100644 index 00000000..88fd8dff --- /dev/null +++ b/node_modules/ccount/package.json @@ -0,0 +1,71 @@ +{ + "name": "ccount", + "version": "2.0.1", + "description": "Count how often a character (or substring) is used in a string", + "license": "MIT", + "keywords": [ + "character", + "count", + "char" + ], + "repository": "wooorm/ccount", + "bugs": "https://github.com/wooorm/ccount/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/ccount/readme.md b/node_modules/ccount/readme.md new file mode 100644 index 00000000..54bf79ec --- /dev/null +++ b/node_modules/ccount/readme.md @@ -0,0 +1,149 @@ +# ccount + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Count how often a character (or substring) is used in a string. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`ccount(value, character)`](#ccountvalue-character) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a small utility that helps you find how frequently a substring +occurs in another string. + +## When should I use this? + +I find this particularly useful when generating code, for example, when building +a string that can either be double or single quoted. +I use this utility to choose single quotes when double quotes are used more +frequently, and double quotes otherwise. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install ccount +``` + +In Deno with [Skypack][]: + +```js +import {ccount} from 'https://cdn.skypack.dev/ccount@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {ccount} from 'ccount' + +ccount('foo(bar(baz)', '(') // => 2 +ccount('foo(bar(baz)', ')') // => 1 +``` + +## API + +This package exports the following identifier: `ccount`. +There is no default export. + +### `ccount(value, character)` + +Count how often a character (or substring) is used in a string. + +###### Parameters + +* `value` (`string`) + — value to search in +* `character` (`string`) + — character (or substring) to look for + +###### Returns + +`number` — number of times `character` occurred in `value`. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/longest-streak`](https://github.com/wooorm/longest-streak) + — count of longest repeating streak of `character` in `value` +* [`wooorm/direction`](https://github.com/wooorm/direction) + — detect directionality: left-to-right, right-to-left, or neutral + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/ccount/workflows/main/badge.svg + +[build]: https://github.com/wooorm/ccount/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/ccount.svg + +[coverage]: https://codecov.io/github/wooorm/ccount + +[downloads-badge]: https://img.shields.io/npm/dm/ccount.svg + +[downloads]: https://www.npmjs.com/package/ccount + +[size-badge]: https://img.shields.io/bundlephobia/minzip/ccount.svg + +[size]: https://bundlephobia.com/result?p=ccount + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/character-entities-html4/index.d.ts b/node_modules/character-entities-html4/index.d.ts new file mode 100644 index 00000000..3cd16954 --- /dev/null +++ b/node_modules/character-entities-html4/index.d.ts @@ -0,0 +1,6 @@ +/** + * Map of named character references from HTML 4. + * + * @type {Record} + */ +export const characterEntitiesHtml4: Record diff --git a/node_modules/character-entities-html4/index.js b/node_modules/character-entities-html4/index.js new file mode 100644 index 00000000..b77d0b7e --- /dev/null +++ b/node_modules/character-entities-html4/index.js @@ -0,0 +1,259 @@ +/** + * Map of named character references from HTML 4. + * + * @type {Record} + */ +export const characterEntitiesHtml4 = { + nbsp: ' ', + iexcl: '¡', + cent: '¢', + pound: '£', + curren: '¤', + yen: '¥', + brvbar: '¦', + sect: '§', + uml: '¨', + copy: '©', + ordf: 'ª', + laquo: '«', + not: '¬', + shy: '­', + reg: '®', + macr: '¯', + deg: '°', + plusmn: '±', + sup2: '²', + sup3: '³', + acute: '´', + micro: 'µ', + para: '¶', + middot: '·', + cedil: '¸', + sup1: '¹', + ordm: 'º', + raquo: '»', + frac14: '¼', + frac12: '½', + frac34: '¾', + iquest: '¿', + Agrave: 'À', + Aacute: 'Á', + Acirc: 'Â', + Atilde: 'Ã', + Auml: 'Ä', + Aring: 'Å', + AElig: 'Æ', + Ccedil: 'Ç', + Egrave: 'È', + Eacute: 'É', + Ecirc: 'Ê', + Euml: 'Ë', + Igrave: 'Ì', + Iacute: 'Í', + Icirc: 'Î', + Iuml: 'Ï', + ETH: 'Ð', + Ntilde: 'Ñ', + Ograve: 'Ò', + Oacute: 'Ó', + Ocirc: 'Ô', + Otilde: 'Õ', + Ouml: 'Ö', + times: '×', + Oslash: 'Ø', + Ugrave: 'Ù', + Uacute: 'Ú', + Ucirc: 'Û', + Uuml: 'Ü', + Yacute: 'Ý', + THORN: 'Þ', + szlig: 'ß', + agrave: 'à', + aacute: 'á', + acirc: 'â', + atilde: 'ã', + auml: 'ä', + aring: 'å', + aelig: 'æ', + ccedil: 'ç', + egrave: 'è', + eacute: 'é', + ecirc: 'ê', + euml: 'ë', + igrave: 'ì', + iacute: 'í', + icirc: 'î', + iuml: 'ï', + eth: 'ð', + ntilde: 'ñ', + ograve: 'ò', + oacute: 'ó', + ocirc: 'ô', + otilde: 'õ', + ouml: 'ö', + divide: '÷', + oslash: 'ø', + ugrave: 'ù', + uacute: 'ú', + ucirc: 'û', + uuml: 'ü', + yacute: 'ý', + thorn: 'þ', + yuml: 'ÿ', + fnof: 'ƒ', + Alpha: 'Α', + Beta: 'Β', + Gamma: 'Γ', + Delta: 'Δ', + Epsilon: 'Ε', + Zeta: 'Ζ', + Eta: 'Η', + Theta: 'Θ', + Iota: 'Ι', + Kappa: 'Κ', + Lambda: 'Λ', + Mu: 'Μ', + Nu: 'Ν', + Xi: 'Ξ', + Omicron: 'Ο', + Pi: 'Π', + Rho: 'Ρ', + Sigma: 'Σ', + Tau: 'Τ', + Upsilon: 'Υ', + Phi: 'Φ', + Chi: 'Χ', + Psi: 'Ψ', + Omega: 'Ω', + alpha: 'α', + beta: 'β', + gamma: 'γ', + delta: 'δ', + epsilon: 'ε', + zeta: 'ζ', + eta: 'η', + theta: 'θ', + iota: 'ι', + kappa: 'κ', + lambda: 'λ', + mu: 'μ', + nu: 'ν', + xi: 'ξ', + omicron: 'ο', + pi: 'π', + rho: 'ρ', + sigmaf: 'ς', + sigma: 'σ', + tau: 'τ', + upsilon: 'υ', + phi: 'φ', + chi: 'χ', + psi: 'ψ', + omega: 'ω', + thetasym: 'ϑ', + upsih: 'ϒ', + piv: 'ϖ', + bull: '•', + hellip: '…', + prime: '′', + Prime: '″', + oline: '‾', + frasl: '⁄', + weierp: '℘', + image: 'ℑ', + real: 'ℜ', + trade: '™', + alefsym: 'ℵ', + larr: '←', + uarr: '↑', + rarr: '→', + darr: '↓', + harr: '↔', + crarr: '↵', + lArr: '⇐', + uArr: '⇑', + rArr: '⇒', + dArr: '⇓', + hArr: '⇔', + forall: '∀', + part: '∂', + exist: '∃', + empty: '∅', + nabla: '∇', + isin: '∈', + notin: '∉', + ni: '∋', + prod: '∏', + sum: '∑', + minus: '−', + lowast: '∗', + radic: '√', + prop: '∝', + infin: '∞', + ang: '∠', + and: '∧', + or: '∨', + cap: '∩', + cup: '∪', + int: '∫', + there4: '∴', + sim: '∼', + cong: '≅', + asymp: '≈', + ne: '≠', + equiv: '≡', + le: '≤', + ge: '≥', + sub: '⊂', + sup: '⊃', + nsub: '⊄', + sube: '⊆', + supe: '⊇', + oplus: '⊕', + otimes: '⊗', + perp: '⊥', + sdot: '⋅', + lceil: '⌈', + rceil: '⌉', + lfloor: '⌊', + rfloor: '⌋', + lang: '〈', + rang: '〉', + loz: '◊', + spades: '♠', + clubs: '♣', + hearts: '♥', + diams: '♦', + quot: '"', + amp: '&', + lt: '<', + gt: '>', + OElig: 'Œ', + oelig: 'œ', + Scaron: 'Š', + scaron: 'š', + Yuml: 'Ÿ', + circ: 'ˆ', + tilde: '˜', + ensp: ' ', + emsp: ' ', + thinsp: ' ', + zwnj: '‌', + zwj: '‍', + lrm: '‎', + rlm: '‏', + ndash: '–', + mdash: '—', + lsquo: '‘', + rsquo: '’', + sbquo: '‚', + ldquo: '“', + rdquo: '”', + bdquo: '„', + dagger: '†', + Dagger: '‡', + permil: '‰', + lsaquo: '‹', + rsaquo: '›', + euro: '€' +} diff --git a/node_modules/character-entities-html4/license b/node_modules/character-entities-html4/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/character-entities-html4/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/character-entities-html4/package.json b/node_modules/character-entities-html4/package.json new file mode 100644 index 00000000..8510a941 --- /dev/null +++ b/node_modules/character-entities-html4/package.json @@ -0,0 +1,79 @@ +{ + "name": "character-entities-html4", + "version": "2.1.0", + "description": "Map of named character references from HTML 4", + "license": "MIT", + "keywords": [ + "html", + "html4", + "entity", + "entities", + "character", + "reference", + "name", + "replacement" + ], + "repository": "wooorm/character-entities-html4", + "bugs": "https://github.com/wooorm/character-entities-html4/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "bail": "^2.0.0", + "c8": "^7.0.0", + "concat-stream": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "generate": "node build", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/character-entities-html4/readme.md b/node_modules/character-entities-html4/readme.md new file mode 100644 index 00000000..703aa6da --- /dev/null +++ b/node_modules/character-entities-html4/readme.md @@ -0,0 +1,153 @@ +# character-entities-html4 + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Map of named character references from HTML 4. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`characterEntitiesHtml4`](#characterentitieshtml4) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a map of named character references in HTML 4 to the characters they +represent. + +## When should I use this? + +Maybe when you’re writing an HTML parser or minifier, but otherwise probably +never! +Even then, it might be better to use [`parse-entities`][parse-entities] or +[`stringify-entities`][stringify-entities]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install character-entities-html4 +``` + +In Deno with [Skypack][]: + +```js +import {characterEntitiesHtml4} from 'https://cdn.skypack.dev/character-entities-html4@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {characterEntitiesHtml4} from 'character-entities-html4' + +console.log(characterEntitiesHtml4.AElig) // => 'Æ' +console.log(characterEntitiesHtml4.aelig) // => 'æ' +console.log(characterEntitiesHtml4.amp) // => '&' +console.log(characterEntitiesHtml4.apos) // => undefined +``` + +## API + +This package exports the following identifiers: `characterEntitiesHtml4`. +There is no default export. + +### `characterEntitiesHtml4` + +Map of case sensitive named character references from HTML 4. +See [`w3.org`][html] for more info. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`parse-entities`](https://github.com/wooorm/parse-entities) + — parse (decode) character references +* [`stringify-entities`](https://github.com/wooorm/stringify-entities) + — serialize (encode) character references +* [`character-entities`](https://github.com/wooorm/character-entities) + — info on character entities +* [`character-entities-invalid`](https://github.com/wooorm/character-entities-invalid) + — info on invalid numeric character references +* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — info on legacy named character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/character-entities-html4/workflows/main/badge.svg + +[build]: https://github.com/wooorm/character-entities-html4/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities-html4.svg + +[coverage]: https://codecov.io/github/wooorm/character-entities-html4 + +[downloads-badge]: https://img.shields.io/npm/dm/character-entities-html4.svg + +[downloads]: https://www.npmjs.com/package/character-entities-html4 + +[size-badge]: https://img.shields.io/bundlephobia/minzip/character-entities-html4.svg + +[size]: https://bundlephobia.com/result?p=character-entities-html4 + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[parse-entities]: https://github.com/wooorm/parse-entities + +[stringify-entities]: https://github.com/wooorm/stringify-entities + +[html]: https://www.w3.org/TR/html4/sgml/entities.html diff --git a/node_modules/character-entities-legacy/index.d.ts b/node_modules/character-entities-legacy/index.d.ts new file mode 100644 index 00000000..2d567ecc --- /dev/null +++ b/node_modules/character-entities-legacy/index.d.ts @@ -0,0 +1,6 @@ +/** + * List of legacy HTML named character references that don’t need a trailing semicolon. + * + * @type {Array} + */ +export const characterEntitiesLegacy: Array diff --git a/node_modules/character-entities-legacy/index.js b/node_modules/character-entities-legacy/index.js new file mode 100644 index 00000000..678d6a70 --- /dev/null +++ b/node_modules/character-entities-legacy/index.js @@ -0,0 +1,113 @@ +/** + * List of legacy HTML named character references that don’t need a trailing semicolon. + * + * @type {Array} + */ +export const characterEntitiesLegacy = [ + 'AElig', + 'AMP', + 'Aacute', + 'Acirc', + 'Agrave', + 'Aring', + 'Atilde', + 'Auml', + 'COPY', + 'Ccedil', + 'ETH', + 'Eacute', + 'Ecirc', + 'Egrave', + 'Euml', + 'GT', + 'Iacute', + 'Icirc', + 'Igrave', + 'Iuml', + 'LT', + 'Ntilde', + 'Oacute', + 'Ocirc', + 'Ograve', + 'Oslash', + 'Otilde', + 'Ouml', + 'QUOT', + 'REG', + 'THORN', + 'Uacute', + 'Ucirc', + 'Ugrave', + 'Uuml', + 'Yacute', + 'aacute', + 'acirc', + 'acute', + 'aelig', + 'agrave', + 'amp', + 'aring', + 'atilde', + 'auml', + 'brvbar', + 'ccedil', + 'cedil', + 'cent', + 'copy', + 'curren', + 'deg', + 'divide', + 'eacute', + 'ecirc', + 'egrave', + 'eth', + 'euml', + 'frac12', + 'frac14', + 'frac34', + 'gt', + 'iacute', + 'icirc', + 'iexcl', + 'igrave', + 'iquest', + 'iuml', + 'laquo', + 'lt', + 'macr', + 'micro', + 'middot', + 'nbsp', + 'not', + 'ntilde', + 'oacute', + 'ocirc', + 'ograve', + 'ordf', + 'ordm', + 'oslash', + 'otilde', + 'ouml', + 'para', + 'plusmn', + 'pound', + 'quot', + 'raquo', + 'reg', + 'sect', + 'shy', + 'sup1', + 'sup2', + 'sup3', + 'szlig', + 'thorn', + 'times', + 'uacute', + 'ucirc', + 'ugrave', + 'uml', + 'uuml', + 'yacute', + 'yen', + 'yuml' +] diff --git a/node_modules/character-entities-legacy/license b/node_modules/character-entities-legacy/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/character-entities-legacy/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/character-entities-legacy/package.json b/node_modules/character-entities-legacy/package.json new file mode 100644 index 00000000..6f680561 --- /dev/null +++ b/node_modules/character-entities-legacy/package.json @@ -0,0 +1,77 @@ +{ + "name": "character-entities-legacy", + "version": "3.0.0", + "description": "List of legacy HTML named character references that don’t need a trailing semicolon", + "license": "MIT", + "keywords": [ + "html", + "entity", + "entities", + "character", + "reference", + "name" + ], + "repository": "wooorm/character-entities-legacy", + "bugs": "https://github.com/wooorm/character-entities-legacy/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "bail": "^2.0.0", + "c8": "^7.0.0", + "concat-stream": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.45.0" + }, + "scripts": { + "generate": "node build", + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/character-entities-legacy/readme.md b/node_modules/character-entities-legacy/readme.md new file mode 100644 index 00000000..9c1765fa --- /dev/null +++ b/node_modules/character-entities-legacy/readme.md @@ -0,0 +1,157 @@ +# character-entities-legacy + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +List of legacy HTML named character references that don’t need a trailing +semicolon. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`characterEntitiesLegacy`](#characterentitieslegacy) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a list of certain named character references, that due to legacy +reasons, don’t need a trailing semicolon in HTML. +For example, `©` is perfectly fine for `©`! + +## When should I use this? + +Maybe when you’re writing an HTML parser or minifier, but otherwise probably +never! +Even then, it might be better to use [`parse-entities`][parse-entities] or +[`stringify-entities`][stringify-entities]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install character-entities-legacy +``` + +In Deno with [Skypack][]: + +```js +import {characterEntitiesLegacy} from 'https://cdn.skypack.dev/character-entities-legacy@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {characterEntitiesLegacy} from 'character-entities-legacy' + +console.log(characterEntitiesLegacy.includes('copy')) // => true +console.log(characterEntitiesLegacy.includes('frac34')) // => true +console.log(characterEntitiesLegacy.includes('sup1')) // => true +``` + +## API + +This package exports the following identifiers: `characterEntitiesLegacy`. +There is no default export. + +### `characterEntitiesLegacy` + +List of (case sensitive) legacy character entity names. +[`wooorm/character-entities`][character-entities] holds their decoded values. +See [`whatwg/html`][html] for more info. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/parse-entities`](https://github.com/wooorm/parse-entities) + — parse (decode) character references +* [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities) + — serialize (encode) character references +* [`wooorm/character-entities`](https://github.com/wooorm/character-entities) + — info on character entities +* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — info on HTML4 character entities +* [`wooorm/character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — info on invalid numeric character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/character-entities-legacy/workflows/main/badge.svg + +[build]: https://github.com/wooorm/character-entities-legacy/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities-legacy.svg + +[coverage]: https://codecov.io/github/wooorm/character-entities-legacy + +[downloads-badge]: https://img.shields.io/npm/dm/character-entities-legacy.svg + +[downloads]: https://www.npmjs.com/package/character-entities-legacy + +[size-badge]: https://img.shields.io/bundlephobia/minzip/character-entities-legacy.svg + +[size]: https://bundlephobia.com/result?p=character-entities-legacy + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[html]: https://github.com/whatwg/html-build/blob/HEAD/entities/json-entities-legacy.inc + +[parse-entities]: https://github.com/wooorm/parse-entities + +[stringify-entities]: https://github.com/wooorm/stringify-entities + +[character-entities]: https://github.com/wooorm/character-entities diff --git a/node_modules/character-entities/index.d.ts b/node_modules/character-entities/index.d.ts new file mode 100644 index 00000000..aa7e651a --- /dev/null +++ b/node_modules/character-entities/index.d.ts @@ -0,0 +1,6 @@ +/** + * Map of named character references. + * + * @type {Record} + */ +export const characterEntities: Record diff --git a/node_modules/character-entities/index.js b/node_modules/character-entities/index.js new file mode 100644 index 00000000..9222e7a7 --- /dev/null +++ b/node_modules/character-entities/index.js @@ -0,0 +1,2132 @@ +/** + * Map of named character references. + * + * @type {Record} + */ +export const characterEntities = { + AElig: 'Æ', + AMP: '&', + Aacute: 'Á', + Abreve: 'Ă', + Acirc: 'Â', + Acy: 'А', + Afr: '𝔄', + Agrave: 'À', + Alpha: 'Α', + Amacr: 'Ā', + And: '⩓', + Aogon: 'Ą', + Aopf: '𝔸', + ApplyFunction: '⁡', + Aring: 'Å', + Ascr: '𝒜', + Assign: '≔', + Atilde: 'Ã', + Auml: 'Ä', + Backslash: '∖', + Barv: '⫧', + Barwed: '⌆', + Bcy: 'Б', + Because: '∵', + Bernoullis: 'ℬ', + Beta: 'Β', + Bfr: '𝔅', + Bopf: '𝔹', + Breve: '˘', + Bscr: 'ℬ', + Bumpeq: '≎', + CHcy: 'Ч', + COPY: '©', + Cacute: 'Ć', + Cap: '⋒', + CapitalDifferentialD: 'ⅅ', + Cayleys: 'ℭ', + Ccaron: 'Č', + Ccedil: 'Ç', + Ccirc: 'Ĉ', + Cconint: '∰', + Cdot: 'Ċ', + Cedilla: '¸', + CenterDot: '·', + Cfr: 'ℭ', + Chi: 'Χ', + CircleDot: '⊙', + CircleMinus: '⊖', + CirclePlus: '⊕', + CircleTimes: '⊗', + ClockwiseContourIntegral: '∲', + CloseCurlyDoubleQuote: '”', + CloseCurlyQuote: '’', + Colon: '∷', + Colone: '⩴', + Congruent: '≡', + Conint: '∯', + ContourIntegral: '∮', + Copf: 'ℂ', + Coproduct: '∐', + CounterClockwiseContourIntegral: '∳', + Cross: '⨯', + Cscr: '𝒞', + Cup: '⋓', + CupCap: '≍', + DD: 'ⅅ', + DDotrahd: '⤑', + DJcy: 'Ђ', + DScy: 'Ѕ', + DZcy: 'Џ', + Dagger: '‡', + Darr: '↡', + Dashv: '⫤', + Dcaron: 'Ď', + Dcy: 'Д', + Del: '∇', + Delta: 'Δ', + Dfr: '𝔇', + DiacriticalAcute: '´', + DiacriticalDot: '˙', + DiacriticalDoubleAcute: '˝', + DiacriticalGrave: '`', + DiacriticalTilde: '˜', + Diamond: '⋄', + DifferentialD: 'ⅆ', + Dopf: '𝔻', + Dot: '¨', + DotDot: '⃜', + DotEqual: '≐', + DoubleContourIntegral: '∯', + DoubleDot: '¨', + DoubleDownArrow: '⇓', + DoubleLeftArrow: '⇐', + DoubleLeftRightArrow: '⇔', + DoubleLeftTee: '⫤', + DoubleLongLeftArrow: '⟸', + DoubleLongLeftRightArrow: '⟺', + DoubleLongRightArrow: '⟹', + DoubleRightArrow: '⇒', + DoubleRightTee: '⊨', + DoubleUpArrow: '⇑', + DoubleUpDownArrow: '⇕', + DoubleVerticalBar: '∥', + DownArrow: '↓', + DownArrowBar: '⤓', + DownArrowUpArrow: '⇵', + DownBreve: '̑', + DownLeftRightVector: '⥐', + DownLeftTeeVector: '⥞', + DownLeftVector: '↽', + DownLeftVectorBar: '⥖', + DownRightTeeVector: '⥟', + DownRightVector: '⇁', + DownRightVectorBar: '⥗', + DownTee: '⊤', + DownTeeArrow: '↧', + Downarrow: '⇓', + Dscr: '𝒟', + Dstrok: 'Đ', + ENG: 'Ŋ', + ETH: 'Ð', + Eacute: 'É', + Ecaron: 'Ě', + Ecirc: 'Ê', + Ecy: 'Э', + Edot: 'Ė', + Efr: '𝔈', + Egrave: 'È', + Element: '∈', + Emacr: 'Ē', + EmptySmallSquare: '◻', + EmptyVerySmallSquare: '▫', + Eogon: 'Ę', + Eopf: '𝔼', + Epsilon: 'Ε', + Equal: '⩵', + EqualTilde: '≂', + Equilibrium: '⇌', + Escr: 'ℰ', + Esim: '⩳', + Eta: 'Η', + Euml: 'Ë', + Exists: '∃', + ExponentialE: 'ⅇ', + Fcy: 'Ф', + Ffr: '𝔉', + FilledSmallSquare: '◼', + FilledVerySmallSquare: '▪', + Fopf: '𝔽', + ForAll: '∀', + Fouriertrf: 'ℱ', + Fscr: 'ℱ', + GJcy: 'Ѓ', + GT: '>', + Gamma: 'Γ', + Gammad: 'Ϝ', + Gbreve: 'Ğ', + Gcedil: 'Ģ', + Gcirc: 'Ĝ', + Gcy: 'Г', + Gdot: 'Ġ', + Gfr: '𝔊', + Gg: '⋙', + Gopf: '𝔾', + GreaterEqual: '≥', + GreaterEqualLess: '⋛', + GreaterFullEqual: '≧', + GreaterGreater: '⪢', + GreaterLess: '≷', + GreaterSlantEqual: '⩾', + GreaterTilde: '≳', + Gscr: '𝒢', + Gt: '≫', + HARDcy: 'Ъ', + Hacek: 'ˇ', + Hat: '^', + Hcirc: 'Ĥ', + Hfr: 'ℌ', + HilbertSpace: 'ℋ', + Hopf: 'ℍ', + HorizontalLine: '─', + Hscr: 'ℋ', + Hstrok: 'Ħ', + HumpDownHump: '≎', + HumpEqual: '≏', + IEcy: 'Е', + IJlig: 'IJ', + IOcy: 'Ё', + Iacute: 'Í', + Icirc: 'Î', + Icy: 'И', + Idot: 'İ', + Ifr: 'ℑ', + Igrave: 'Ì', + Im: 'ℑ', + Imacr: 'Ī', + ImaginaryI: 'ⅈ', + Implies: '⇒', + Int: '∬', + Integral: '∫', + Intersection: '⋂', + InvisibleComma: '⁣', + InvisibleTimes: '⁢', + Iogon: 'Į', + Iopf: '𝕀', + Iota: 'Ι', + Iscr: 'ℐ', + Itilde: 'Ĩ', + Iukcy: 'І', + Iuml: 'Ï', + Jcirc: 'Ĵ', + Jcy: 'Й', + Jfr: '𝔍', + Jopf: '𝕁', + Jscr: '𝒥', + Jsercy: 'Ј', + Jukcy: 'Є', + KHcy: 'Х', + KJcy: 'Ќ', + Kappa: 'Κ', + Kcedil: 'Ķ', + Kcy: 'К', + Kfr: '𝔎', + Kopf: '𝕂', + Kscr: '𝒦', + LJcy: 'Љ', + LT: '<', + Lacute: 'Ĺ', + Lambda: 'Λ', + Lang: '⟪', + Laplacetrf: 'ℒ', + Larr: '↞', + Lcaron: 'Ľ', + Lcedil: 'Ļ', + Lcy: 'Л', + LeftAngleBracket: '⟨', + LeftArrow: '←', + LeftArrowBar: '⇤', + LeftArrowRightArrow: '⇆', + LeftCeiling: '⌈', + LeftDoubleBracket: '⟦', + LeftDownTeeVector: '⥡', + LeftDownVector: '⇃', + LeftDownVectorBar: '⥙', + LeftFloor: '⌊', + LeftRightArrow: '↔', + LeftRightVector: '⥎', + LeftTee: '⊣', + LeftTeeArrow: '↤', + LeftTeeVector: '⥚', + LeftTriangle: '⊲', + LeftTriangleBar: '⧏', + LeftTriangleEqual: '⊴', + LeftUpDownVector: '⥑', + LeftUpTeeVector: '⥠', + LeftUpVector: '↿', + LeftUpVectorBar: '⥘', + LeftVector: '↼', + LeftVectorBar: '⥒', + Leftarrow: '⇐', + Leftrightarrow: '⇔', + LessEqualGreater: '⋚', + LessFullEqual: '≦', + LessGreater: '≶', + LessLess: '⪡', + LessSlantEqual: '⩽', + LessTilde: '≲', + Lfr: '𝔏', + Ll: '⋘', + Lleftarrow: '⇚', + Lmidot: 'Ŀ', + LongLeftArrow: '⟵', + LongLeftRightArrow: '⟷', + LongRightArrow: '⟶', + Longleftarrow: '⟸', + Longleftrightarrow: '⟺', + Longrightarrow: '⟹', + Lopf: '𝕃', + LowerLeftArrow: '↙', + LowerRightArrow: '↘', + Lscr: 'ℒ', + Lsh: '↰', + Lstrok: 'Ł', + Lt: '≪', + Map: '⤅', + Mcy: 'М', + MediumSpace: ' ', + Mellintrf: 'ℳ', + Mfr: '𝔐', + MinusPlus: '∓', + Mopf: '𝕄', + Mscr: 'ℳ', + Mu: 'Μ', + NJcy: 'Њ', + Nacute: 'Ń', + Ncaron: 'Ň', + Ncedil: 'Ņ', + Ncy: 'Н', + NegativeMediumSpace: '​', + NegativeThickSpace: '​', + NegativeThinSpace: '​', + NegativeVeryThinSpace: '​', + NestedGreaterGreater: '≫', + NestedLessLess: '≪', + NewLine: '\n', + Nfr: '𝔑', + NoBreak: '⁠', + NonBreakingSpace: ' ', + Nopf: 'ℕ', + Not: '⫬', + NotCongruent: '≢', + NotCupCap: '≭', + NotDoubleVerticalBar: '∦', + NotElement: '∉', + NotEqual: '≠', + NotEqualTilde: '≂̸', + NotExists: '∄', + NotGreater: '≯', + NotGreaterEqual: '≱', + NotGreaterFullEqual: '≧̸', + NotGreaterGreater: '≫̸', + NotGreaterLess: '≹', + NotGreaterSlantEqual: '⩾̸', + NotGreaterTilde: '≵', + NotHumpDownHump: '≎̸', + NotHumpEqual: '≏̸', + NotLeftTriangle: '⋪', + NotLeftTriangleBar: '⧏̸', + NotLeftTriangleEqual: '⋬', + NotLess: '≮', + NotLessEqual: '≰', + NotLessGreater: '≸', + NotLessLess: '≪̸', + NotLessSlantEqual: '⩽̸', + NotLessTilde: '≴', + NotNestedGreaterGreater: '⪢̸', + NotNestedLessLess: '⪡̸', + NotPrecedes: '⊀', + NotPrecedesEqual: '⪯̸', + NotPrecedesSlantEqual: '⋠', + NotReverseElement: '∌', + NotRightTriangle: '⋫', + NotRightTriangleBar: '⧐̸', + NotRightTriangleEqual: '⋭', + NotSquareSubset: '⊏̸', + NotSquareSubsetEqual: '⋢', + NotSquareSuperset: '⊐̸', + NotSquareSupersetEqual: '⋣', + NotSubset: '⊂⃒', + NotSubsetEqual: '⊈', + NotSucceeds: '⊁', + NotSucceedsEqual: '⪰̸', + NotSucceedsSlantEqual: '⋡', + NotSucceedsTilde: '≿̸', + NotSuperset: '⊃⃒', + NotSupersetEqual: '⊉', + NotTilde: '≁', + NotTildeEqual: '≄', + NotTildeFullEqual: '≇', + NotTildeTilde: '≉', + NotVerticalBar: '∤', + Nscr: '𝒩', + Ntilde: 'Ñ', + Nu: 'Ν', + OElig: 'Œ', + Oacute: 'Ó', + Ocirc: 'Ô', + Ocy: 'О', + Odblac: 'Ő', + Ofr: '𝔒', + Ograve: 'Ò', + Omacr: 'Ō', + Omega: 'Ω', + Omicron: 'Ο', + Oopf: '𝕆', + OpenCurlyDoubleQuote: '“', + OpenCurlyQuote: '‘', + Or: '⩔', + Oscr: '𝒪', + Oslash: 'Ø', + Otilde: 'Õ', + Otimes: '⨷', + Ouml: 'Ö', + OverBar: '‾', + OverBrace: '⏞', + OverBracket: '⎴', + OverParenthesis: '⏜', + PartialD: '∂', + Pcy: 'П', + Pfr: '𝔓', + Phi: 'Φ', + Pi: 'Π', + PlusMinus: '±', + Poincareplane: 'ℌ', + Popf: 'ℙ', + Pr: '⪻', + Precedes: '≺', + PrecedesEqual: '⪯', + PrecedesSlantEqual: '≼', + PrecedesTilde: '≾', + Prime: '″', + Product: '∏', + Proportion: '∷', + Proportional: '∝', + Pscr: '𝒫', + Psi: 'Ψ', + QUOT: '"', + Qfr: '𝔔', + Qopf: 'ℚ', + Qscr: '𝒬', + RBarr: '⤐', + REG: '®', + Racute: 'Ŕ', + Rang: '⟫', + Rarr: '↠', + Rarrtl: '⤖', + Rcaron: 'Ř', + Rcedil: 'Ŗ', + Rcy: 'Р', + Re: 'ℜ', + ReverseElement: '∋', + ReverseEquilibrium: '⇋', + ReverseUpEquilibrium: '⥯', + Rfr: 'ℜ', + Rho: 'Ρ', + RightAngleBracket: '⟩', + RightArrow: '→', + RightArrowBar: '⇥', + RightArrowLeftArrow: '⇄', + RightCeiling: '⌉', + RightDoubleBracket: '⟧', + RightDownTeeVector: '⥝', + RightDownVector: '⇂', + RightDownVectorBar: '⥕', + RightFloor: '⌋', + RightTee: '⊢', + RightTeeArrow: '↦', + RightTeeVector: '⥛', + RightTriangle: '⊳', + RightTriangleBar: '⧐', + RightTriangleEqual: '⊵', + RightUpDownVector: '⥏', + RightUpTeeVector: '⥜', + RightUpVector: '↾', + RightUpVectorBar: '⥔', + RightVector: '⇀', + RightVectorBar: '⥓', + Rightarrow: '⇒', + Ropf: 'ℝ', + RoundImplies: '⥰', + Rrightarrow: '⇛', + Rscr: 'ℛ', + Rsh: '↱', + RuleDelayed: '⧴', + SHCHcy: 'Щ', + SHcy: 'Ш', + SOFTcy: 'Ь', + Sacute: 'Ś', + Sc: '⪼', + Scaron: 'Š', + Scedil: 'Ş', + Scirc: 'Ŝ', + Scy: 'С', + Sfr: '𝔖', + ShortDownArrow: '↓', + ShortLeftArrow: '←', + ShortRightArrow: '→', + ShortUpArrow: '↑', + Sigma: 'Σ', + SmallCircle: '∘', + Sopf: '𝕊', + Sqrt: '√', + Square: '□', + SquareIntersection: '⊓', + SquareSubset: '⊏', + SquareSubsetEqual: '⊑', + SquareSuperset: '⊐', + SquareSupersetEqual: '⊒', + SquareUnion: '⊔', + Sscr: '𝒮', + Star: '⋆', + Sub: '⋐', + Subset: '⋐', + SubsetEqual: '⊆', + Succeeds: '≻', + SucceedsEqual: '⪰', + SucceedsSlantEqual: '≽', + SucceedsTilde: '≿', + SuchThat: '∋', + Sum: '∑', + Sup: '⋑', + Superset: '⊃', + SupersetEqual: '⊇', + Supset: '⋑', + THORN: 'Þ', + TRADE: '™', + TSHcy: 'Ћ', + TScy: 'Ц', + Tab: '\t', + Tau: 'Τ', + Tcaron: 'Ť', + Tcedil: 'Ţ', + Tcy: 'Т', + Tfr: '𝔗', + Therefore: '∴', + Theta: 'Θ', + ThickSpace: '  ', + ThinSpace: ' ', + Tilde: '∼', + TildeEqual: '≃', + TildeFullEqual: '≅', + TildeTilde: '≈', + Topf: '𝕋', + TripleDot: '⃛', + Tscr: '𝒯', + Tstrok: 'Ŧ', + Uacute: 'Ú', + Uarr: '↟', + Uarrocir: '⥉', + Ubrcy: 'Ў', + Ubreve: 'Ŭ', + Ucirc: 'Û', + Ucy: 'У', + Udblac: 'Ű', + Ufr: '𝔘', + Ugrave: 'Ù', + Umacr: 'Ū', + UnderBar: '_', + UnderBrace: '⏟', + UnderBracket: '⎵', + UnderParenthesis: '⏝', + Union: '⋃', + UnionPlus: '⊎', + Uogon: 'Ų', + Uopf: '𝕌', + UpArrow: '↑', + UpArrowBar: '⤒', + UpArrowDownArrow: '⇅', + UpDownArrow: '↕', + UpEquilibrium: '⥮', + UpTee: '⊥', + UpTeeArrow: '↥', + Uparrow: '⇑', + Updownarrow: '⇕', + UpperLeftArrow: '↖', + UpperRightArrow: '↗', + Upsi: 'ϒ', + Upsilon: 'Υ', + Uring: 'Ů', + Uscr: '𝒰', + Utilde: 'Ũ', + Uuml: 'Ü', + VDash: '⊫', + Vbar: '⫫', + Vcy: 'В', + Vdash: '⊩', + Vdashl: '⫦', + Vee: '⋁', + Verbar: '‖', + Vert: '‖', + VerticalBar: '∣', + VerticalLine: '|', + VerticalSeparator: '❘', + VerticalTilde: '≀', + VeryThinSpace: ' ', + Vfr: '𝔙', + Vopf: '𝕍', + Vscr: '𝒱', + Vvdash: '⊪', + Wcirc: 'Ŵ', + Wedge: '⋀', + Wfr: '𝔚', + Wopf: '𝕎', + Wscr: '𝒲', + Xfr: '𝔛', + Xi: 'Ξ', + Xopf: '𝕏', + Xscr: '𝒳', + YAcy: 'Я', + YIcy: 'Ї', + YUcy: 'Ю', + Yacute: 'Ý', + Ycirc: 'Ŷ', + Ycy: 'Ы', + Yfr: '𝔜', + Yopf: '𝕐', + Yscr: '𝒴', + Yuml: 'Ÿ', + ZHcy: 'Ж', + Zacute: 'Ź', + Zcaron: 'Ž', + Zcy: 'З', + Zdot: 'Ż', + ZeroWidthSpace: '​', + Zeta: 'Ζ', + Zfr: 'ℨ', + Zopf: 'ℤ', + Zscr: '𝒵', + aacute: 'á', + abreve: 'ă', + ac: '∾', + acE: '∾̳', + acd: '∿', + acirc: 'â', + acute: '´', + acy: 'а', + aelig: 'æ', + af: '⁡', + afr: '𝔞', + agrave: 'à', + alefsym: 'ℵ', + aleph: 'ℵ', + alpha: 'α', + amacr: 'ā', + amalg: '⨿', + amp: '&', + and: '∧', + andand: '⩕', + andd: '⩜', + andslope: '⩘', + andv: '⩚', + ang: '∠', + ange: '⦤', + angle: '∠', + angmsd: '∡', + angmsdaa: '⦨', + angmsdab: '⦩', + angmsdac: '⦪', + angmsdad: '⦫', + angmsdae: '⦬', + angmsdaf: '⦭', + angmsdag: '⦮', + angmsdah: '⦯', + angrt: '∟', + angrtvb: '⊾', + angrtvbd: '⦝', + angsph: '∢', + angst: 'Å', + angzarr: '⍼', + aogon: 'ą', + aopf: '𝕒', + ap: '≈', + apE: '⩰', + apacir: '⩯', + ape: '≊', + apid: '≋', + apos: "'", + approx: '≈', + approxeq: '≊', + aring: 'å', + ascr: '𝒶', + ast: '*', + asymp: '≈', + asympeq: '≍', + atilde: 'ã', + auml: 'ä', + awconint: '∳', + awint: '⨑', + bNot: '⫭', + backcong: '≌', + backepsilon: '϶', + backprime: '‵', + backsim: '∽', + backsimeq: '⋍', + barvee: '⊽', + barwed: '⌅', + barwedge: '⌅', + bbrk: '⎵', + bbrktbrk: '⎶', + bcong: '≌', + bcy: 'б', + bdquo: '„', + becaus: '∵', + because: '∵', + bemptyv: '⦰', + bepsi: '϶', + bernou: 'ℬ', + beta: 'β', + beth: 'ℶ', + between: '≬', + bfr: '𝔟', + bigcap: '⋂', + bigcirc: '◯', + bigcup: '⋃', + bigodot: '⨀', + bigoplus: '⨁', + bigotimes: '⨂', + bigsqcup: '⨆', + bigstar: '★', + bigtriangledown: '▽', + bigtriangleup: '△', + biguplus: '⨄', + bigvee: '⋁', + bigwedge: '⋀', + bkarow: '⤍', + blacklozenge: '⧫', + blacksquare: '▪', + blacktriangle: '▴', + blacktriangledown: '▾', + blacktriangleleft: '◂', + blacktriangleright: '▸', + blank: '␣', + blk12: '▒', + blk14: '░', + blk34: '▓', + block: '█', + bne: '=⃥', + bnequiv: '≡⃥', + bnot: '⌐', + bopf: '𝕓', + bot: '⊥', + bottom: '⊥', + bowtie: '⋈', + boxDL: '╗', + boxDR: '╔', + boxDl: '╖', + boxDr: '╓', + boxH: '═', + boxHD: '╦', + boxHU: '╩', + boxHd: '╤', + boxHu: '╧', + boxUL: '╝', + boxUR: '╚', + boxUl: '╜', + boxUr: '╙', + boxV: '║', + boxVH: '╬', + boxVL: '╣', + boxVR: '╠', + boxVh: '╫', + boxVl: '╢', + boxVr: '╟', + boxbox: '⧉', + boxdL: '╕', + boxdR: '╒', + boxdl: '┐', + boxdr: '┌', + boxh: '─', + boxhD: '╥', + boxhU: '╨', + boxhd: '┬', + boxhu: '┴', + boxminus: '⊟', + boxplus: '⊞', + boxtimes: '⊠', + boxuL: '╛', + boxuR: '╘', + boxul: '┘', + boxur: '└', + boxv: '│', + boxvH: '╪', + boxvL: '╡', + boxvR: '╞', + boxvh: '┼', + boxvl: '┤', + boxvr: '├', + bprime: '‵', + breve: '˘', + brvbar: '¦', + bscr: '𝒷', + bsemi: '⁏', + bsim: '∽', + bsime: '⋍', + bsol: '\\', + bsolb: '⧅', + bsolhsub: '⟈', + bull: '•', + bullet: '•', + bump: '≎', + bumpE: '⪮', + bumpe: '≏', + bumpeq: '≏', + cacute: 'ć', + cap: '∩', + capand: '⩄', + capbrcup: '⩉', + capcap: '⩋', + capcup: '⩇', + capdot: '⩀', + caps: '∩︀', + caret: '⁁', + caron: 'ˇ', + ccaps: '⩍', + ccaron: 'č', + ccedil: 'ç', + ccirc: 'ĉ', + ccups: '⩌', + ccupssm: '⩐', + cdot: 'ċ', + cedil: '¸', + cemptyv: '⦲', + cent: '¢', + centerdot: '·', + cfr: '𝔠', + chcy: 'ч', + check: '✓', + checkmark: '✓', + chi: 'χ', + cir: '○', + cirE: '⧃', + circ: 'ˆ', + circeq: '≗', + circlearrowleft: '↺', + circlearrowright: '↻', + circledR: '®', + circledS: 'Ⓢ', + circledast: '⊛', + circledcirc: '⊚', + circleddash: '⊝', + cire: '≗', + cirfnint: '⨐', + cirmid: '⫯', + cirscir: '⧂', + clubs: '♣', + clubsuit: '♣', + colon: ':', + colone: '≔', + coloneq: '≔', + comma: ',', + commat: '@', + comp: '∁', + compfn: '∘', + complement: '∁', + complexes: 'ℂ', + cong: '≅', + congdot: '⩭', + conint: '∮', + copf: '𝕔', + coprod: '∐', + copy: '©', + copysr: '℗', + crarr: '↵', + cross: '✗', + cscr: '𝒸', + csub: '⫏', + csube: '⫑', + csup: '⫐', + csupe: '⫒', + ctdot: '⋯', + cudarrl: '⤸', + cudarrr: '⤵', + cuepr: '⋞', + cuesc: '⋟', + cularr: '↶', + cularrp: '⤽', + cup: '∪', + cupbrcap: '⩈', + cupcap: '⩆', + cupcup: '⩊', + cupdot: '⊍', + cupor: '⩅', + cups: '∪︀', + curarr: '↷', + curarrm: '⤼', + curlyeqprec: '⋞', + curlyeqsucc: '⋟', + curlyvee: '⋎', + curlywedge: '⋏', + curren: '¤', + curvearrowleft: '↶', + curvearrowright: '↷', + cuvee: '⋎', + cuwed: '⋏', + cwconint: '∲', + cwint: '∱', + cylcty: '⌭', + dArr: '⇓', + dHar: '⥥', + dagger: '†', + daleth: 'ℸ', + darr: '↓', + dash: '‐', + dashv: '⊣', + dbkarow: '⤏', + dblac: '˝', + dcaron: 'ď', + dcy: 'д', + dd: 'ⅆ', + ddagger: '‡', + ddarr: '⇊', + ddotseq: '⩷', + deg: '°', + delta: 'δ', + demptyv: '⦱', + dfisht: '⥿', + dfr: '𝔡', + dharl: '⇃', + dharr: '⇂', + diam: '⋄', + diamond: '⋄', + diamondsuit: '♦', + diams: '♦', + die: '¨', + digamma: 'ϝ', + disin: '⋲', + div: '÷', + divide: '÷', + divideontimes: '⋇', + divonx: '⋇', + djcy: 'ђ', + dlcorn: '⌞', + dlcrop: '⌍', + dollar: '$', + dopf: '𝕕', + dot: '˙', + doteq: '≐', + doteqdot: '≑', + dotminus: '∸', + dotplus: '∔', + dotsquare: '⊡', + doublebarwedge: '⌆', + downarrow: '↓', + downdownarrows: '⇊', + downharpoonleft: '⇃', + downharpoonright: '⇂', + drbkarow: '⤐', + drcorn: '⌟', + drcrop: '⌌', + dscr: '𝒹', + dscy: 'ѕ', + dsol: '⧶', + dstrok: 'đ', + dtdot: '⋱', + dtri: '▿', + dtrif: '▾', + duarr: '⇵', + duhar: '⥯', + dwangle: '⦦', + dzcy: 'џ', + dzigrarr: '⟿', + eDDot: '⩷', + eDot: '≑', + eacute: 'é', + easter: '⩮', + ecaron: 'ě', + ecir: '≖', + ecirc: 'ê', + ecolon: '≕', + ecy: 'э', + edot: 'ė', + ee: 'ⅇ', + efDot: '≒', + efr: '𝔢', + eg: '⪚', + egrave: 'è', + egs: '⪖', + egsdot: '⪘', + el: '⪙', + elinters: '⏧', + ell: 'ℓ', + els: '⪕', + elsdot: '⪗', + emacr: 'ē', + empty: '∅', + emptyset: '∅', + emptyv: '∅', + emsp13: ' ', + emsp14: ' ', + emsp: ' ', + eng: 'ŋ', + ensp: ' ', + eogon: 'ę', + eopf: '𝕖', + epar: '⋕', + eparsl: '⧣', + eplus: '⩱', + epsi: 'ε', + epsilon: 'ε', + epsiv: 'ϵ', + eqcirc: '≖', + eqcolon: '≕', + eqsim: '≂', + eqslantgtr: '⪖', + eqslantless: '⪕', + equals: '=', + equest: '≟', + equiv: '≡', + equivDD: '⩸', + eqvparsl: '⧥', + erDot: '≓', + erarr: '⥱', + escr: 'ℯ', + esdot: '≐', + esim: '≂', + eta: 'η', + eth: 'ð', + euml: 'ë', + euro: '€', + excl: '!', + exist: '∃', + expectation: 'ℰ', + exponentiale: 'ⅇ', + fallingdotseq: '≒', + fcy: 'ф', + female: '♀', + ffilig: 'ffi', + fflig: 'ff', + ffllig: 'ffl', + ffr: '𝔣', + filig: 'fi', + fjlig: 'fj', + flat: '♭', + fllig: 'fl', + fltns: '▱', + fnof: 'ƒ', + fopf: '𝕗', + forall: '∀', + fork: '⋔', + forkv: '⫙', + fpartint: '⨍', + frac12: '½', + frac13: '⅓', + frac14: '¼', + frac15: '⅕', + frac16: '⅙', + frac18: '⅛', + frac23: '⅔', + frac25: '⅖', + frac34: '¾', + frac35: '⅗', + frac38: '⅜', + frac45: '⅘', + frac56: '⅚', + frac58: '⅝', + frac78: '⅞', + frasl: '⁄', + frown: '⌢', + fscr: '𝒻', + gE: '≧', + gEl: '⪌', + gacute: 'ǵ', + gamma: 'γ', + gammad: 'ϝ', + gap: '⪆', + gbreve: 'ğ', + gcirc: 'ĝ', + gcy: 'г', + gdot: 'ġ', + ge: '≥', + gel: '⋛', + geq: '≥', + geqq: '≧', + geqslant: '⩾', + ges: '⩾', + gescc: '⪩', + gesdot: '⪀', + gesdoto: '⪂', + gesdotol: '⪄', + gesl: '⋛︀', + gesles: '⪔', + gfr: '𝔤', + gg: '≫', + ggg: '⋙', + gimel: 'ℷ', + gjcy: 'ѓ', + gl: '≷', + glE: '⪒', + gla: '⪥', + glj: '⪤', + gnE: '≩', + gnap: '⪊', + gnapprox: '⪊', + gne: '⪈', + gneq: '⪈', + gneqq: '≩', + gnsim: '⋧', + gopf: '𝕘', + grave: '`', + gscr: 'ℊ', + gsim: '≳', + gsime: '⪎', + gsiml: '⪐', + gt: '>', + gtcc: '⪧', + gtcir: '⩺', + gtdot: '⋗', + gtlPar: '⦕', + gtquest: '⩼', + gtrapprox: '⪆', + gtrarr: '⥸', + gtrdot: '⋗', + gtreqless: '⋛', + gtreqqless: '⪌', + gtrless: '≷', + gtrsim: '≳', + gvertneqq: '≩︀', + gvnE: '≩︀', + hArr: '⇔', + hairsp: ' ', + half: '½', + hamilt: 'ℋ', + hardcy: 'ъ', + harr: '↔', + harrcir: '⥈', + harrw: '↭', + hbar: 'ℏ', + hcirc: 'ĥ', + hearts: '♥', + heartsuit: '♥', + hellip: '…', + hercon: '⊹', + hfr: '𝔥', + hksearow: '⤥', + hkswarow: '⤦', + hoarr: '⇿', + homtht: '∻', + hookleftarrow: '↩', + hookrightarrow: '↪', + hopf: '𝕙', + horbar: '―', + hscr: '𝒽', + hslash: 'ℏ', + hstrok: 'ħ', + hybull: '⁃', + hyphen: '‐', + iacute: 'í', + ic: '⁣', + icirc: 'î', + icy: 'и', + iecy: 'е', + iexcl: '¡', + iff: '⇔', + ifr: '𝔦', + igrave: 'ì', + ii: 'ⅈ', + iiiint: '⨌', + iiint: '∭', + iinfin: '⧜', + iiota: '℩', + ijlig: 'ij', + imacr: 'ī', + image: 'ℑ', + imagline: 'ℐ', + imagpart: 'ℑ', + imath: 'ı', + imof: '⊷', + imped: 'Ƶ', + in: '∈', + incare: '℅', + infin: '∞', + infintie: '⧝', + inodot: 'ı', + int: '∫', + intcal: '⊺', + integers: 'ℤ', + intercal: '⊺', + intlarhk: '⨗', + intprod: '⨼', + iocy: 'ё', + iogon: 'į', + iopf: '𝕚', + iota: 'ι', + iprod: '⨼', + iquest: '¿', + iscr: '𝒾', + isin: '∈', + isinE: '⋹', + isindot: '⋵', + isins: '⋴', + isinsv: '⋳', + isinv: '∈', + it: '⁢', + itilde: 'ĩ', + iukcy: 'і', + iuml: 'ï', + jcirc: 'ĵ', + jcy: 'й', + jfr: '𝔧', + jmath: 'ȷ', + jopf: '𝕛', + jscr: '𝒿', + jsercy: 'ј', + jukcy: 'є', + kappa: 'κ', + kappav: 'ϰ', + kcedil: 'ķ', + kcy: 'к', + kfr: '𝔨', + kgreen: 'ĸ', + khcy: 'х', + kjcy: 'ќ', + kopf: '𝕜', + kscr: '𝓀', + lAarr: '⇚', + lArr: '⇐', + lAtail: '⤛', + lBarr: '⤎', + lE: '≦', + lEg: '⪋', + lHar: '⥢', + lacute: 'ĺ', + laemptyv: '⦴', + lagran: 'ℒ', + lambda: 'λ', + lang: '⟨', + langd: '⦑', + langle: '⟨', + lap: '⪅', + laquo: '«', + larr: '←', + larrb: '⇤', + larrbfs: '⤟', + larrfs: '⤝', + larrhk: '↩', + larrlp: '↫', + larrpl: '⤹', + larrsim: '⥳', + larrtl: '↢', + lat: '⪫', + latail: '⤙', + late: '⪭', + lates: '⪭︀', + lbarr: '⤌', + lbbrk: '❲', + lbrace: '{', + lbrack: '[', + lbrke: '⦋', + lbrksld: '⦏', + lbrkslu: '⦍', + lcaron: 'ľ', + lcedil: 'ļ', + lceil: '⌈', + lcub: '{', + lcy: 'л', + ldca: '⤶', + ldquo: '“', + ldquor: '„', + ldrdhar: '⥧', + ldrushar: '⥋', + ldsh: '↲', + le: '≤', + leftarrow: '←', + leftarrowtail: '↢', + leftharpoondown: '↽', + leftharpoonup: '↼', + leftleftarrows: '⇇', + leftrightarrow: '↔', + leftrightarrows: '⇆', + leftrightharpoons: '⇋', + leftrightsquigarrow: '↭', + leftthreetimes: '⋋', + leg: '⋚', + leq: '≤', + leqq: '≦', + leqslant: '⩽', + les: '⩽', + lescc: '⪨', + lesdot: '⩿', + lesdoto: '⪁', + lesdotor: '⪃', + lesg: '⋚︀', + lesges: '⪓', + lessapprox: '⪅', + lessdot: '⋖', + lesseqgtr: '⋚', + lesseqqgtr: '⪋', + lessgtr: '≶', + lesssim: '≲', + lfisht: '⥼', + lfloor: '⌊', + lfr: '𝔩', + lg: '≶', + lgE: '⪑', + lhard: '↽', + lharu: '↼', + lharul: '⥪', + lhblk: '▄', + ljcy: 'љ', + ll: '≪', + llarr: '⇇', + llcorner: '⌞', + llhard: '⥫', + lltri: '◺', + lmidot: 'ŀ', + lmoust: '⎰', + lmoustache: '⎰', + lnE: '≨', + lnap: '⪉', + lnapprox: '⪉', + lne: '⪇', + lneq: '⪇', + lneqq: '≨', + lnsim: '⋦', + loang: '⟬', + loarr: '⇽', + lobrk: '⟦', + longleftarrow: '⟵', + longleftrightarrow: '⟷', + longmapsto: '⟼', + longrightarrow: '⟶', + looparrowleft: '↫', + looparrowright: '↬', + lopar: '⦅', + lopf: '𝕝', + loplus: '⨭', + lotimes: '⨴', + lowast: '∗', + lowbar: '_', + loz: '◊', + lozenge: '◊', + lozf: '⧫', + lpar: '(', + lparlt: '⦓', + lrarr: '⇆', + lrcorner: '⌟', + lrhar: '⇋', + lrhard: '⥭', + lrm: '‎', + lrtri: '⊿', + lsaquo: '‹', + lscr: '𝓁', + lsh: '↰', + lsim: '≲', + lsime: '⪍', + lsimg: '⪏', + lsqb: '[', + lsquo: '‘', + lsquor: '‚', + lstrok: 'ł', + lt: '<', + ltcc: '⪦', + ltcir: '⩹', + ltdot: '⋖', + lthree: '⋋', + ltimes: '⋉', + ltlarr: '⥶', + ltquest: '⩻', + ltrPar: '⦖', + ltri: '◃', + ltrie: '⊴', + ltrif: '◂', + lurdshar: '⥊', + luruhar: '⥦', + lvertneqq: '≨︀', + lvnE: '≨︀', + mDDot: '∺', + macr: '¯', + male: '♂', + malt: '✠', + maltese: '✠', + map: '↦', + mapsto: '↦', + mapstodown: '↧', + mapstoleft: '↤', + mapstoup: '↥', + marker: '▮', + mcomma: '⨩', + mcy: 'м', + mdash: '—', + measuredangle: '∡', + mfr: '𝔪', + mho: '℧', + micro: 'µ', + mid: '∣', + midast: '*', + midcir: '⫰', + middot: '·', + minus: '−', + minusb: '⊟', + minusd: '∸', + minusdu: '⨪', + mlcp: '⫛', + mldr: '…', + mnplus: '∓', + models: '⊧', + mopf: '𝕞', + mp: '∓', + mscr: '𝓂', + mstpos: '∾', + mu: 'μ', + multimap: '⊸', + mumap: '⊸', + nGg: '⋙̸', + nGt: '≫⃒', + nGtv: '≫̸', + nLeftarrow: '⇍', + nLeftrightarrow: '⇎', + nLl: '⋘̸', + nLt: '≪⃒', + nLtv: '≪̸', + nRightarrow: '⇏', + nVDash: '⊯', + nVdash: '⊮', + nabla: '∇', + nacute: 'ń', + nang: '∠⃒', + nap: '≉', + napE: '⩰̸', + napid: '≋̸', + napos: 'ʼn', + napprox: '≉', + natur: '♮', + natural: '♮', + naturals: 'ℕ', + nbsp: ' ', + nbump: '≎̸', + nbumpe: '≏̸', + ncap: '⩃', + ncaron: 'ň', + ncedil: 'ņ', + ncong: '≇', + ncongdot: '⩭̸', + ncup: '⩂', + ncy: 'н', + ndash: '–', + ne: '≠', + neArr: '⇗', + nearhk: '⤤', + nearr: '↗', + nearrow: '↗', + nedot: '≐̸', + nequiv: '≢', + nesear: '⤨', + nesim: '≂̸', + nexist: '∄', + nexists: '∄', + nfr: '𝔫', + ngE: '≧̸', + nge: '≱', + ngeq: '≱', + ngeqq: '≧̸', + ngeqslant: '⩾̸', + nges: '⩾̸', + ngsim: '≵', + ngt: '≯', + ngtr: '≯', + nhArr: '⇎', + nharr: '↮', + nhpar: '⫲', + ni: '∋', + nis: '⋼', + nisd: '⋺', + niv: '∋', + njcy: 'њ', + nlArr: '⇍', + nlE: '≦̸', + nlarr: '↚', + nldr: '‥', + nle: '≰', + nleftarrow: '↚', + nleftrightarrow: '↮', + nleq: '≰', + nleqq: '≦̸', + nleqslant: '⩽̸', + nles: '⩽̸', + nless: '≮', + nlsim: '≴', + nlt: '≮', + nltri: '⋪', + nltrie: '⋬', + nmid: '∤', + nopf: '𝕟', + not: '¬', + notin: '∉', + notinE: '⋹̸', + notindot: '⋵̸', + notinva: '∉', + notinvb: '⋷', + notinvc: '⋶', + notni: '∌', + notniva: '∌', + notnivb: '⋾', + notnivc: '⋽', + npar: '∦', + nparallel: '∦', + nparsl: '⫽⃥', + npart: '∂̸', + npolint: '⨔', + npr: '⊀', + nprcue: '⋠', + npre: '⪯̸', + nprec: '⊀', + npreceq: '⪯̸', + nrArr: '⇏', + nrarr: '↛', + nrarrc: '⤳̸', + nrarrw: '↝̸', + nrightarrow: '↛', + nrtri: '⋫', + nrtrie: '⋭', + nsc: '⊁', + nsccue: '⋡', + nsce: '⪰̸', + nscr: '𝓃', + nshortmid: '∤', + nshortparallel: '∦', + nsim: '≁', + nsime: '≄', + nsimeq: '≄', + nsmid: '∤', + nspar: '∦', + nsqsube: '⋢', + nsqsupe: '⋣', + nsub: '⊄', + nsubE: '⫅̸', + nsube: '⊈', + nsubset: '⊂⃒', + nsubseteq: '⊈', + nsubseteqq: '⫅̸', + nsucc: '⊁', + nsucceq: '⪰̸', + nsup: '⊅', + nsupE: '⫆̸', + nsupe: '⊉', + nsupset: '⊃⃒', + nsupseteq: '⊉', + nsupseteqq: '⫆̸', + ntgl: '≹', + ntilde: 'ñ', + ntlg: '≸', + ntriangleleft: '⋪', + ntrianglelefteq: '⋬', + ntriangleright: '⋫', + ntrianglerighteq: '⋭', + nu: 'ν', + num: '#', + numero: '№', + numsp: ' ', + nvDash: '⊭', + nvHarr: '⤄', + nvap: '≍⃒', + nvdash: '⊬', + nvge: '≥⃒', + nvgt: '>⃒', + nvinfin: '⧞', + nvlArr: '⤂', + nvle: '≤⃒', + nvlt: '<⃒', + nvltrie: '⊴⃒', + nvrArr: '⤃', + nvrtrie: '⊵⃒', + nvsim: '∼⃒', + nwArr: '⇖', + nwarhk: '⤣', + nwarr: '↖', + nwarrow: '↖', + nwnear: '⤧', + oS: 'Ⓢ', + oacute: 'ó', + oast: '⊛', + ocir: '⊚', + ocirc: 'ô', + ocy: 'о', + odash: '⊝', + odblac: 'ő', + odiv: '⨸', + odot: '⊙', + odsold: '⦼', + oelig: 'œ', + ofcir: '⦿', + ofr: '𝔬', + ogon: '˛', + ograve: 'ò', + ogt: '⧁', + ohbar: '⦵', + ohm: 'Ω', + oint: '∮', + olarr: '↺', + olcir: '⦾', + olcross: '⦻', + oline: '‾', + olt: '⧀', + omacr: 'ō', + omega: 'ω', + omicron: 'ο', + omid: '⦶', + ominus: '⊖', + oopf: '𝕠', + opar: '⦷', + operp: '⦹', + oplus: '⊕', + or: '∨', + orarr: '↻', + ord: '⩝', + order: 'ℴ', + orderof: 'ℴ', + ordf: 'ª', + ordm: 'º', + origof: '⊶', + oror: '⩖', + orslope: '⩗', + orv: '⩛', + oscr: 'ℴ', + oslash: 'ø', + osol: '⊘', + otilde: 'õ', + otimes: '⊗', + otimesas: '⨶', + ouml: 'ö', + ovbar: '⌽', + par: '∥', + para: '¶', + parallel: '∥', + parsim: '⫳', + parsl: '⫽', + part: '∂', + pcy: 'п', + percnt: '%', + period: '.', + permil: '‰', + perp: '⊥', + pertenk: '‱', + pfr: '𝔭', + phi: 'φ', + phiv: 'ϕ', + phmmat: 'ℳ', + phone: '☎', + pi: 'π', + pitchfork: '⋔', + piv: 'ϖ', + planck: 'ℏ', + planckh: 'ℎ', + plankv: 'ℏ', + plus: '+', + plusacir: '⨣', + plusb: '⊞', + pluscir: '⨢', + plusdo: '∔', + plusdu: '⨥', + pluse: '⩲', + plusmn: '±', + plussim: '⨦', + plustwo: '⨧', + pm: '±', + pointint: '⨕', + popf: '𝕡', + pound: '£', + pr: '≺', + prE: '⪳', + prap: '⪷', + prcue: '≼', + pre: '⪯', + prec: '≺', + precapprox: '⪷', + preccurlyeq: '≼', + preceq: '⪯', + precnapprox: '⪹', + precneqq: '⪵', + precnsim: '⋨', + precsim: '≾', + prime: '′', + primes: 'ℙ', + prnE: '⪵', + prnap: '⪹', + prnsim: '⋨', + prod: '∏', + profalar: '⌮', + profline: '⌒', + profsurf: '⌓', + prop: '∝', + propto: '∝', + prsim: '≾', + prurel: '⊰', + pscr: '𝓅', + psi: 'ψ', + puncsp: ' ', + qfr: '𝔮', + qint: '⨌', + qopf: '𝕢', + qprime: '⁗', + qscr: '𝓆', + quaternions: 'ℍ', + quatint: '⨖', + quest: '?', + questeq: '≟', + quot: '"', + rAarr: '⇛', + rArr: '⇒', + rAtail: '⤜', + rBarr: '⤏', + rHar: '⥤', + race: '∽̱', + racute: 'ŕ', + radic: '√', + raemptyv: '⦳', + rang: '⟩', + rangd: '⦒', + range: '⦥', + rangle: '⟩', + raquo: '»', + rarr: '→', + rarrap: '⥵', + rarrb: '⇥', + rarrbfs: '⤠', + rarrc: '⤳', + rarrfs: '⤞', + rarrhk: '↪', + rarrlp: '↬', + rarrpl: '⥅', + rarrsim: '⥴', + rarrtl: '↣', + rarrw: '↝', + ratail: '⤚', + ratio: '∶', + rationals: 'ℚ', + rbarr: '⤍', + rbbrk: '❳', + rbrace: '}', + rbrack: ']', + rbrke: '⦌', + rbrksld: '⦎', + rbrkslu: '⦐', + rcaron: 'ř', + rcedil: 'ŗ', + rceil: '⌉', + rcub: '}', + rcy: 'р', + rdca: '⤷', + rdldhar: '⥩', + rdquo: '”', + rdquor: '”', + rdsh: '↳', + real: 'ℜ', + realine: 'ℛ', + realpart: 'ℜ', + reals: 'ℝ', + rect: '▭', + reg: '®', + rfisht: '⥽', + rfloor: '⌋', + rfr: '𝔯', + rhard: '⇁', + rharu: '⇀', + rharul: '⥬', + rho: 'ρ', + rhov: 'ϱ', + rightarrow: '→', + rightarrowtail: '↣', + rightharpoondown: '⇁', + rightharpoonup: '⇀', + rightleftarrows: '⇄', + rightleftharpoons: '⇌', + rightrightarrows: '⇉', + rightsquigarrow: '↝', + rightthreetimes: '⋌', + ring: '˚', + risingdotseq: '≓', + rlarr: '⇄', + rlhar: '⇌', + rlm: '‏', + rmoust: '⎱', + rmoustache: '⎱', + rnmid: '⫮', + roang: '⟭', + roarr: '⇾', + robrk: '⟧', + ropar: '⦆', + ropf: '𝕣', + roplus: '⨮', + rotimes: '⨵', + rpar: ')', + rpargt: '⦔', + rppolint: '⨒', + rrarr: '⇉', + rsaquo: '›', + rscr: '𝓇', + rsh: '↱', + rsqb: ']', + rsquo: '’', + rsquor: '’', + rthree: '⋌', + rtimes: '⋊', + rtri: '▹', + rtrie: '⊵', + rtrif: '▸', + rtriltri: '⧎', + ruluhar: '⥨', + rx: '℞', + sacute: 'ś', + sbquo: '‚', + sc: '≻', + scE: '⪴', + scap: '⪸', + scaron: 'š', + sccue: '≽', + sce: '⪰', + scedil: 'ş', + scirc: 'ŝ', + scnE: '⪶', + scnap: '⪺', + scnsim: '⋩', + scpolint: '⨓', + scsim: '≿', + scy: 'с', + sdot: '⋅', + sdotb: '⊡', + sdote: '⩦', + seArr: '⇘', + searhk: '⤥', + searr: '↘', + searrow: '↘', + sect: '§', + semi: ';', + seswar: '⤩', + setminus: '∖', + setmn: '∖', + sext: '✶', + sfr: '𝔰', + sfrown: '⌢', + sharp: '♯', + shchcy: 'щ', + shcy: 'ш', + shortmid: '∣', + shortparallel: '∥', + shy: '­', + sigma: 'σ', + sigmaf: 'ς', + sigmav: 'ς', + sim: '∼', + simdot: '⩪', + sime: '≃', + simeq: '≃', + simg: '⪞', + simgE: '⪠', + siml: '⪝', + simlE: '⪟', + simne: '≆', + simplus: '⨤', + simrarr: '⥲', + slarr: '←', + smallsetminus: '∖', + smashp: '⨳', + smeparsl: '⧤', + smid: '∣', + smile: '⌣', + smt: '⪪', + smte: '⪬', + smtes: '⪬︀', + softcy: 'ь', + sol: '/', + solb: '⧄', + solbar: '⌿', + sopf: '𝕤', + spades: '♠', + spadesuit: '♠', + spar: '∥', + sqcap: '⊓', + sqcaps: '⊓︀', + sqcup: '⊔', + sqcups: '⊔︀', + sqsub: '⊏', + sqsube: '⊑', + sqsubset: '⊏', + sqsubseteq: '⊑', + sqsup: '⊐', + sqsupe: '⊒', + sqsupset: '⊐', + sqsupseteq: '⊒', + squ: '□', + square: '□', + squarf: '▪', + squf: '▪', + srarr: '→', + sscr: '𝓈', + ssetmn: '∖', + ssmile: '⌣', + sstarf: '⋆', + star: '☆', + starf: '★', + straightepsilon: 'ϵ', + straightphi: 'ϕ', + strns: '¯', + sub: '⊂', + subE: '⫅', + subdot: '⪽', + sube: '⊆', + subedot: '⫃', + submult: '⫁', + subnE: '⫋', + subne: '⊊', + subplus: '⪿', + subrarr: '⥹', + subset: '⊂', + subseteq: '⊆', + subseteqq: '⫅', + subsetneq: '⊊', + subsetneqq: '⫋', + subsim: '⫇', + subsub: '⫕', + subsup: '⫓', + succ: '≻', + succapprox: '⪸', + succcurlyeq: '≽', + succeq: '⪰', + succnapprox: '⪺', + succneqq: '⪶', + succnsim: '⋩', + succsim: '≿', + sum: '∑', + sung: '♪', + sup1: '¹', + sup2: '²', + sup3: '³', + sup: '⊃', + supE: '⫆', + supdot: '⪾', + supdsub: '⫘', + supe: '⊇', + supedot: '⫄', + suphsol: '⟉', + suphsub: '⫗', + suplarr: '⥻', + supmult: '⫂', + supnE: '⫌', + supne: '⊋', + supplus: '⫀', + supset: '⊃', + supseteq: '⊇', + supseteqq: '⫆', + supsetneq: '⊋', + supsetneqq: '⫌', + supsim: '⫈', + supsub: '⫔', + supsup: '⫖', + swArr: '⇙', + swarhk: '⤦', + swarr: '↙', + swarrow: '↙', + swnwar: '⤪', + szlig: 'ß', + target: '⌖', + tau: 'τ', + tbrk: '⎴', + tcaron: 'ť', + tcedil: 'ţ', + tcy: 'т', + tdot: '⃛', + telrec: '⌕', + tfr: '𝔱', + there4: '∴', + therefore: '∴', + theta: 'θ', + thetasym: 'ϑ', + thetav: 'ϑ', + thickapprox: '≈', + thicksim: '∼', + thinsp: ' ', + thkap: '≈', + thksim: '∼', + thorn: 'þ', + tilde: '˜', + times: '×', + timesb: '⊠', + timesbar: '⨱', + timesd: '⨰', + tint: '∭', + toea: '⤨', + top: '⊤', + topbot: '⌶', + topcir: '⫱', + topf: '𝕥', + topfork: '⫚', + tosa: '⤩', + tprime: '‴', + trade: '™', + triangle: '▵', + triangledown: '▿', + triangleleft: '◃', + trianglelefteq: '⊴', + triangleq: '≜', + triangleright: '▹', + trianglerighteq: '⊵', + tridot: '◬', + trie: '≜', + triminus: '⨺', + triplus: '⨹', + trisb: '⧍', + tritime: '⨻', + trpezium: '⏢', + tscr: '𝓉', + tscy: 'ц', + tshcy: 'ћ', + tstrok: 'ŧ', + twixt: '≬', + twoheadleftarrow: '↞', + twoheadrightarrow: '↠', + uArr: '⇑', + uHar: '⥣', + uacute: 'ú', + uarr: '↑', + ubrcy: 'ў', + ubreve: 'ŭ', + ucirc: 'û', + ucy: 'у', + udarr: '⇅', + udblac: 'ű', + udhar: '⥮', + ufisht: '⥾', + ufr: '𝔲', + ugrave: 'ù', + uharl: '↿', + uharr: '↾', + uhblk: '▀', + ulcorn: '⌜', + ulcorner: '⌜', + ulcrop: '⌏', + ultri: '◸', + umacr: 'ū', + uml: '¨', + uogon: 'ų', + uopf: '𝕦', + uparrow: '↑', + updownarrow: '↕', + upharpoonleft: '↿', + upharpoonright: '↾', + uplus: '⊎', + upsi: 'υ', + upsih: 'ϒ', + upsilon: 'υ', + upuparrows: '⇈', + urcorn: '⌝', + urcorner: '⌝', + urcrop: '⌎', + uring: 'ů', + urtri: '◹', + uscr: '𝓊', + utdot: '⋰', + utilde: 'ũ', + utri: '▵', + utrif: '▴', + uuarr: '⇈', + uuml: 'ü', + uwangle: '⦧', + vArr: '⇕', + vBar: '⫨', + vBarv: '⫩', + vDash: '⊨', + vangrt: '⦜', + varepsilon: 'ϵ', + varkappa: 'ϰ', + varnothing: '∅', + varphi: 'ϕ', + varpi: 'ϖ', + varpropto: '∝', + varr: '↕', + varrho: 'ϱ', + varsigma: 'ς', + varsubsetneq: '⊊︀', + varsubsetneqq: '⫋︀', + varsupsetneq: '⊋︀', + varsupsetneqq: '⫌︀', + vartheta: 'ϑ', + vartriangleleft: '⊲', + vartriangleright: '⊳', + vcy: 'в', + vdash: '⊢', + vee: '∨', + veebar: '⊻', + veeeq: '≚', + vellip: '⋮', + verbar: '|', + vert: '|', + vfr: '𝔳', + vltri: '⊲', + vnsub: '⊂⃒', + vnsup: '⊃⃒', + vopf: '𝕧', + vprop: '∝', + vrtri: '⊳', + vscr: '𝓋', + vsubnE: '⫋︀', + vsubne: '⊊︀', + vsupnE: '⫌︀', + vsupne: '⊋︀', + vzigzag: '⦚', + wcirc: 'ŵ', + wedbar: '⩟', + wedge: '∧', + wedgeq: '≙', + weierp: '℘', + wfr: '𝔴', + wopf: '𝕨', + wp: '℘', + wr: '≀', + wreath: '≀', + wscr: '𝓌', + xcap: '⋂', + xcirc: '◯', + xcup: '⋃', + xdtri: '▽', + xfr: '𝔵', + xhArr: '⟺', + xharr: '⟷', + xi: 'ξ', + xlArr: '⟸', + xlarr: '⟵', + xmap: '⟼', + xnis: '⋻', + xodot: '⨀', + xopf: '𝕩', + xoplus: '⨁', + xotime: '⨂', + xrArr: '⟹', + xrarr: '⟶', + xscr: '𝓍', + xsqcup: '⨆', + xuplus: '⨄', + xutri: '△', + xvee: '⋁', + xwedge: '⋀', + yacute: 'ý', + yacy: 'я', + ycirc: 'ŷ', + ycy: 'ы', + yen: '¥', + yfr: '𝔶', + yicy: 'ї', + yopf: '𝕪', + yscr: '𝓎', + yucy: 'ю', + yuml: 'ÿ', + zacute: 'ź', + zcaron: 'ž', + zcy: 'з', + zdot: 'ż', + zeetrf: 'ℨ', + zeta: 'ζ', + zfr: '𝔷', + zhcy: 'ж', + zigrarr: '⇝', + zopf: '𝕫', + zscr: '𝓏', + zwj: '‍', + zwnj: '‌' +} diff --git a/node_modules/character-entities/license b/node_modules/character-entities/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/character-entities/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/character-entities/package.json b/node_modules/character-entities/package.json new file mode 100644 index 00000000..30f6a539 --- /dev/null +++ b/node_modules/character-entities/package.json @@ -0,0 +1,78 @@ +{ + "name": "character-entities", + "version": "2.0.2", + "description": "Map of named character references", + "license": "MIT", + "keywords": [ + "html", + "entity", + "entities", + "character", + "reference", + "name", + "replacement" + ], + "repository": "wooorm/character-entities", + "bugs": "https://github.com/wooorm/character-entities/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "bail": "^2.0.0", + "c8": "^7.0.0", + "concat-stream": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.50.0" + }, + "scripts": { + "generate": "node build", + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/character-entities/readme.md b/node_modules/character-entities/readme.md new file mode 100644 index 00000000..16889ca1 --- /dev/null +++ b/node_modules/character-entities/readme.md @@ -0,0 +1,152 @@ +# character-entities + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Map of named character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [characterEntities](#characterentities) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a map of named character references in HTML (latest) to the characters +they represent. + +## When should I use this? + +Maybe when you’re writing an HTML parser or minifier, but otherwise probably +never! +Even then, it might be better to use [`parse-entities`][parse-entities] or +[`stringify-entities`][stringify-entities]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]: + +```sh +npm install character-entities +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {characterEntities} from 'https://esm.sh/character-entities@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {characterEntities} from 'character-entities' + +console.log(characterEntities.AElig) // => 'Æ' +console.log(characterEntities.aelig) // => 'æ' +console.log(characterEntities.amp) // => '&' +``` + +## API + +This package exports the identifier `characterEntities`. +There is no default export. + +### characterEntities + +Mapping between (case-sensitive) character entity names to replacements. +See [`html.spec.whatwg.org`][html] for more info. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/parse-entities`](https://github.com/wooorm/parse-entities) + — parse (decode) character references +* [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities) + — serialize (encode) character references +* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — info on named character references in HTML 4 +* [`character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — info on invalid numeric character references +* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — info on legacy named character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/character-entities/workflows/main/badge.svg + +[build]: https://github.com/wooorm/character-entities/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities.svg + +[coverage]: https://codecov.io/github/wooorm/character-entities + +[downloads-badge]: https://img.shields.io/npm/dm/character-entities.svg + +[downloads]: https://www.npmjs.com/package/character-entities + +[size-badge]: https://img.shields.io/bundlephobia/minzip/character-entities.svg + +[size]: https://bundlephobia.com/result?p=character-entities + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[parse-entities]: https://github.com/wooorm/parse-entities + +[stringify-entities]: https://github.com/wooorm/stringify-entities + +[html]: https://html.spec.whatwg.org/multipage/syntax.html#named-character-references diff --git a/node_modules/character-reference-invalid/index.d.ts b/node_modules/character-reference-invalid/index.d.ts new file mode 100644 index 00000000..800115ad --- /dev/null +++ b/node_modules/character-reference-invalid/index.d.ts @@ -0,0 +1,6 @@ +/** + * Map of invalid numeric character references to their replacements, according to HTML. + * + * @type {Record} + */ +export const characterReferenceInvalid: Record diff --git a/node_modules/character-reference-invalid/index.js b/node_modules/character-reference-invalid/index.js new file mode 100644 index 00000000..3fd48c5d --- /dev/null +++ b/node_modules/character-reference-invalid/index.js @@ -0,0 +1,35 @@ +/** + * Map of invalid numeric character references to their replacements, according to HTML. + * + * @type {Record} + */ +export const characterReferenceInvalid = { + 0: '�', + 128: '€', + 130: '‚', + 131: 'ƒ', + 132: '„', + 133: '…', + 134: '†', + 135: '‡', + 136: 'ˆ', + 137: '‰', + 138: 'Š', + 139: '‹', + 140: 'Œ', + 142: 'Ž', + 145: '‘', + 146: '’', + 147: '“', + 148: '”', + 149: '•', + 150: '–', + 151: '—', + 152: '˜', + 153: '™', + 154: 'š', + 155: '›', + 156: 'œ', + 158: 'ž', + 159: 'Ÿ' +} diff --git a/node_modules/character-reference-invalid/license b/node_modules/character-reference-invalid/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/character-reference-invalid/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/character-reference-invalid/package.json b/node_modules/character-reference-invalid/package.json new file mode 100644 index 00000000..b133319c --- /dev/null +++ b/node_modules/character-reference-invalid/package.json @@ -0,0 +1,83 @@ +{ + "name": "character-reference-invalid", + "version": "2.0.1", + "description": "Map of invalid numeric character references to their replacements, according to HTML", + "license": "MIT", + "keywords": [ + "html", + "entity", + "numeric", + "character", + "reference", + "replacement", + "invalid", + "name" + ], + "repository": "wooorm/character-reference-invalid", + "bugs": "https://github.com/wooorm/character-reference-invalid/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "bail": "^2.0.0", + "c8": "^7.0.0", + "concat-stream": "^2.0.0", + "hast-util-select": "^5.0.0", + "hast-util-to-string": "^2.0.0", + "prettier": "^2.0.0", + "rehype-parse": "^8.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "unified": "^10.0.0", + "xo": "^0.45.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "generate": "node build", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/character-reference-invalid/readme.md b/node_modules/character-reference-invalid/readme.md new file mode 100644 index 00000000..21908769 --- /dev/null +++ b/node_modules/character-reference-invalid/readme.md @@ -0,0 +1,156 @@ +# character-reference-invalid + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Map of invalid numeric character references to their replacements, according to +HTML. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`characterReferenceInvalid`](#characterreferenceinvalid) +* [Source](#source) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a map from the [HTML spec][source] of C1 ASCII/Unicode control +characters (which are disallowed by HTML) to the characters those code points +would have in Windows 1252. +For example, U+0080 (Padding Character) maps to `€`, because that’s used for +0x80 in Windows 1252. + +## When should I use this? + +Probably never, unless you’re dealing with parsing HTML or similar XML-like +things, or in a place where Unicode is not the primary encoding (it is in most +places). + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install character-reference-invalid +``` + +In Deno with [Skypack][]: + +```js +import {characterReferenceInvalid} from 'https://cdn.skypack.dev/character-reference-invalid@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {characterReferenceInvalid} from 'character-reference-invalid' + +console.log(characterReferenceInvalid[0x80]) // => '€' +console.log(characterReferenceInvalid[0x89]) // => '‰' +console.log(characterReferenceInvalid[0x99]) // => '™' +``` + +## API + +This package exports the following identifiers: `characterReferenceInvalid`. +There is no default export. + +### `characterReferenceInvalid` + +`Record` — mapping between invalid numeric character reference +codes to replacements characters. + +## Source + +See [`html.spec.whatwg.org`][source]. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/character-entities`](https://github.com/wooorm/character-entities) + — HTML character entity info +* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — HTML 4 character entity info +* [`wooorm/character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — legacy character entity info +* [`wooorm/parse-entities`](https://github.com/wooorm/parse-entities) + — parse HTML character references +* [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities) + — serialize HTML character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/character-reference-invalid/workflows/main/badge.svg + +[build]: https://github.com/wooorm/character-reference-invalid/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/character-reference-invalid.svg + +[coverage]: https://codecov.io/github/wooorm/character-reference-invalid + +[downloads-badge]: https://img.shields.io/npm/dm/character-reference-invalid.svg + +[downloads]: https://www.npmjs.com/package/character-reference-invalid + +[size-badge]: https://img.shields.io/bundlephobia/minzip/character-reference-invalid.svg + +[size]: https://bundlephobia.com/result?p=character-reference-invalid + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[source]: https://html.spec.whatwg.org/multipage/parsing.html#table-charref-overrides diff --git a/node_modules/comma-separated-tokens/index.d.ts b/node_modules/comma-separated-tokens/index.d.ts new file mode 100644 index 00000000..6bf73a8f --- /dev/null +++ b/node_modules/comma-separated-tokens/index.d.ts @@ -0,0 +1,52 @@ +/** + * @typedef Options + * Configuration for `stringify`. + * @property {boolean} [padLeft=true] + * Whether to pad a space before a token. + * @property {boolean} [padRight=false] + * Whether to pad a space after a token. + */ +/** + * @typedef {Options} StringifyOptions + * Please use `StringifyOptions` instead. + */ +/** + * Parse comma-separated tokens to an array. + * + * @param {string} value + * Comma-separated tokens. + * @returns {Array} + * List of tokens. + */ +export function parse(value: string): Array +/** + * Serialize an array of strings or numbers to comma-separated tokens. + * + * @param {Array} values + * List of tokens. + * @param {Options} [options] + * Configuration for `stringify` (optional). + * @returns {string} + * Comma-separated tokens. + */ +export function stringify( + values: Array, + options?: Options | undefined +): string +/** + * Configuration for `stringify`. + */ +export type Options = { + /** + * Whether to pad a space before a token. + */ + padLeft?: boolean | undefined + /** + * Whether to pad a space after a token. + */ + padRight?: boolean | undefined +} +/** + * Please use `StringifyOptions` instead. + */ +export type StringifyOptions = Options diff --git a/node_modules/comma-separated-tokens/index.js b/node_modules/comma-separated-tokens/index.js new file mode 100644 index 00000000..0abf4702 --- /dev/null +++ b/node_modules/comma-separated-tokens/index.js @@ -0,0 +1,74 @@ +/** + * @typedef Options + * Configuration for `stringify`. + * @property {boolean} [padLeft=true] + * Whether to pad a space before a token. + * @property {boolean} [padRight=false] + * Whether to pad a space after a token. + */ + +/** + * @typedef {Options} StringifyOptions + * Please use `StringifyOptions` instead. + */ + +/** + * Parse comma-separated tokens to an array. + * + * @param {string} value + * Comma-separated tokens. + * @returns {Array} + * List of tokens. + */ +export function parse(value) { + /** @type {Array} */ + const tokens = [] + const input = String(value || '') + let index = input.indexOf(',') + let start = 0 + /** @type {boolean} */ + let end = false + + while (!end) { + if (index === -1) { + index = input.length + end = true + } + + const token = input.slice(start, index).trim() + + if (token || !end) { + tokens.push(token) + } + + start = index + 1 + index = input.indexOf(',', start) + } + + return tokens +} + +/** + * Serialize an array of strings or numbers to comma-separated tokens. + * + * @param {Array} values + * List of tokens. + * @param {Options} [options] + * Configuration for `stringify` (optional). + * @returns {string} + * Comma-separated tokens. + */ +export function stringify(values, options) { + const settings = options || {} + + // Ensure the last empty entry is seen. + const input = values[values.length - 1] === '' ? [...values, ''] : values + + return input + .join( + (settings.padRight ? ' ' : '') + + ',' + + (settings.padLeft === false ? '' : ' ') + ) + .trim() +} diff --git a/node_modules/comma-separated-tokens/license b/node_modules/comma-separated-tokens/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/comma-separated-tokens/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/comma-separated-tokens/package.json b/node_modules/comma-separated-tokens/package.json new file mode 100644 index 00000000..3a11f907 --- /dev/null +++ b/node_modules/comma-separated-tokens/package.json @@ -0,0 +1,72 @@ +{ + "name": "comma-separated-tokens", + "version": "2.0.3", + "description": "Parse and stringify comma-separated tokens", + "license": "MIT", + "keywords": [ + "dom", + "html", + "comma", + "separated", + "tokens", + "parse", + "stringify" + ], + "repository": "wooorm/comma-separated-tokens", + "bugs": "https://github.com/wooorm/comma-separated-tokens/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^18.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.52.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true + } +} diff --git a/node_modules/comma-separated-tokens/readme.md b/node_modules/comma-separated-tokens/readme.md new file mode 100644 index 00000000..4b788a92 --- /dev/null +++ b/node_modules/comma-separated-tokens/readme.md @@ -0,0 +1,167 @@ +# comma-separated-tokens + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Parse and stringify comma-separated tokens. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`parse(value)`](#parsevalue) + * [`stringify(values[, options])`](#stringifyvalues-options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [Security](#security) +* [License](#license) + +## What is this? + +This is a tiny package that can parse and stringify comma-separated tokens, as +used for example in the HTML `accept` attribute, according to the +[WHATWG spec][spec]. + +## When should I use this? + +This package is rather niche, it’s low-level and particularly useful when +working with [hast][]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install comma-separated-tokens +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {parse, stringify} from 'https://esm.sh/comma-separated-tokens@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {parse, stringify} from 'comma-separated-tokens' + +parse(' a ,b,,d d ') //=> ['a', 'b', '', 'd d'] +stringify(['a', 'b', '', 'd d']) //=> 'a, b, , d d' +``` + +## API + +This package exports the identifier `parse` and `stringify`. +There is no default export. + +### `parse(value)` + +Parse commma-separated tokens (`string`) to an array of strings +(`Array`), according to the [WHATWG spec][spec]. + +### `stringify(values[, options])` + +Serialize an array of strings or numbers (`Array`) to +comma-separated tokens (`string`). +Handles empty items at start or end correctly. + +> 👉 **Note**: it’s not possible to specify initial or final whitespace per +> value. + +##### `options` + +Configuration (optional). + +###### `options.padLeft` + +Whether to pad a space before a token (`boolean`, default: `true`). + +###### `options.padRight` + +Whether to pad a space after a token (`boolean`, default: `false`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type `Options`. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Related + +* [`space-separated-tokens`](https://github.com/wooorm/space-separated-tokens) + — parse/stringify space-separated tokens +* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space) + — replace multiple white-space characters with a single space +* [`property-information`](https://github.com/wooorm/property-information) + — info on HTML properties + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## Security + +This package is safe. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/comma-separated-tokens/workflows/main/badge.svg + +[build]: https://github.com/wooorm/comma-separated-tokens/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/comma-separated-tokens.svg + +[coverage]: https://codecov.io/github/wooorm/comma-separated-tokens + +[downloads-badge]: https://img.shields.io/npm/dm/comma-separated-tokens.svg + +[downloads]: https://www.npmjs.com/package/comma-separated-tokens + +[size-badge]: https://img.shields.io/bundlephobia/minzip/comma-separated-tokens.svg + +[size]: https://bundlephobia.com/result?p=comma-separated-tokens + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[license]: license + +[author]: https://wooorm.com + +[spec]: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#comma-separated-tokens + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/csstype/LICENSE b/node_modules/csstype/LICENSE new file mode 100644 index 00000000..ac06f622 --- /dev/null +++ b/node_modules/csstype/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017-2018 Fredrik Nicol + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/csstype/README.md b/node_modules/csstype/README.md new file mode 100644 index 00000000..9b3391ae --- /dev/null +++ b/node_modules/csstype/README.md @@ -0,0 +1,291 @@ +# CSSType + +[![npm](https://img.shields.io/npm/v/csstype.svg)](https://www.npmjs.com/package/csstype) + +TypeScript and Flow definitions for CSS, generated by [data from MDN](https://github.com/mdn/data). It provides autocompletion and type checking for CSS properties and values. + +**TypeScript** + +```ts +import type * as CSS from 'csstype'; + +const style: CSS.Properties = { + colour: 'white', // Type error on property + textAlign: 'middle', // Type error on value +}; +``` + +**Flow** + +```js +// @flow strict +import * as CSS from 'csstype'; + +const style: CSS.Properties<> = { + colour: 'white', // Type error on property + textAlign: 'middle', // Type error on value +}; +``` + +_Further examples below will be in TypeScript!_ + +## Getting started + +```sh +$ npm install csstype +``` + +## Table of content + +- [Style types](#style-types) +- [At-rule types](#at-rule-types) +- [Pseudo types](#pseudo-types) +- [Generics](#generics) +- [Usage](#usage) +- [What should I do when I get type errors?](#what-should-i-do-when-i-get-type-errors) +- [Version 3.0](#version-30) +- [Contributing](#contributing) + +## Style types + +Properties are categorized in different uses and in several technical variations to provide typings that suits as many as possible. + +| | Default | `Hyphen` | `Fallback` | `HyphenFallback` | +| -------------- | -------------------- | -------------------------- | ---------------------------- | ---------------------------------- | +| **All** | `Properties` | `PropertiesHyphen` | `PropertiesFallback` | `PropertiesHyphenFallback` | +| **`Standard`** | `StandardProperties` | `StandardPropertiesHyphen` | `StandardPropertiesFallback` | `StandardPropertiesHyphenFallback` | +| **`Vendor`** | `VendorProperties` | `VendorPropertiesHyphen` | `VendorPropertiesFallback` | `VendorPropertiesHyphenFallback` | +| **`Obsolete`** | `ObsoleteProperties` | `ObsoletePropertiesHyphen` | `ObsoletePropertiesFallback` | `ObsoletePropertiesHyphenFallback` | +| **`Svg`** | `SvgProperties` | `SvgPropertiesHyphen` | `SvgPropertiesFallback` | `SvgPropertiesHyphenFallback` | + +Categories: + +- **All** - Includes `Standard`, `Vendor`, `Obsolete` and `Svg` +- **`Standard`** - Current properties and extends subcategories `StandardLonghand` and `StandardShorthand` _(e.g. `StandardShorthandProperties`)_ +- **`Vendor`** - Vendor prefixed properties and extends subcategories `VendorLonghand` and `VendorShorthand` _(e.g. `VendorShorthandProperties`)_ +- **`Obsolete`** - Removed or deprecated properties +- **`Svg`** - SVG-specific properties + +Variations: + +- **Default** - JavaScript (camel) cased property names +- **`Hyphen`** - CSS (kebab) cased property names +- **`Fallback`** - Also accepts array of values e.g. `string | string[]` + +## At-rule types + +At-rule interfaces with descriptors. + +**TypeScript**: These will be found in the `AtRule` namespace, e.g. `AtRule.Viewport`. +**Flow**: These will be prefixed with `AtRule$`, e.g. `AtRule$Viewport`. + +| | Default | `Hyphen` | `Fallback` | `HyphenFallback` | +| -------------------- | -------------- | -------------------- | ---------------------- | ---------------------------- | +| **`@counter-style`** | `CounterStyle` | `CounterStyleHyphen` | `CounterStyleFallback` | `CounterStyleHyphenFallback` | +| **`@font-face`** | `FontFace` | `FontFaceHyphen` | `FontFaceFallback` | `FontFaceHyphenFallback` | +| **`@viewport`** | `Viewport` | `ViewportHyphen` | `ViewportFallback` | `ViewportHyphenFallback` | + +## Pseudo types + +String literals of pseudo classes and pseudo elements + +- `Pseudos` + + Extends: + - `AdvancedPseudos` + + Function-like pseudos e.g. `:not(:first-child)`. The string literal contains the value excluding the parenthesis: `:not`. These are separated because they require an argument that results in infinite number of variations. + + - `SimplePseudos` + + Plain pseudos e.g. `:hover` that can only be **one** variation. + +## Generics + +All interfaces has two optional generic argument to define length and time: `CSS.Properties` + +- **Length** is the first generic parameter and defaults to `string | 0` because `0` is the only [length where the unit identifier is optional](https://drafts.csswg.org/css-values-3/#lengths). You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit. + ```tsx + const style: CSS.Properties = { + width: 100, + }; + ``` +- **Time** is the second generic argument and defaults to `string`. You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit. + ```tsx + const style: CSS.Properties = { + transitionDuration: 1000, + }; + ``` + +## Usage + +```ts +import type * as CSS from 'csstype'; + +const style: CSS.Properties = { + width: '10px', + margin: '1em', +}; +``` + +In some cases, like for CSS-in-JS libraries, an array of values is a way to provide fallback values in CSS. Using `CSS.PropertiesFallback` instead of `CSS.Properties` will add the possibility to use any property value as an array of values. + +```ts +import type * as CSS from 'csstype'; + +const style: CSS.PropertiesFallback = { + display: ['-webkit-flex', 'flex'], + color: 'white', +}; +``` + +There's even string literals for pseudo selectors and elements. + +```ts +import type * as CSS from 'csstype'; + +const pseudos: { [P in CSS.SimplePseudos]?: CSS.Properties } = { + ':hover': { + display: 'flex', + }, +}; +``` + +Hyphen cased (kebab cased) properties are provided in `CSS.PropertiesHyphen` and `CSS.PropertiesHyphenFallback`. It's not **not** added by default in `CSS.Properties`. To allow both of them, you can simply extend with `CSS.PropertiesHyphen` or/and `CSS.PropertiesHyphenFallback`. + +```ts +import type * as CSS from 'csstype'; + +interface Style extends CSS.Properties, CSS.PropertiesHyphen {} + +const style: Style = { + 'flex-grow': 1, + 'flex-shrink': 0, + 'font-weight': 'normal', + backgroundColor: 'white', +}; +``` + +Adding type checked CSS properties to a `HTMLElement`. + +```ts +import type * as CSS from 'csstype'; + +const style: CSS.Properties = { + color: 'red', + margin: '1em', +}; + +let button = document.createElement('button'); + +Object.assign(button.style, style); +``` + +## What should I do when I get type errors? + +The goal is to have as perfect types as possible and we're trying to do our best. But with CSS Custom Properties, the CSS specification changing frequently and vendors implementing their own specifications with new releases sometimes causes type errors even if it should work. Here's some steps you could take to get it fixed: + +_If you're using CSS Custom Properties you can step directly to step 3._ + +1. **First of all, make sure you're doing it right.** A type error could also indicate that you're not :wink: + - Some CSS specs that some vendors has implemented could have been officially rejected or haven't yet received any official acceptance and are therefor not included + - If you're using TypeScript, [type widening](https://blog.mariusschulz.com/2017/02/04/TypeScript-2-1-literal-type-widening) could be the reason you get `Type 'string' is not assignable to...` errors + +2. **Have a look in [issues](https://github.com/frenic/csstype/issues) to see if an issue already has been filed. If not, create a new one.** To help us out, please refer to any information you have found. +3. Fix the issue locally with **TypeScript** (Flow further down): + - The recommended way is to use **module augmentation**. Here's a few examples: + + ```ts + // My css.d.ts file + import type * as CSS from 'csstype'; + + declare module 'csstype' { + interface Properties { + // Add a missing property + WebkitRocketLauncher?: string; + + // Add a CSS Custom Property + '--theme-color'?: 'black' | 'white'; + + // Allow namespaced CSS Custom Properties + [index: `--theme-${string}`]: any; + + // Allow any CSS Custom Properties + [index: `--${string}`]: any; + + // ...or allow any other property + [index: string]: any; + } + } + ``` + + - The alternative way is to use **type assertion**. Here's a few examples: + + ```ts + const style: CSS.Properties = { + // Add a missing property + ['WebkitRocketLauncher' as any]: 'launching', + + // Add a CSS Custom Property + ['--theme-color' as any]: 'black', + }; + ``` + + Fix the issue locally with **Flow**: + - Use **type assertion**. Here's a few examples: + + ```js + const style: $Exact> = { + // Add a missing property + [('WebkitRocketLauncher': any)]: 'launching', + + // Add a CSS Custom Property + [('--theme-color': any)]: 'black', + }; + ``` + +## Version 3.2 + +- **No longer compatible with version 2** + Conflicts may occur when both version ^3.2.0 and ^2.0.0 are installed. Potential fix for Npm would be to force resolution in `package.json`: + ```json + { + "overrides": { + "csstype": "^3.2.0" + } + } + ``` + +## Version 3.1 + +- **Data types are exposed** + TypeScript: `DataType.Color` + Flow: `DataType$Color` + +## Version 3.0 + +- **All property types are exposed with namespace** + TypeScript: `Property.AlignContent` (was `AlignContentProperty` before) + Flow: `Property$AlignContent` +- **All at-rules are exposed with namespace** + TypeScript: `AtRule.FontFace` (was `FontFace` before) + Flow: `AtRule$FontFace` +- **Data types are NOT exposed** + E.g. `Color` and `Box`. Because the generation of data types may suddenly be removed or renamed. +- **TypeScript hack for autocompletion** + Uses `(string & {})` for literal string unions and `(number & {})` for literal number unions ([related issue](https://github.com/microsoft/TypeScript/issues/29729)). Utilize `PropertyValue` to unpack types from e.g. `(string & {})` to `string`. +- **New generic for time** + Read more on the ["Generics"](#generics) section. +- **Flow types improvements** + Flow Strict enabled and exact types are used. + +## Contributing + +**Never modify `index.d.ts` and `index.js.flow` directly. They are generated automatically and committed so that we can easily follow any change it results in.** Therefor it's important that you run `$ git config merge.ours.driver true` after you've forked and cloned. That setting prevents merge conflicts when doing rebase. + +### Commands + +- `npm run build` Generates typings and type checks them +- `npm run watch` Runs build on each save +- `npm run test` Runs the tests +- `npm run lazy` Type checks, lints and formats everything diff --git a/node_modules/csstype/index.d.ts b/node_modules/csstype/index.d.ts new file mode 100644 index 00000000..da0affda --- /dev/null +++ b/node_modules/csstype/index.d.ts @@ -0,0 +1,22569 @@ +export {}; + +export type PropertyValue = + TValue extends Array ? Array : TValue extends infer TUnpacked & {} ? TUnpacked : TValue; + +export type Fallback = { [P in keyof T]: T[P] | readonly NonNullable[] }; + +export interface StandardLonghandProperties { + /** + * This feature is not Baseline because it does not work in some of the most widely-used browsers. + * + * **Syntax**: `auto | ` + * + * **Initial value**: `auto` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :----: | :-----: | :------: | :----: | :-: | + * | **93** | **92** | **15.4** | **93** | No | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/accent-color + */ + accentColor?: Property.AccentColor | undefined; + /** + * This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015. + * + * **Syntax**: `normal | | | ? ` + * + * **Initial value**: `normal` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :------: | :-----: | :-----: | :----: | :----: | + * | **29** | **28** | **9** | **12** | **11** | + * | 21 _-x-_ | | 7 _-x-_ | | | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-content + */ + alignContent?: Property.AlignContent | undefined; + /** + * This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015. + * + * **Syntax**: `normal | stretch | | [ ? ] | anchor-center` + * + * **Initial value**: `normal` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :------: | :-----: | :-----: | :----: | :----: | + * | **29** | **20** | **9** | **12** | **11** | + * | 21 _-x-_ | | 7 _-x-_ | | | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-items + */ + alignItems?: Property.AlignItems | undefined; + /** + * This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015. + * + * **Syntax**: `auto | normal | stretch | | ? | anchor-center` + * + * **Initial value**: `auto` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :------: | :-----: | :-----: | :----: | :----: | + * | **29** | **20** | **9** | **12** | **10** | + * | 21 _-x-_ | | 7 _-x-_ | | | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-self + */ + alignSelf?: Property.AlignSelf | undefined; + /** + * **Syntax**: `[ normal | | | ? ]#` + * + * **Initial value**: `normal` + */ + alignTracks?: Property.AlignTracks | undefined; + /** + * This feature is not Baseline because it does not work in some of the most widely-used browsers. + * + * **Syntax**: `baseline | alphabetic | ideographic | middle | central | mathematical | text-before-edge | text-after-edge` + * + * **Initial value**: `baseline` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :----: | :-----: | :-----: | :----: | :-: | + * | **1** | No | **5.1** | **79** | No | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/alignment-baseline + */ + alignmentBaseline?: Property.AlignmentBaseline | undefined; + /** + * This feature is not Baseline because it does not work in some of the most widely-used browsers. + * + * **Syntax**: `none | #` + * + * **Initial value**: `none` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :-----: | :---------: | :----: | :-----: | :-: | + * | **125** | **preview** | **26** | **125** | No | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/anchor-name + */ + anchorName?: Property.AnchorName | undefined; + /** + * **Syntax**: `none | all | #` + * + * **Initial value**: `none` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :-----: | :---------: | :----: | :-----: | :-: | + * | **131** | **preview** | **26** | **131** | No | + */ + anchorScope?: Property.AnchorScope | undefined; + /** + * Since July 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers. + * + * **Syntax**: `#` + * + * **Initial value**: `replace` + * + * | Chrome | Firefox | Safari | Edge | IE | + * | :-----: | :-----: | :----: | :-----: | :-: | + * | **112** | **115** | **16** | **112** | No | + * + * @see https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-composition + */ + animationComposition?: Property.AnimationComposition | undefined; + /** + * This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015. + * + * **Syntax**: ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json new file mode 100644 index 00000000..ee8abb52 --- /dev/null +++ b/node_modules/debug/package.json @@ -0,0 +1,64 @@ +{ + "name": "debug", + "version": "4.4.3", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon (https://github.com/qix-)", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "mocha test.js test.node.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "^2.1.3" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "sinon": "^14.0.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + }, + "xo": { + "rules": { + "import/extensions": "off" + } + } +} diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js new file mode 100644 index 00000000..5993451b --- /dev/null +++ b/node_modules/debug/src/browser.js @@ -0,0 +1,272 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js new file mode 100644 index 00000000..141cb578 --- /dev/null +++ b/node_modules/debug/src/common.js @@ -0,0 +1,292 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(/\s+/g, ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js new file mode 100644 index 00000000..bf4c57f2 --- /dev/null +++ b/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js new file mode 100644 index 00000000..715560a4 --- /dev/null +++ b/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/decode-named-character-reference/index.d.ts b/node_modules/decode-named-character-reference/index.d.ts new file mode 100644 index 00000000..874bb5c2 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.d.ts @@ -0,0 +1,13 @@ +/** + * Decode a single character reference (without the `&` or `;`). + * You probably only need this when you’re building parsers yourself that follow + * different rules compared to HTML. + * This is optimized to be tiny in browsers. + * + * @param {string} value + * `notin` (named), `#123` (deci), `#x123` (hexa). + * @returns {string|false} + * Decoded reference. + */ +export function decodeNamedCharacterReference(value: string): string | false; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/decode-named-character-reference/index.d.ts.map b/node_modules/decode-named-character-reference/index.d.ts.map new file mode 100644 index 00000000..5b0e0481 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,qDALW,MAAM,GAEJ,MAAM,GAAC,KAAK,CAKxB"} \ No newline at end of file diff --git a/node_modules/decode-named-character-reference/index.dom.d.ts b/node_modules/decode-named-character-reference/index.dom.d.ts new file mode 100644 index 00000000..9e3f4258 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.dom.d.ts @@ -0,0 +1,6 @@ +/** + * @param {string} value + * @returns {string | false} + */ +export function decodeNamedCharacterReference(value: string): string | false; +//# sourceMappingURL=index.dom.d.ts.map \ No newline at end of file diff --git a/node_modules/decode-named-character-reference/index.dom.d.ts.map b/node_modules/decode-named-character-reference/index.dom.d.ts.map new file mode 100644 index 00000000..da2dd777 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.dom.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.dom.d.ts","sourceRoot":"","sources":["index.dom.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,qDAHW,MAAM,GACJ,MAAM,GAAG,KAAK,CA2B1B"} \ No newline at end of file diff --git a/node_modules/decode-named-character-reference/index.dom.js b/node_modules/decode-named-character-reference/index.dom.js new file mode 100644 index 00000000..01670f76 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.dom.js @@ -0,0 +1,36 @@ +/// + +/* global document */ + +const element = document.createElement('i') + +/** + * @param {string} value + * @returns {string | false} + */ +export function decodeNamedCharacterReference(value) { + const characterReference = '&' + value + ';' + element.innerHTML = characterReference + const character = element.textContent + + // Some named character references do not require the closing semicolon + // (`¬`, for instance), which leads to situations where parsing the assumed + // named reference of `¬it;` will result in the string `¬it;`. + // When we encounter a trailing semicolon after parsing, and the character + // reference to decode was not a semicolon (`;`), we can assume that the + // matching was not complete. + if ( + // @ts-expect-error: TypeScript is wrong that `textContent` on elements can + // yield `null`. + character.charCodeAt(character.length - 1) === 59 /* `;` */ && + value !== 'semi' + ) { + return false + } + + // If the decoded string is equal to the input, the character reference was + // not valid. + // @ts-expect-error: TypeScript is wrong that `textContent` on elements can + // yield `null`. + return character === characterReference ? false : character +} diff --git a/node_modules/decode-named-character-reference/index.js b/node_modules/decode-named-character-reference/index.js new file mode 100644 index 00000000..97952af0 --- /dev/null +++ b/node_modules/decode-named-character-reference/index.js @@ -0,0 +1,19 @@ +import {characterEntities} from 'character-entities' + +// To do: next major: use `Object.hasOwn`. +const own = {}.hasOwnProperty + +/** + * Decode a single character reference (without the `&` or `;`). + * You probably only need this when you’re building parsers yourself that follow + * different rules compared to HTML. + * This is optimized to be tiny in browsers. + * + * @param {string} value + * `notin` (named), `#123` (deci), `#x123` (hexa). + * @returns {string|false} + * Decoded reference. + */ +export function decodeNamedCharacterReference(value) { + return own.call(characterEntities, value) ? characterEntities[value] : false +} diff --git a/node_modules/decode-named-character-reference/license b/node_modules/decode-named-character-reference/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/decode-named-character-reference/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/decode-named-character-reference/package.json b/node_modules/decode-named-character-reference/package.json new file mode 100644 index 00000000..7d47ba13 --- /dev/null +++ b/node_modules/decode-named-character-reference/package.json @@ -0,0 +1,89 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/wooorm/decode-named-character-reference/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "character-entities": "^2.0.0" + }, + "description": "Decode named character references", + "devDependencies": { + "@types/node": "^24.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^1.0.0" + }, + "exports": { + "deno": "./index.js", + "edge-light": "./index.js", + "react-native": "./index.js", + "worker": "./index.js", + "workerd": "./index.js", + "browser": "./index.dom.js", + "default": "./index.js" + }, + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.dom.d.ts.map", + "index.dom.d.ts", + "index.dom.js", + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "keywords": [ + "character", + "decode", + "named", + "references" + ], + "license": "MIT", + "main#": "to do: next major: remove field", + "main": "index.js", + "name": "decode-named-character-reference", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "wooorm/decode-named-character-reference", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "ignoreCatch": true + }, + "types#": "to do: next major: remove field", + "types": "index.d.ts", + "type": "module", + "version": "1.2.0", + "xo": { + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + }, + "space": true + } +} diff --git a/node_modules/decode-named-character-reference/readme.md b/node_modules/decode-named-character-reference/readme.md new file mode 100644 index 00000000..a0c8199e --- /dev/null +++ b/node_modules/decode-named-character-reference/readme.md @@ -0,0 +1,136 @@ +# decode-named-character-reference + +[![Build Status][build-badge]][build] +[![Coverage Status][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Decode named character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`decodeNamedCharacterReference(value)`](#decodenamedcharacterreferencevalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +A workaround for webpack. + +## When should I use this? + +Never use this. +Use [`parse-entities`][parse-entities]. +It uses this. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install decode-named-character-reference +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {decodeNamedCharacterReference} from 'https://esm.sh/decode-named-character-reference@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {decodeNamedCharacterReference} from 'decode-named-character-reference' + +decodeNamedCharacterReference('amp') //=> '&' +``` + +## API + +This package exports the identifier `decodeNamedCharacterReference`. +There is no default export. + +### `decodeNamedCharacterReference(value)` + +Again, use [`parse-entities`][parse-entities]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`parse-entities`][parse-entities] + — parse (decode) HTML character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[author]: https://wooorm.com + +[build]: https://github.com/wooorm/decode-named-character-reference/actions + +[build-badge]: https://github.com/wooorm/decode-named-character-reference/workflows/main/badge.svg + +[contribute]: https://opensource.guide/how-to-contribute/ + +[coverage]: https://codecov.io/github/wooorm/decode-named-character-reference + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/decode-named-character-reference.svg + +[downloads]: https://www.npmjs.com/package/decode-named-character-reference + +[downloads-badge]: https://img.shields.io/npm/dm/decode-named-character-reference.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[license]: license + +[npm]: https://docs.npmjs.com/cli/install + +[parse-entities]: https://github.com/wooorm/parse-entities + +[size]: https://bundlephobia.com/result?p=decode-named-character-reference + +[size-badge]: https://img.shields.io/bundlephobia/minzip/decode-named-character-reference.svg + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/dequal/index.d.ts b/node_modules/dequal/index.d.ts new file mode 100644 index 00000000..a9aea5d5 --- /dev/null +++ b/node_modules/dequal/index.d.ts @@ -0,0 +1 @@ +export function dequal(foo: any, bar: any): boolean; \ No newline at end of file diff --git a/node_modules/dequal/license b/node_modules/dequal/license new file mode 100644 index 00000000..a3f96f82 --- /dev/null +++ b/node_modules/dequal/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Luke Edwards (lukeed.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/dequal/lite/index.d.ts b/node_modules/dequal/lite/index.d.ts new file mode 100644 index 00000000..a9aea5d5 --- /dev/null +++ b/node_modules/dequal/lite/index.d.ts @@ -0,0 +1 @@ +export function dequal(foo: any, bar: any): boolean; \ No newline at end of file diff --git a/node_modules/dequal/lite/index.js b/node_modules/dequal/lite/index.js new file mode 100644 index 00000000..ac3eb6b8 --- /dev/null +++ b/node_modules/dequal/lite/index.js @@ -0,0 +1,31 @@ +var has = Object.prototype.hasOwnProperty; + +function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} + +exports.dequal = dequal; \ No newline at end of file diff --git a/node_modules/dequal/lite/index.min.js b/node_modules/dequal/lite/index.min.js new file mode 100644 index 00000000..2eaa55fd --- /dev/null +++ b/node_modules/dequal/lite/index.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.dequal={})}(this,(function(e){var t=Object.prototype.hasOwnProperty;e.dequal=function e(r,n){var o,i;if(r===n)return!0;if(r&&n&&(o=r.constructor)===n.constructor){if(o===Date)return r.getTime()===n.getTime();if(o===RegExp)return r.toString()===n.toString();if(o===Array){if((i=r.length)===n.length)for(;i--&&e(r[i],n[i]););return-1===i}if(!o||"object"==typeof r){for(o in i=0,r){if(t.call(r,o)&&++i&&!t.call(n,o))return!1;if(!(o in n)||!e(r[o],n[o]))return!1}return Object.keys(n).length===i}}return r!=r&&n!=n}})); \ No newline at end of file diff --git a/node_modules/dequal/lite/index.mjs b/node_modules/dequal/lite/index.mjs new file mode 100644 index 00000000..5820d674 --- /dev/null +++ b/node_modules/dequal/lite/index.mjs @@ -0,0 +1,29 @@ +var has = Object.prototype.hasOwnProperty; + +export function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} diff --git a/node_modules/dequal/package.json b/node_modules/dequal/package.json new file mode 100644 index 00000000..df1cb29c --- /dev/null +++ b/node_modules/dequal/package.json @@ -0,0 +1,57 @@ +{ + "name": "dequal", + "version": "2.0.3", + "repository": "lukeed/dequal", + "description": "A tiny (304B to 489B) utility for check for deep equality", + "unpkg": "dist/index.min.js", + "module": "dist/index.mjs", + "main": "dist/index.js", + "types": "index.d.ts", + "license": "MIT", + "author": { + "name": "Luke Edwards", + "email": "luke.edwards05@gmail.com", + "url": "https://lukeed.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "build": "bundt", + "pretest": "npm run build", + "postbuild": "echo \"lite\" | xargs -n1 cp -v index.d.ts", + "test": "uvu -r esm test" + }, + "files": [ + "*.d.ts", + "dist", + "lite" + ], + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./lite": { + "types": "./index.d.ts", + "import": "./lite/index.mjs", + "require": "./lite/index.js" + }, + "./package.json": "./package.json" + }, + "modes": { + "lite": "src/lite.js", + "default": "src/index.js" + }, + "keywords": [ + "deep", + "deep-equal", + "equality" + ], + "devDependencies": { + "bundt": "1.0.2", + "esm": "3.2.25", + "uvu": "0.3.2" + } +} diff --git a/node_modules/dequal/readme.md b/node_modules/dequal/readme.md new file mode 100644 index 00000000..e3341ef4 --- /dev/null +++ b/node_modules/dequal/readme.md @@ -0,0 +1,112 @@ +# dequal [![CI](https://github.com/lukeed/dequal/workflows/CI/badge.svg)](https://github.com/lukeed/dequal/actions) + +> A tiny (304B to 489B) utility to check for deep equality + +This module supports comparison of all types, including `Function`, `RegExp`, `Date`, `Set`, `Map`, `TypedArray`s, `DataView`, `null`, `undefined`, and `NaN` values. Complex values (eg, Objects, Arrays, Sets, Maps, etc) are traversed recursively. + +> **Important:** +> * key order **within Objects** does not matter +> * value order **within Arrays** _does_ matter +> * values **within Sets and Maps** use value equality +> * keys **within Maps** use value equality + + +## Install + +``` +$ npm install --save dequal +``` + +## Modes + +There are two "versions" of `dequal` available: + +#### `dequal` +> **Size (gzip):** 489 bytes
+> **Availability:** [CommonJS](https://unpkg.com/dequal/dist/index.js), [ES Module](https://unpkg.com/dequal/dist/index.mjs), [UMD](https://unpkg.com/dequal/dist/index.min.js) + +#### `dequal/lite` +> **Size (gzip):** 304 bytes
+> **Availability:** [CommonJS](https://unpkg.com/dequal/lite/index.js), [ES Module](https://unpkg.com/dequal/lite/index.mjs) + +| | IE9+ | Number | String | Date | RegExp | Object | Array | Class | Set | Map | ArrayBuffer | [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#TypedArray_objects) | [DataView](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | +|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| +| `dequal` | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `dequal/lite` | :+1: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | + +> **Note:** Table scrolls horizontally! + +## Usage + +```js +import { dequal } from 'dequal'; + +dequal(1, 1); //=> true +dequal({}, {}); //=> true +dequal('foo', 'foo'); //=> true +dequal([1, 2, 3], [1, 2, 3]); //=> true +dequal(dequal, dequal); //=> true +dequal(/foo/, /foo/); //=> true +dequal(null, null); //=> true +dequal(NaN, NaN); //=> true +dequal([], []); //=> true +dequal( + [{ a:1 }, [{ b:{ c:[1] } }]], + [{ a:1 }, [{ b:{ c:[1] } }]] +); //=> true + +dequal(1, '1'); //=> false +dequal(null, undefined); //=> false +dequal({ a:1, b:[2,3] }, { a:1, b:[2,5] }); //=> false +dequal(/foo/i, /bar/g); //=> false +``` + +## API + +### dequal(foo, bar) +Returns: `Boolean` + +Both `foo` and `bar` can be of any type.
+A `Boolean` is returned indicating if the two were deeply equal. + + +## Benchmarks + +> Running Node v10.13.0 + +The benchmarks can be found in the [`/bench`](/bench) directory. They are separated into two categories: + +* `basic` – compares an object comprised of `String`, `Number`, `Date`, `Array`, and `Object` values. +* `complex` – like `basic`, but adds `RegExp`, `Map`, `Set`, and `Uint8Array` values. + +> **Note:** Only candidates that pass validation step(s) are listed.
For example, `fast-deep-equal/es6` handles `Set` and `Map` values, but uses _referential equality_ while those listed use _value equality_. + +``` +Load times: + assert 0.109ms + util 0.006ms + fast-deep-equal 0.479ms + lodash/isequal 22.826ms + nano-equal 0.417ms + dequal 0.396ms + dequal/lite 0.264ms + +Benchmark :: basic + assert.deepStrictEqual x 325,262 ops/sec ±0.57% (94 runs sampled) + util.isDeepStrictEqual x 318,812 ops/sec ±0.87% (94 runs sampled) + fast-deep-equal x 1,332,393 ops/sec ±0.36% (93 runs sampled) + lodash.isEqual x 269,129 ops/sec ±0.59% (95 runs sampled) + nano-equal x 1,122,053 ops/sec ±0.36% (96 runs sampled) + dequal/lite x 1,700,972 ops/sec ±0.31% (94 runs sampled) + dequal x 1,698,972 ops/sec ±0.63% (97 runs sampled) + +Benchmark :: complex + assert.deepStrictEqual x 124,518 ops/sec ±0.64% (96 runs sampled) + util.isDeepStrictEqual x 125,113 ops/sec ±0.24% (96 runs sampled) + lodash.isEqual x 58,677 ops/sec ±0.49% (96 runs sampled) + dequal x 345,386 ops/sec ±0.27% (96 runs sampled) +``` + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/devlop/license b/node_modules/devlop/license new file mode 100644 index 00000000..de5a7bba --- /dev/null +++ b/node_modules/devlop/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2023 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/devlop/package.json b/node_modules/devlop/package.json new file mode 100644 index 00000000..8319d8d5 --- /dev/null +++ b/node_modules/devlop/package.json @@ -0,0 +1,80 @@ +{ + "name": "devlop", + "version": "1.1.0", + "description": "Do things in development and nothing otherwise", + "license": "MIT", + "keywords": [ + "assert", + "deprecate", + "develop", + "development" + ], + "repository": "wooorm/devlop", + "bugs": "https://github.com/wooorm/devlop/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": { + "types": "./lib/development.d.ts", + "development": "./lib/development.js", + "default": "./lib/default.js" + }, + "files": [ + "lib/" + ], + "dependencies": { + "dequal": "^2.0.0" + }, + "devDependencies": { + "@rollup/plugin-node-resolve": "^15.1.0", + "@rollup/plugin-terser": "^0.4.3", + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "esbuild": "^0.18.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-development": "node --conditions development test-development.js", + "test-api-default": "node test-default.js", + "test-api": "npm run test-api-development && npm run test-api-default", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/devlop/readme.md b/node_modules/devlop/readme.md new file mode 100644 index 00000000..d90be191 --- /dev/null +++ b/node_modules/devlop/readme.md @@ -0,0 +1,360 @@ +# devlop + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Some tools to make developing easier while not including code in production. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`deprecate(fn, message[, code])`](#deprecatefn-message-code) + * [`equal(actual, expected[, message])`](#equalactual-expected-message) + * [`ok(value[, message])`](#okvalue-message) + * [`unreachable(message?)`](#unreachablemessage) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package lets you do things in development that are free in production. +It contains useful `assert` functions and a `deprecate` function that are +useful when developing JavaScript packages while being small in production. + +If you know Rust, you might know how nice having a +[`debug_assert!`][rust-debug-assert] is. +This is that, and a bit more. +For more on why they’re nice, see +[“Rust’s Two Kinds of ‘Assert’ Make for Better Code”][rust-two-kinds] + +## When should I use this? + +Many JavaScript programs do not use assertions at all (perhaps because they’re +typed and so assume type safety) or include lots of code to throw errors when +users do weird things (weighing down production code). +This package hopes to improve the sitation by making assertions free and +deprecations cheap. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install devlop +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {deprecate, equal, ok, unreachable} from 'https://esm.sh/devlop@1' +// For development code: +// import {deprecate, equal, ok} from 'https://esm.sh/devlop@1?conditions=development' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say we have a small ponyfill for the ES5 `String#includes` function. +It’s deprecated, because folks can use `String#includes` nowadays. +It’s nicely typed so users should be able to figure out what to pass but we +include assertions to show nicer errors when they get it wrong. + +`example/string-includes.js`: + +```js +import {deprecate, ok} from 'devlop' + +export const stringIncludes = deprecate( + includes, + 'Since ES5, please use `String#includes` itself.' +) + +/** + * @deprecated + * Since ES5, please use `String#includes` itself. + * @param {string} value + * Value to search in. + * @param {string} search + * Value to search for. + * @param {number | undefined} [position=0] + * Position to search from (default: `0`). + * @returns {boolean} + * Whether the searched for value exists in the searched value after position. + */ +function includes(value, search, position) { + ok(typeof value === 'string', 'expected string for `value`') + ok(typeof search === 'string', 'expected string for `search`') + ok(position === undefined || typeof position === 'number', 'expected number') + ok( + position === undefined || + (typeof position === 'number' && + !(/* #__PURE__ */ Number.isNaN(position))), + 'expected number' + ) + // eslint-disable-next-line unicorn/prefer-includes + return value.indexOf(search, position || 0) !== -1 +} +``` + +`example/index.js`: + +```js +import {stringIncludes} from './example-includes.js' + +console.log(stringIncludes('blue whale', 'dolphin')) //=> false +console.log(stringIncludes('blue whale', 'whale')) //=> true +``` + +Say we’d bundle that in development with [`esbuild`][esbuild] and check the +gzip size ([`gzip-size-cli`][gzip-size-cli]), we’d get 1.02 kB of code: + +```sh +$ esbuild example/index.js --bundle --conditions=development --format=esm --minify --target=es2022 | gzip-size +1.02 kB +``` + +But because `devlop` is light in production we’d get: + +```sh +$ esbuild example/index.js --bundle --format=esm --minify --target=es2022 | gzip-size +169 B +``` + +The bundle looks as follows: + +```js +function u(n){return n}var r=u(c,"Since ES5, please use `String#includes` itself.");function c(n,t,e){return n.indexOf(t,e||0)!==-1}console.log(r("blue whale","dolphin"));console.log(r("blue whale","whale")); +``` + +It depends a bit on which bundler and minifier you use how small the code is: +esbuild keeps the unused message parameter to the `deprecate` function around +and does not know `Number.isNaN` can be dropped without a `/* #__PURE__ */` +annotation. + +[`rollup`][rollup] with [`@rollup/plugin-node-resolve`][node-resolve] +and [`@rollup/plugin-terser`][terser] performs even better: + +```sh +$ rollup example/index.js -p node-resolve -p terser | gzip-size +118 B +``` + +The bundle looks as follows: + +```js +const l=function(l,e,o){return-1!==l.indexOf(e,o||0)};console.log(l("blue whale","dolphin")),console.log(l("blue whale","whale")); +``` + +Rollup doesn’t need the `/* #__PURE__ */` comment either! + +## API + +This package exports the identifiers [`deprecate`][api-deprecate], +[`equal`][api-equal], [`ok`][api-ok], and [`unreachable`][api-unreachable]. +There is no default export. + +The export map supports the [`development` condition][node-condition]. +Run `node --conditions development module.js` to get dev code. +Without this condition, no-ops are loaded. + +### `deprecate(fn, message[, code])` + +Wrap a function or class to show a deprecation message when first called. + +> 👉 **Important**: only shows a message when the `development` condition is +> used, does nothing in production. + +When the resulting wrapped `fn` is called, emits a warning once to +`console.error` (`stderr`). +If a code is given, one warning message will be emitted in total per code. + +###### Parameters + +* `fn` (`Function`) + — function or class +* `message` (`string`) + — message explaining deprecation +* `code` (`string`, optional) + — deprecation identifier (optional); deprecation messages will be generated + only once per code + +###### Returns + +Wrapped `fn`. + +### `equal(actual, expected[, message])` + +Assert deep strict equivalence. + +> 👉 **Important**: only asserts when the `development` condition is used, does +> nothing in production. + +###### Parameters + +* `actual` (`unknown`) + — value +* `expected` (`unknown`) + — baseline +* `message` (`Error` or `string`, default: `'Expected values to be deeply + equal'`) + — message for assertion error + +###### Returns + +Nothing (`undefined`). + +###### Throws + +Throws (`AssertionError`) when `actual` is not deep strict equal to `expected`. + +### `ok(value[, message])` + +Assert if `value` is truthy. + +> 👉 **Important**: only asserts when the `development` condition is used, does +> nothing in production. + +###### Parameters + +* `actual` (`unknown`) + — value to assert +* `message` (`Error` or `string`, default: `'Expected value to be truthy'`) + — message for assertion error + +###### Returns + +Nothing (`undefined`). + +###### Throws + +Throws (`AssertionError`) when `value` is falsey. + +### `unreachable(message?)` + +Assert that a code path never happens. + +> 👉 **Important**: only asserts when the `development` condition is used, +> does nothing in production. + +###### Parameters + +* `message` (`Error` or `string`, default: `'Unreachable'`) + — message for assertion error + +###### Returns + +Never (`never`). + +###### Throws + +Throws (`AssertionError`), always. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This project is compatible with maintained versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `devlop@^1`, +compatible with Node.js 16. + +## Security + +This package is safe. + +## Related + +* [`babel-plugin-unassert`](https://github.com/unassert-js/babel-plugin-unassert) + — encourage reliable programming with assertions while compiling them away + in production (can remove arbitrary `assert` modules, works regardless of + conditions, so has to be configured by the end user) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/devlop/workflows/main/badge.svg + +[build]: https://github.com/wooorm/devlop/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/devlop.svg + +[coverage]: https://codecov.io/github/wooorm/devlop + +[downloads-badge]: https://img.shields.io/npm/dm/devlop.svg + +[downloads]: https://www.npmjs.com/package/devlop + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=devlop + +[size]: https://bundlejs.com/?q=devlop + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[node-condition]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[rust-debug-assert]: https://doc.rust-lang.org/std/macro.debug_assert.html + +[rust-two-kinds]: https://tratt.net/laurie/blog/2023/rusts_two_kinds_of_assert_make_for_better_code.html + +[esbuild]: https://esbuild.github.io + +[gzip-size-cli]: https://github.com/sindresorhus/gzip-size-cli/tree/main + +[rollup]: https://rollupjs.org + +[node-resolve]: https://github.com/rollup/plugins/tree/master/packages/node-resolve + +[terser]: https://github.com/rollup/plugins/tree/master/packages/terser#readme + +[api-deprecate]: #deprecatefn-message-code + +[api-equal]: #equalactual-expected-message + +[api-ok]: #okvalue-message + +[api-unreachable]: #unreachablemessage diff --git a/node_modules/escape-string-regexp/index.d.ts b/node_modules/escape-string-regexp/index.d.ts new file mode 100644 index 00000000..e8f92881 --- /dev/null +++ b/node_modules/escape-string-regexp/index.d.ts @@ -0,0 +1,16 @@ +/** +Escape RegExp special characters. + +You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. + +@example +``` +import escapeStringRegexp from 'escape-string-regexp'; + +const escapedString = escapeStringRegexp('How much $ for a 🦄?'); +//=> 'How much \\$ for a 🦄\\?' + +new RegExp(escapedString); +``` +*/ +export default function escapeStringRegexp(string: string): string; diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js new file mode 100644 index 00000000..9ce9323f --- /dev/null +++ b/node_modules/escape-string-regexp/index.js @@ -0,0 +1,11 @@ +export default function escapeStringRegexp(string) { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + // Escape characters with special meaning either inside or outside character sets. + // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + return string + .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') + .replace(/-/g, '\\x2d'); +} diff --git a/node_modules/escape-string-regexp/license b/node_modules/escape-string-regexp/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/escape-string-regexp/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/escape-string-regexp/package.json b/node_modules/escape-string-regexp/package.json new file mode 100644 index 00000000..9390a6bd --- /dev/null +++ b/node_modules/escape-string-regexp/package.json @@ -0,0 +1,40 @@ +{ + "name": "escape-string-regexp", + "version": "5.0.0", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": "sindresorhus/escape-string-regexp", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "escape", + "regex", + "regexp", + "regular", + "expression", + "string", + "special", + "characters" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/escape-string-regexp/readme.md b/node_modules/escape-string-regexp/readme.md new file mode 100644 index 00000000..839df6e5 --- /dev/null +++ b/node_modules/escape-string-regexp/readme.md @@ -0,0 +1,34 @@ +# escape-string-regexp + +> Escape RegExp special characters + +## Install + +``` +$ npm install escape-string-regexp +``` + +## Usage + +```js +import escapeStringRegexp from 'escape-string-regexp'; + +const escapedString = escapeStringRegexp('How much $ for a 🦄?'); +//=> 'How much \\$ for a 🦄\\?' + +new RegExp(escapedString); +``` + +You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. + +--- + +

+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/estree-util-is-identifier-name/index.d.ts b/node_modules/estree-util-is-identifier-name/index.d.ts new file mode 100644 index 00000000..11a112cd --- /dev/null +++ b/node_modules/estree-util-is-identifier-name/index.d.ts @@ -0,0 +1,2 @@ +export type Options = import('./lib/index.js').Options; +export { cont, name, start } from "./lib/index.js"; diff --git a/node_modules/estree-util-is-identifier-name/index.js b/node_modules/estree-util-is-identifier-name/index.js new file mode 100644 index 00000000..a78d8fe5 --- /dev/null +++ b/node_modules/estree-util-is-identifier-name/index.js @@ -0,0 +1,5 @@ +/** + * @typedef {import('./lib/index.js').Options} Options + */ + +export {cont, name, start} from './lib/index.js' diff --git a/node_modules/estree-util-is-identifier-name/license b/node_modules/estree-util-is-identifier-name/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/estree-util-is-identifier-name/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/estree-util-is-identifier-name/package.json b/node_modules/estree-util-is-identifier-name/package.json new file mode 100644 index 00000000..463567c4 --- /dev/null +++ b/node_modules/estree-util-is-identifier-name/package.json @@ -0,0 +1,73 @@ +{ + "name": "estree-util-is-identifier-name", + "version": "3.0.0", + "description": "Check if something can be an ecmascript (javascript) identifier name", + "license": "MIT", + "keywords": [ + "estree", + "ast", + "ecmascript", + "javascript", + "tree", + "identifier", + "character" + ], + "repository": "syntax-tree/estree-util-is-identifier-name", + "bugs": "https://github.com/syntax-tree/estree-util-is-identifier-name/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.55.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/estree-util-is-identifier-name/readme.md b/node_modules/estree-util-is-identifier-name/readme.md new file mode 100644 index 00000000..9dce9444 --- /dev/null +++ b/node_modules/estree-util-is-identifier-name/readme.md @@ -0,0 +1,225 @@ +# estree-util-is-identifier-name + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[estree][] utility to check if something can be an identifier. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`cont(code[, options])`](#contcode-options) + * [`name(name[, options])`](#namename-options) + * [`start(code)`](#startcode) + * [Options](#options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that can be used to check if something can be an +identifier name. +For example, `a`, `_`, and `a1` are fine, but `1` and `-` are not. + +## When should I use this? + +You can use this utility when generating IDs from strings or parsing IDs. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install estree-util-is-identifier-name +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {cont, name, start} from 'https://esm.sh/estree-util-is-identifier-name@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {cont, name, start} from 'estree-util-is-identifier-name' + +name('$something69') // => true +name('69') // => false +name('var') // => true (this does not handle keywords) + +start(48) // => false (code point for `'0'`) +cont(48) // => true (code point for `'0'`) +``` + +## API + +This package exports the identifiers [`cont`][api-cont], +[`name`][api-name], and +[`start`][api-start]. +There is no default export. + +### `cont(code[, options])` + +Checks if the given code point can continue an identifier. + +###### Parameters + +* `code` (`number`) + — code point to check +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Whether `code` can continue an identifier (`boolean`). + +### `name(name[, options])` + +Checks if the given value is a valid identifier name. + +###### Parameters + +* `name` (`string`) + — identifier to check +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Whether `name` can be an identifier (`boolean`). + +### `start(code)` + +Checks if the given code point can start an identifier. + +###### Parameters + +* `code` (`number`) + — code point to check + +###### Returns + +Whether `code` can start an identifier (`boolean`). + +### Options + +Configuration (TypeScript type). + +###### Fields + +* `jsx` (`boolean`, default: `false`) + — support JSX identifiers. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`estree-util-is-identifier-name@^3`, compatible with Node.js 16. + +## Related + +* [`goto-bus-stop/estree-is-identifier`](https://github.com/goto-bus-stop/estree-is-identifier) + — check if an AST node is an identifier + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/estree-util-is-identifier-name/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/estree-util-is-identifier-name/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/estree-util-is-identifier-name.svg + +[coverage]: https://codecov.io/github/syntax-tree/estree-util-is-identifier-name + +[downloads-badge]: https://img.shields.io/npm/dm/estree-util-is-identifier-name.svg + +[downloads]: https://www.npmjs.com/package/estree-util-is-identifier-name + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=estree-util-is-identifier-name + +[size]: https://bundlejs.com/?q=estree-util-is-identifier-name + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[estree]: https://github.com/estree/estree + +[api-cont]: #contcode-options + +[api-name]: #namename-options + +[api-start]: #startcode + +[api-options]: #options diff --git a/node_modules/extend/.editorconfig b/node_modules/extend/.editorconfig new file mode 100644 index 00000000..bc228f82 --- /dev/null +++ b/node_modules/extend/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/extend/.eslintrc b/node_modules/extend/.eslintrc new file mode 100644 index 00000000..a34cf283 --- /dev/null +++ b/node_modules/extend/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 20], + "eqeqeq": [2, "allow-null"], + "func-name-matching": [1], + "max-depth": [1, 4], + "max-statements": [2, 26], + "no-extra-parens": [1], + "no-magic-numbers": [0], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"], + "sort-keys": [0], + } +} diff --git a/node_modules/extend/.jscs.json b/node_modules/extend/.jscs.json new file mode 100644 index 00000000..3cce01d7 --- /dev/null +++ b/node_modules/extend/.jscs.json @@ -0,0 +1,175 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 6 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": false, + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/extend/.travis.yml b/node_modules/extend/.travis.yml new file mode 100644 index 00000000..5ccdfc49 --- /dev/null +++ b/node_modules/extend/.travis.yml @@ -0,0 +1,230 @@ +language: node_js +os: + - linux +node_js: + - "10.7" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/extend/CHANGELOG.md b/node_modules/extend/CHANGELOG.md new file mode 100644 index 00000000..2cf7de6f --- /dev/null +++ b/node_modules/extend/CHANGELOG.md @@ -0,0 +1,83 @@ +3.0.2 / 2018-07-19 +================== + * [Fix] Prevent merging `__proto__` property (#48) + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` + * [Tests] up to `node` `v10.7`, `v9.11`, `v8.11`, `v7.10`, `v6.14`, `v4.9`; use `nvm install-latest-npm` + +3.0.1 / 2017-04-27 +================== + * [Fix] deep extending should work with a non-object (#46) + * [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` + * [Tests] up to `node` `v7.9`, `v6.10`, `v4.8`; improve matrix + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. + * [Docs] Add example to readme (#34) + +3.0.0 / 2015-07-01 +================== + * [Possible breaking change] Use global "strict" directive (#32) + * [Tests] `int` is an ES3 reserved word + * [Tests] Test up to `io.js` `v2.3` + * [Tests] Add `npm run eslint` + * [Dev Deps] Update `covert`, `jscs` + +2.0.1 / 2015-04-25 +================== + * Use an inline `isArray` check, for ES3 browsers. (#27) + * Some old browsers fail when an identifier is `toString` + * Test latest `node` and `io.js` versions on `travis-ci`; speed up builds + * Add license info to package.json (#25) + * Update `tape`, `jscs` + * Adding a CHANGELOG + +2.0.0 / 2014-10-01 +================== + * Increase code coverage to 100%; run code coverage as part of tests + * Add `npm run lint`; Run linter as part of tests + * Remove nodeType and setInterval checks in isPlainObject + * Updating `tape`, `jscs`, `covert` + * General style and README cleanup + +1.3.0 / 2014-06-20 +================== + * Add component.json for browser support (#18) + * Use SVG for badges in README (#16) + * Updating `tape`, `covert` + * Updating travis-ci to work with multiple node versions + * Fix `deep === false` bug (returning target as {}) (#14) + * Fixing constructor checks in isPlainObject + * Adding additional test coverage + * Adding `npm run coverage` + * Add LICENSE (#13) + * Adding a warning about `false`, per #11 + * General style and whitespace cleanup + +1.2.1 / 2013-09-14 +================== + * Fixing hasOwnProperty bugs that would only have shown up in specific browsers. Fixes #8 + * Updating `tape` + +1.2.0 / 2013-09-02 +================== + * Updating the README: add badges + * Adding a missing variable reference. + * Using `tape` instead of `buster` for tests; add more tests (#7) + * Adding node 0.10 to Travis CI (#6) + * Enabling "npm test" and cleaning up package.json (#5) + * Add Travis CI. + +1.1.3 / 2012-12-06 +================== + * Added unit tests. + * Ensure extend function is named. (Looks nicer in a stack trace.) + * README cleanup. + +1.1.1 / 2012-11-07 +================== + * README cleanup. + * Added installation instructions. + * Added a missing semicolon + +1.0.0 / 2012-04-08 +================== + * Initial commit + diff --git a/node_modules/extend/LICENSE b/node_modules/extend/LICENSE new file mode 100644 index 00000000..e16d6a56 --- /dev/null +++ b/node_modules/extend/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2014 Stefan Thomas + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/extend/README.md b/node_modules/extend/README.md new file mode 100644 index 00000000..5b8249aa --- /dev/null +++ b/node_modules/extend/README.md @@ -0,0 +1,81 @@ +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] + +# extend() for Node.js [![Version Badge][npm-version-png]][npm-url] + +`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. + +Notes: + +* Since Node.js >= 4, + [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) + now offers the same functionality natively (but without the "deep copy" option). + See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). +* Some native implementations of `Object.assign` in both Node.js and many + browsers (since NPM modules are for the browser too) may not be fully + spec-compliant. + Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for + a compliant candidate. + +## Installation + +This package is available on [npm][npm-url] as: `extend` + +``` sh +npm install extend +``` + +## Usage + +**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** + +*Extend one object with one or more others, returning the modified object.* + +**Example:** + +``` js +var extend = require('extend'); +extend(targetObject, object1, object2); +``` + +Keep in mind that the target object will be modified, and will be returned from extend(). + +If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). +Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. +Warning: passing `false` as the first argument is not supported. + +### Arguments + +* `deep` *Boolean* (optional) +If set, the merge becomes recursive (i.e. deep copy). +* `target` *Object* +The object to extend. +* `object1` *Object* +The object that will be merged into the first. +* `objectN` *Object* (Optional) +More objects to merge into the first. + +## License + +`node-extend` is licensed under the [MIT License][mit-license-url]. + +## Acknowledgements + +All credit to the jQuery authors for perfecting this amazing utility. + +Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. + +[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg +[travis-url]: https://travis-ci.org/justmoon/node-extend +[npm-url]: https://npmjs.org/package/extend +[mit-license-url]: http://opensource.org/licenses/MIT +[github-justmoon]: https://github.com/justmoon +[github-insin]: https://github.com/insin +[github-ljharb]: https://github.com/ljharb +[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg +[deps-svg]: https://david-dm.org/justmoon/node-extend.svg +[deps-url]: https://david-dm.org/justmoon/node-extend +[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg +[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies + diff --git a/node_modules/extend/component.json b/node_modules/extend/component.json new file mode 100644 index 00000000..1500a2f3 --- /dev/null +++ b/node_modules/extend/component.json @@ -0,0 +1,32 @@ +{ + "name": "extend", + "author": "Stefan Thomas (http://www.justmoon.net)", + "version": "3.0.0", + "description": "Port of jQuery.extend for node.js and the browser.", + "scripts": [ + "index.js" + ], + "contributors": [ + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "keywords": [ + "extend", + "clone", + "merge" + ], + "repository" : { + "type": "git", + "url": "https://github.com/justmoon/node-extend.git" + }, + "dependencies": { + }, + "devDependencies": { + "tape" : "~3.0.0", + "covert": "~0.4.0", + "jscs": "~1.6.2" + } +} + diff --git a/node_modules/extend/index.js b/node_modules/extend/index.js new file mode 100644 index 00000000..2aa3faae --- /dev/null +++ b/node_modules/extend/index.js @@ -0,0 +1,117 @@ +'use strict'; + +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; +var defineProperty = Object.defineProperty; +var gOPD = Object.getOwnPropertyDescriptor; + +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; +}; + +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; + +// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target +var setProperty = function setProperty(target, options) { + if (defineProperty && options.name === '__proto__') { + defineProperty(target, options.name, { + enumerable: true, + configurable: true, + value: options.newValue, + writable: true + }); + } else { + target[options.name] = options.newValue; + } +}; + +// Return undefined instead of __proto__ if '__proto__' is not an own property +var getProperty = function getProperty(obj, name) { + if (name === '__proto__') { + if (!hasOwn.call(obj, name)) { + return void 0; + } else if (gOPD) { + // In early versions of node, obj['__proto__'] is buggy when obj has + // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. + return gOPD(obj, name).value; + } + } + + return obj[name]; +}; + +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = getProperty(target, name); + copy = getProperty(options, name); + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + setProperty(target, { name: name, newValue: copy }); + } + } + } + } + } + + // Return the modified object + return target; +}; diff --git a/node_modules/extend/package.json b/node_modules/extend/package.json new file mode 100644 index 00000000..85279f78 --- /dev/null +++ b/node_modules/extend/package.json @@ -0,0 +1,42 @@ +{ + "name": "extend", + "author": "Stefan Thomas (http://www.justmoon.net)", + "version": "3.0.2", + "description": "Port of jQuery.extend for node.js and the browser", + "main": "index", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npm run coverage-quiet", + "tests-only": "node test", + "coverage": "covert test/index.js", + "coverage-quiet": "covert test/index.js --quiet", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js" + }, + "contributors": [ + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "keywords": [ + "extend", + "clone", + "merge" + ], + "repository": { + "type": "git", + "url": "https://github.com/justmoon/node-extend.git" + }, + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.19.1", + "jscs": "^3.0.7", + "tape": "^4.9.1" + }, + "license": "MIT" +} diff --git a/node_modules/hast-util-to-jsx-runtime/index.d.ts b/node_modules/hast-util-to-jsx-runtime/index.d.ts new file mode 100644 index 00000000..701b8e47 --- /dev/null +++ b/node_modules/hast-util-to-jsx-runtime/index.d.ts @@ -0,0 +1,18 @@ +export type { + Components, + CreateEvaluater, + ElementAttributeNameCase, + EvaluateExpression, + EvaluateProgram, + Evaluater, + ExtraProps, + Fragment, + Jsx, + JsxDev, + Options, + Props, + Source, + Space, + StylePropertyNameCase +} from './lib/types.js' +export {toJsxRuntime} from './lib/index.js' diff --git a/node_modules/hast-util-to-jsx-runtime/index.js b/node_modules/hast-util-to-jsx-runtime/index.js new file mode 100644 index 00000000..ead95828 --- /dev/null +++ b/node_modules/hast-util-to-jsx-runtime/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {toJsxRuntime} from './lib/index.js' diff --git a/node_modules/hast-util-to-jsx-runtime/license b/node_modules/hast-util-to-jsx-runtime/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/hast-util-to-jsx-runtime/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/hast-util-to-jsx-runtime/package.json b/node_modules/hast-util-to-jsx-runtime/package.json new file mode 100644 index 00000000..c153b338 --- /dev/null +++ b/node_modules/hast-util-to-jsx-runtime/package.json @@ -0,0 +1,138 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/hast-util-to-jsx-runtime/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "description": "hast utility to transform to preact, react, solid, svelte, vue, etc", + "devDependencies": { + "@types/node": "^22.0.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "c8": "^10.0.0", + "esbuild": "^0.25.0", + "estree-util-visit": "^2.0.0", + "hastscript": "^9.0.0", + "prettier": "^3.0.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "sval": "^0.6.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "hast-util", + "hast", + "html", + "preact", + "react", + "solid", + "svelte", + "unist", + "utility", + "util", + "vue" + ], + "license": "MIT", + "name": "hast-util-to-jsx-runtime", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/hast-util-to-jsx-runtime", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "generate": "esbuild --bundle --format=esm --minify --outfile=example/hast-util-to-jsx-runtime.min.js --target=es2020 .", + "prepack": "npm run build && npm run format", + "test-api": "node --conditions development test/index.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "ignoreFiles": [ + "example/**/*.js" + ], + "strict": true + }, + "type": "module", + "version": "2.3.6", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-ts-comment": 0, + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off", + "unicorn/prevent-abbreviations": "off" + } + } +} diff --git a/node_modules/hast-util-to-jsx-runtime/readme.md b/node_modules/hast-util-to-jsx-runtime/readme.md new file mode 100644 index 00000000..c04f7c79 --- /dev/null +++ b/node_modules/hast-util-to-jsx-runtime/readme.md @@ -0,0 +1,886 @@ +# hast-util-to-jsx-runtime + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +hast utility to transform a tree to +preact, react, solid, svelte, vue, etcetera, +with an automatic JSX runtime. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`toJsxRuntime(tree, options)`](#tojsxruntimetree-options) + * [`Components`](#components) + * [`CreateEvaluater`](#createevaluater) + * [`ElementAttributeNameCase`](#elementattributenamecase) + * [`EvaluateExpression`](#evaluateexpression) + * [`EvaluateProgram`](#evaluateprogram) + * [`Evaluater`](#evaluater) + * [`ExtraProps`](#extraprops) + * [`Fragment`](#fragment) + * [`Jsx`](#jsx) + * [`JsxDev`](#jsxdev) + * [`Options`](#options) + * [`Props`](#props) + * [`Source`](#source) + * [`Space`](#space) + * [`StylePropertyNameCase`](#stylepropertynamecase) +* [Errors](#errors) +* [Examples](#examples) + * [Example: Preact](#example-preact) + * [Example: Solid](#example-solid) + * [Example: Svelte](#example-svelte) + * [Example: Vue](#example-vue) +* [Syntax](#syntax) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that takes a [hast][github-hast] tree and an +[automatic JSX runtime][reactjs-jsx-runtime] and turns the tree into anything +you wish. + +## When should I use this? + +You can use this package when you have a hast syntax tree and want to use it +with whatever framework. + +This package uses an automatic JSX runtime, +which is a sort of lingua franca for frameworks to support JSX. + +Notably, +automatic runtimes have support for passing extra information in development, +and have guaranteed support for fragments. + +## Install + +This package is [ESM only][github-gist-esm]. +In Node.js (version 16+), +install with [npm][npmjs-install]: + +```sh +npm install hast-util-to-jsx-runtime +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {toJsxRuntime} from 'https://esm.sh/hast-util-to-jsx-runtime@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {h} from 'hastscript' +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' +import {Fragment, jsxs, jsx} from 'react/jsx-runtime' +import {renderToStaticMarkup} from 'react-dom/server' + +const tree = h('h1', 'Hello, world!') + +const doc = renderToStaticMarkup(toJsxRuntime(tree, {Fragment, jsxs, jsx})) + +console.log(doc) +``` + +Yields: + +```html +

Hello, world!

+``` + +> **Note**: +> to add better type support, +> register a global JSX namespace: +> +> ```ts +> import type {JSX as Jsx} from 'react/jsx-runtime' +> +> declare global { +> namespace JSX { +> type ElementClass = Jsx.ElementClass +> type Element = Jsx.Element +> type IntrinsicElements = Jsx.IntrinsicElements +> } +> } +> ``` + +## API + +This package exports the identifier [`toJsxRuntime`][api-to-jsx-runtime]. +It exports the [TypeScript][] types +[`Components`][api-components], +[`CreateEvaluater`][api-create-evaluater], +[`ElementAttributeNameCase`][api-element-attribute-name-case], +[`EvaluateExpression`][api-evaluate-expression], +[`EvaluateProgram`][api-evaluate-program], +[`Evaluater`][api-evaluater], +[`ExtraProps`][api-extra-props], +[`Fragment`][api-fragment], +[`Jsx`][api-jsx], +[`JsxDev`][api-jsx-dev], +[`Options`][api-options], +[`Props`][api-props], +[`Source`][api-source], +[`Space`][api-Space], +and +[`StylePropertyNameCase`][api-style-property-name-case]. +There is no default export. + +### `toJsxRuntime(tree, options)` + +Transform a hast tree to +preact, react, solid, svelte, vue, etcetera, +with an automatic JSX runtime. + +##### Parameters + +* `tree` + ([`Node`][github-hast-nodes]) + — tree to transform +* `options` + ([`Options`][api-options], required) + — configuration + +##### Returns + +Result from your configured JSX runtime +(`JSX.Element` if defined, +otherwise `unknown` which you can cast yourself). + +### `Components` + +Possible components to use (TypeScript type). + +Each key is a tag name typed in `JSX.IntrinsicElements`, +if defined. +Each value is either a different tag name +or a component accepting the corresponding props +(and an optional `node` prop if `passNode` is on). + +You can access props at `JSX.IntrinsicElements`. +For example, +to find props for `a`, +use `JSX.IntrinsicElements['a']`. + +###### Type + +```ts +import type {Element} from 'hast' + +type ExtraProps = {node?: Element | undefined} + +type Components = { + [TagName in keyof JSX.IntrinsicElements]: + | Component + | keyof JSX.IntrinsicElements +} + +type Component = + // Class component: + | (new (props: ComponentProps) => JSX.ElementClass) + // Function component: + | ((props: ComponentProps) => JSX.Element | string | null | undefined) +``` + +### `CreateEvaluater` + +Create an evaluator that turns ESTree ASTs from embedded MDX into values +(TypeScript type). + +###### Parameters + +There are no parameters. + +###### Returns + +Evaluater ([`Evaluater`][api-evaluater]). + +### `ElementAttributeNameCase` + +Casing to use for attribute names (TypeScript type). + +HTML casing is for example +`class`, `stroke-linecap`, `xml:lang`. +React casing is for example +`className`, `strokeLinecap`, `xmlLang`. + +###### Type + +```ts +type ElementAttributeNameCase = 'html' | 'react' +``` + +### `EvaluateExpression` + +Turn an MDX expression into a value (TypeScript type). + +###### Parameters + +* `expression` (`Expression` from `@types/estree`) + — estree expression + +###### Returns + +Result of expression (`unknown`). + +### `EvaluateProgram` + +Turn an MDX program (export/import statements) into a value (TypeScript type). + +###### Parameters + +* `program` (`Program` from `@types/estree`) + — estree program + +###### Returns + +Result of program (`unknown`); +should likely be `undefined` as ESM changes the scope but doesn’t yield +something. + +### `Evaluater` + +Evaluator that turns ESTree ASTs from embedded MDX into values (TypeScript +type). + +###### Fields + +* `evaluateExpression` ([`EvaluateExpression`][api-evaluate-expression]) + — evaluate an expression +* `evaluateProgram` ([`EvaluateProgram`][api-evaluate-program]) + — evaluate a program + +### `ExtraProps` + +Extra fields we pass (TypeScript type). + +###### Type + +```ts +type ExtraProps = {node?: Element | undefined} +``` + +### `Fragment` + +Represent the children, +typically a symbol (TypeScript type). + +###### Type + +```ts +type Fragment = unknown +``` + +### `Jsx` + +Create a production element (TypeScript type). + +###### Parameters + +* `type` (`unknown`) + — element type: + `Fragment` symbol, + tag name (`string`), + component +* `props` ([`Props`][api-props]) + — element props, + `children`, + and maybe `node` +* `key` (`string` or `undefined`) + — dynamicly generated key to use + +###### Returns + +Element from your framework +(`JSX.Element` if defined, +otherwise `unknown` which you can cast yourself). + +### `JsxDev` + +Create a development element (TypeScript type). + +###### Parameters + +* `type` (`unknown`) + — element type: + `Fragment` symbol, + tag name (`string`), + component +* `props` ([`Props`][api-props]) + — element props, + `children`, + and maybe `node` +* `key` (`string` or `undefined`) + — dynamicly generated key to use +* `isStaticChildren` (`boolean`) + — whether two or more children are passed (in an array), + which is whether `jsxs` or `jsx` would be used +* `source` ([`Source`][api-source]) + — info about source +* `self` (`undefined`) + — nothing (this is used by frameworks that have components, + we don’t) + +###### Returns + +Element from your framework +(`JSX.Element` if defined, +otherwise `unknown` which you can cast yourself). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `Fragment` ([`Fragment`][api-fragment], required) + — fragment +* `jsxDEV` ([`JsxDev`][api-jsx-dev], required in development) + — development JSX +* `jsxs` ([`Jsx`][api-jsx], required in production) + — static JSX +* `jsx` ([`Jsx`][api-jsx], required in production) + — dynamic JSX +* `components` ([`Partial`][api-components], optional) + — components to use +* `createEvaluater` ([`CreateEvaluater`][api-create-evaluater], optional) + — create an evaluator that turns ESTree ASTs into values +* `development` (`boolean`, default: `false`) + — whether to use `jsxDEV` when on or `jsx` and `jsxs` when off +* `elementAttributeNameCase` + ([`ElementAttributeNameCase`][api-element-attribute-name-case], + default: `'react'`) + — specify casing to use for attribute names +* `filePath` (`string`, optional) + — file path to the original source file, + passed in source info to `jsxDEV` when using the automatic runtime with + `development: true` +* `passNode` (`boolean`, default: `false`) + — pass the hast element node to components +* `space` ([`Space`][api-space], default: `'html'`) + — whether `tree` is in the `'html'` or `'svg'` space, when an `` + element is found in the HTML space, + this package already automatically switches to and from the SVG space when + entering and exiting it +* `stylePropertyNameCase` + ([`StylePropertyNameCase`][api-style-property-name-case], + default: `'dom'`) + — specify casing to use for property names in `style` objects +* `tableCellAlignToStyle` + (`boolean`, default: `true`) + — turn obsolete `align` props on `td` and `th` into CSS `style` props + +### `Props` + +Properties and children (TypeScript type). + +###### Type + +```ts +import type {Element} from 'hast' + +type Props = { + [prop: string]: + | Array // For `children`. + | Record // For `style`. + | Element // For `node`. + | boolean + | number + | string + | undefined + children: Array | undefined + node?: Element | undefined +} +``` + +### `Source` + +Info about source (TypeScript type). + +###### Fields + +* `columnNumber` (`number` or `undefined`) + — column where thing starts (0-indexed) +* `fileName` (`string` or `undefined`) + — name of source file +* `lineNumber` (`number` or `undefined`) + — line where thing starts (1-indexed) + +### `Space` + +Namespace (TypeScript type). + +> 👉 **Note**: +> hast is not XML; +> it supports SVG as embedded in HTML; +> it does not support the features available in XML; +> passing SVG might break but fragments of modern SVG should be fine; +> use `xast` if you need to support SVG as XML. + +###### Type + +```ts +type Space = 'html' | 'svg' +``` + +### `StylePropertyNameCase` + +Casing to use for property names in `style` objects (TypeScript type). + +CSS casing is for example `background-color` and `-webkit-line-clamp`. +DOM casing is for example `backgroundColor` and `WebkitLineClamp`. + +###### Type + +```ts +type StylePropertyNameCase = 'css' | 'dom' +``` + +## Errors + +The following errors are thrown: + +###### ``Expected `Fragment` in options`` + +This error is thrown when either `options` is not passed at all or +when `options.Fragment` is `undefined`. + +The automatic JSX runtime needs a symbol for a fragment to work. + +To solve the error, +make sure you are passing the correct fragment symbol from your framework. + +###### `` Expected `jsxDEV` in options when `development: true` `` + +This error is thrown when `options.development` is turned on (`true`), +but when `options.jsxDEV` is not a function. + +The automatic JSX runtime, +in development, +needs this function. + +To solve the error, +make sure you are importing the correct runtime functions +(for example, `'react/jsx-dev-runtime'`), +and pass `jsxDEV`. + +###### ``Expected `jsx` in production options`` + +###### ``Expected `jsxs` in production options`` + +These errors are thrown when `options.development` is *not* turned on +(`false` or not defined), +and when `options.jsx` or `options.jsxs` are not functions. + +The automatic JSX runtime, +in production, +needs these functions. + +To solve the error, +make sure you are importing the correct runtime functions +(for example, `'react/jsx-runtime'`), +and pass `jsx` and `jsxs`. + +###### `` Cannot handle MDX estrees without `createEvaluater` `` + +This error is thrown when MDX nodes are passed that represent JavaScript +programs or expressions. + +Supporting JavaScript can be unsafe and requires a different project. +To support JavaScript, +pass a `createEvaluater` function in `options`. + +###### ``Cannot parse `style` attribute`` + +This error is thrown when a `style` attribute is found on an element, +which cannot be parsed as CSS. + +Most frameworks don’t accept `style` as a string, +so we need to parse it as CSS, +and pass it as an object. +But when broken CSS is used, +such as `style="color:red; /*"`, +we crash. + +To solve the error, +make sure authors write valid CSS. +Alternatively, +pass `options.ignoreInvalidStyle: true` to swallow these errors. + +## Examples + +### Example: Preact + +> 👉 **Note**: +> you must set `elementAttributeNameCase: 'html'` for preact. + +In Node.js, +do: + +```js +import {h} from 'hastscript' +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' +import {Fragment, jsx, jsxs} from 'preact/jsx-runtime' +import {render} from 'preact-render-to-string' + +const result = render( + toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html' + }) +) + +console.log(result) +``` + +Yields: + +```html +

hi!

+``` + +In a browser, +do: + +```js +import {h} from 'https://esm.sh/hastscript@9' +import {toJsxRuntime} from 'https://esm.sh/hast-util-to-jsx-runtime@2' +import {Fragment, jsx, jsxs} from 'https://esm.sh/preact@10/jsx-runtime' +import {render} from 'https://esm.sh/preact@10' + +render( + toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html' + }), + document.getElementById('root') +) +``` + +To add better type support, +register a global JSX namespace: + +```ts +import type {JSX as Jsx} from 'preact/jsx-runtime' + +declare global { + namespace JSX { + type ElementClass = Jsx.ElementClass + type Element = Jsx.Element + type IntrinsicElements = Jsx.IntrinsicElements + } +} +``` + +### Example: Solid + +> 👉 **Note**: +> you must set `elementAttributeNameCase: 'html'` and +> `stylePropertyNameCase: 'css'` for Solid. + +In Node.js, +do: + +```js +import {h} from 'hastscript' +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' +import {Fragment, jsx, jsxs} from 'solid-jsx/jsx-runtime' + +console.log( + toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html', + stylePropertyNameCase: 'css' + }).t +) +``` + +Yields: + +```html +

hi!

+``` + +In a browser, +do: + +```js +import {h} from 'https://esm.sh/hastscript@9' +import {toJsxRuntime} from 'https://esm.sh/hast-util-to-jsx-runtime@2' +import {Fragment, jsx, jsxs} from 'https://esm.sh/solid-js@1/h/jsx-runtime' +import {render} from 'https://esm.sh/solid-js@1/web' + +render(Component, document.getElementById('root')) + +function Component() { + return toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html', + stylePropertyNameCase: 'css' + }) +} +``` + +To add better type support, +register a global JSX namespace: + +```ts +import type {JSX as Jsx} from 'solid-js/jsx-runtime' + +declare global { + namespace JSX { + type ElementClass = Jsx.ElementClass + type Element = Jsx.Element + type IntrinsicElements = Jsx.IntrinsicElements + } +} +``` + +### Example: Svelte + + + +I have no clue how to render a Svelte component in Node, +but you can get that component with: + +```js +import {h} from 'hastscript' +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' +import {Fragment, jsx, jsxs} from 'svelte-jsx' + +const svelteComponent = toJsxRuntime(h('h1', 'hi!'), {Fragment, jsx, jsxs}) + +console.log(svelteComponent) +``` + +Yields: + +```text +[class Component extends SvelteComponent] +``` + +Types for Svelte are broken. +Raise it with Svelte. + +### Example: Vue + +> 👉 **Note**: +> you must set `elementAttributeNameCase: 'html'` for Vue. + +In Node.js, +do: + +```js +import serverRenderer from '@vue/server-renderer' +import {h} from 'hastscript' +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' +import {Fragment, jsx, jsxs} from 'vue/jsx-runtime' // Available since `vue@3.3`. + +console.log( + await serverRenderer.renderToString( + toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html' + }) + ) +) +``` + +Yields: + +```html +

hi!

+``` + +In a browser, +do: + +```js +import {h} from 'https://esm.sh/hastscript@9' +import {toJsxRuntime} from 'https://esm.sh/hast-util-to-jsx-runtime@2' +import {createApp} from 'https://esm.sh/vue@3' +import {Fragment, jsx, jsxs} from 'https://esm.sh/vue@3/jsx-runtime' + +createApp(Component).mount('#root') + +function Component() { + return toJsxRuntime(h('h1', 'hi!'), { + Fragment, + jsx, + jsxs, + elementAttributeNameCase: 'html' + }) +} +``` + +To add better type support, +register a global JSX namespace: + +```ts +import type {JSX as Jsx} from 'vue/jsx-runtime' + +declare global { + namespace JSX { + type ElementClass = Jsx.ElementClass + type Element = Jsx.Element + type IntrinsicElements = Jsx.IntrinsicElements + } +} +``` + +## Syntax + +HTML is parsed according to WHATWG HTML (the living standard), +which is also followed by browsers such as Chrome, +Firefox, +and Safari. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, +we drop support for unmaintained versions of Node. +This means we try to keep the current release line, +`hast-util-to-jsx-runtime@2`, +compatible with Node.js 16. + +## Security + +Be careful with user input in your hast tree. +Use [`hast-util-santize`][github-hast-util-sanitize] to make hast trees safe. + +## Related + +* [`hastscript`](https://github.com/syntax-tree/hastscript) + — build hast trees +* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html) + — serialize hast as HTML +* [`hast-util-sanitize`][github-hast-util-sanitize] + — sanitize hast + +## Contribute + +See [`contributing.md`][health-contributing] +in +[`syntax-tree/.github`][health] +for ways to get started. +See [`support.md`][health-support] for ways to get help. + +This project has a [code of conduct][health-coc]. +By interacting with this repository, +organization, +or community you agree to abide by its terms. + +## License + +[MIT][file-license] © [Titus Wormer][wooorm] + + + +[api-components]: #components + +[api-create-evaluater]: #createevaluater + +[api-element-attribute-name-case]: #elementattributenamecase + +[api-evaluate-expression]: #evaluateexpression + +[api-evaluate-program]: #evaluateprogram + +[api-evaluater]: #evaluater + +[api-extra-props]: #extraprops + +[api-fragment]: #fragment + +[api-jsx]: #jsx + +[api-jsx-dev]: #jsxdev + +[api-options]: #options + +[api-props]: #props + +[api-source]: #source + +[api-space]: #space + +[api-style-property-name-case]: #stylepropertynamecase + +[api-to-jsx-runtime]: #tojsxruntimetree-options + +[badge-build-image]: https://github.com/syntax-tree/hast-util-to-jsx-runtime/workflows/main/badge.svg + +[badge-build-url]: https://github.com/syntax-tree/hast-util-to-jsx-runtime/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-to-jsx-runtime.svg + +[badge-coverage-url]: https://codecov.io/github/syntax-tree/hast-util-to-jsx-runtime + +[badge-downloads-image]: https://img.shields.io/npm/dm/hast-util-to-jsx-runtime.svg + +[badge-downloads-url]: https://www.npmjs.com/package/hast-util-to-jsx-runtime + +[badge-size-image]: https://img.shields.io/bundlejs/size/hast-util-to-jsx-runtime + +[badge-size-url]: https://bundlejs.com/?q=hast-util-to-jsx-runtime + +[esmsh]: https://esm.sh + +[file-license]: license + +[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[github-hast]: https://github.com/syntax-tree/hast + +[github-hast-nodes]: https://github.com/syntax-tree/hast#nodes + +[github-hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[health]: https://github.com/syntax-tree/.github + +[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[npmjs-install]: https://docs.npmjs.com/cli/install + +[reactjs-jsx-runtime]: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html + +[typescript]: https://www.typescriptlang.org + +[wooorm]: https://wooorm.com diff --git a/node_modules/hast-util-whitespace/index.d.ts b/node_modules/hast-util-whitespace/index.d.ts new file mode 100644 index 00000000..46e7b491 --- /dev/null +++ b/node_modules/hast-util-whitespace/index.d.ts @@ -0,0 +1 @@ +export { whitespace } from "./lib/index.js"; diff --git a/node_modules/hast-util-whitespace/index.js b/node_modules/hast-util-whitespace/index.js new file mode 100644 index 00000000..812fc6d5 --- /dev/null +++ b/node_modules/hast-util-whitespace/index.js @@ -0,0 +1 @@ +export {whitespace} from './lib/index.js' diff --git a/node_modules/hast-util-whitespace/license b/node_modules/hast-util-whitespace/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/hast-util-whitespace/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/hast-util-whitespace/package.json b/node_modules/hast-util-whitespace/package.json new file mode 100644 index 00000000..f8c082bd --- /dev/null +++ b/node_modules/hast-util-whitespace/package.json @@ -0,0 +1,83 @@ +{ + "name": "hast-util-whitespace", + "version": "3.0.0", + "description": "hast utility to check if a node is inter-element whitespace", + "license": "MIT", + "keywords": [ + "unist", + "hast", + "hast-util", + "util", + "utility", + "html", + "inter", + "element", + "inter-element", + "white-space", + "whitespace" + ], + "repository": "syntax-tree/hast-util-whitespace", + "bugs": "https://github.com/syntax-tree/hast-util-whitespace/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/hast": "^3.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.55.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/hast-util-whitespace/readme.md b/node_modules/hast-util-whitespace/readme.md new file mode 100644 index 00000000..a23d12fa --- /dev/null +++ b/node_modules/hast-util-whitespace/readme.md @@ -0,0 +1,231 @@ +# hast-util-whitespace + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[hast][] utility to check if a node is [*inter-element whitespace*][spec]. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`whitespace(thing)`](#whitespacething) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a small utility that checks if a node is whitespace according to +HTML. + +## When should I use this? + +This utility is super niche, if you’re here you probably know what you’re +looking for! + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install hast-util-whitespace +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {whitespace} from 'https://esm.sh/hast-util-whitespace@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {whitespace} from 'hast-util-whitespace' + +whitespace({ + type: 'element', + tagName: 'div', + properties: {}, + children: [] +}) // => false + +whitespace({ + type: 'text', + value: '\t \n' +}) // => true + +whitespace({ + type: 'text', + value: ' text\f' +}) // => false +``` + +## API + +This package exports the identifier [`whitespace`][api-whitespace]. +There is no default export. + +### `whitespace(thing)` + +Check if the given value is [*inter-element whitespace*][spec]. + +###### Parameters + +* `thing` ([`Node`][node] or `string`, optional) + — thing to check + +###### Returns + +Whether the `value` is inter-element whitespace (`boolean`): consisting of zero +or more of space, tab (`\t`), line feed (`\n`), carriage return (`\r`), or form +feed (`\f`). +If a node is passed it must be a [`Text`][text] node, whose `value` field is +checked. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `hast-util-whitespace@^3`, +compatible with Node.js 16. + +## Security + +`hast-util-whitespace` does not change the syntax tree so there are no openings +for [cross-site scripting (XSS)][xss] attacks. + +## Related + +* [`hast-util-is-element`](https://github.com/syntax-tree/hast-util-is-element) + — check if a node is a (certain) element +* [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property) + — check if a node has a property +* [`hast-util-transparent`](https://github.com/syntax-tree/hast-util-transparent) + — check if a node is a transparent element +* [`hast-util-heading`](https://github.com/syntax-tree/hast-util-heading) + — check if a node is a heading element +* [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable) + — check whether a node is labelable +* [`hast-util-phrasing`](https://github.com/syntax-tree/hast-util-phrasing) + — check if a node is phrasing content +* [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded) + — check if a node is an embedded element +* [`hast-util-sectioning`](https://github.com/syntax-tree/hast-util-sectioning) + — check if a node is a sectioning element +* [`hast-util-interactive`](https://github.com/syntax-tree/hast-util-interactive) + — check if a node is interactive +* [`hast-util-script-supporting`](https://github.com/syntax-tree/hast-util-script-supporting) + — check if a node is a script-supporting element +* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link) + — check if a node is “Body OK” link element +* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment) + — check if a node is a conditional comment +* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link) + — check if a node is a CSS link element +* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style) + — check if a node is a CSS style element +* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript) + — check if a node is a JavaScript script element + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/hast-util-whitespace/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/hast-util-whitespace/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-whitespace.svg + +[coverage]: https://codecov.io/github/syntax-tree/hast-util-whitespace + +[downloads-badge]: https://img.shields.io/npm/dm/hast-util-whitespace.svg + +[downloads]: https://www.npmjs.com/package/hast-util-whitespace + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-whitespace + +[size]: https://bundlejs.com/?q=hast-util-whitespace + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[hast]: https://github.com/syntax-tree/hast + +[spec]: https://html.spec.whatwg.org/multipage/dom.html#inter-element-whitespace + +[node]: https://github.com/syntax-tree/hast#nodes + +[text]: https://github.com/syntax-tree/hast#text + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[api-whitespace]: #whitespacething diff --git a/node_modules/html-url-attributes/index.d.ts b/node_modules/html-url-attributes/index.d.ts new file mode 100644 index 00000000..b4be389c --- /dev/null +++ b/node_modules/html-url-attributes/index.d.ts @@ -0,0 +1,2 @@ +export { urlAttributes } from "./lib/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/html-url-attributes/index.d.ts.map b/node_modules/html-url-attributes/index.d.ts.map new file mode 100644 index 00000000..ca7a93a9 --- /dev/null +++ b/node_modules/html-url-attributes/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/html-url-attributes/index.js b/node_modules/html-url-attributes/index.js new file mode 100644 index 00000000..499d0136 --- /dev/null +++ b/node_modules/html-url-attributes/index.js @@ -0,0 +1,33 @@ +/** + * Utility with info on URL attributes. + * + * ## What is this? + * + * This package contains info on attributes that have URLs as values. + * + * ## When should I use this? + * + * You can use this package any time you’re rewriting URLs. + * + * ## Use + * + * ```js + * import {urlAttributes} from 'html-url-attributes' + * + * console.log(urlAttributes.formAction) + * //=> ['button', 'input'] + * console.log(urlAttributes.href) + * //=> ['a', 'area', 'base', 'link'] + * ``` + * + * ## API + * + * ### `urlAttributes` + * + * HTML URL properties (`Record | null>`). + * + * Each key is a property name and each value is a list of tag names it applies + * to or `null` if it applies to all elements. + */ + +export {urlAttributes} from './lib/index.js' diff --git a/node_modules/html-url-attributes/license b/node_modules/html-url-attributes/license new file mode 100644 index 00000000..e7a45ac7 --- /dev/null +++ b/node_modules/html-url-attributes/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/html-url-attributes/package.json b/node_modules/html-url-attributes/package.json new file mode 100644 index 00000000..1f328bfc --- /dev/null +++ b/node_modules/html-url-attributes/package.json @@ -0,0 +1,45 @@ +{ + "name": "html-url-attributes", + "version": "3.0.1", + "description": "Map of URL attributes in HTML", + "license": "MIT", + "keywords": [ + "attribute", + "attribute", + "html", + "property", + "url" + ], + "repository": "https://github.com/rehypejs/rehype-minify/tree/main/packages/html-url-attributes", + "bugs": "https://github.com/rehypejs/rehype-minify/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer " + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.d.ts.map", + "index.js", + "lib/" + ], + "scripts": {}, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "capitalized-comments": "off" + } + } +} diff --git a/node_modules/html-url-attributes/readme.md b/node_modules/html-url-attributes/readme.md new file mode 100644 index 00000000..1d1d3ed4 --- /dev/null +++ b/node_modules/html-url-attributes/readme.md @@ -0,0 +1,180 @@ + + +# html-url-attributes + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][funding-sponsors-badge]][funding] +[![Backers][funding-backers-badge]][funding] +[![Chat][chat-badge]][chat] + +Utility with info on URL attributes. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`urlAttributes`](#urlattributes) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains info on attributes that have URLs as values. + +## When should I use this? + +You can use this package any time you’re rewriting URLs. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install html-url-attributes +``` + +In Deno with [`esm.sh`][esm-sh]: + +```js +import {urlAttributes} from 'https://esm.sh/html-url-attributes@3' +``` + +In browsers with [`esm.sh`][esm-sh]: + +```html + +``` + +## Use + +```js +import {urlAttributes} from 'html-url-attributes' + +console.log(urlAttributes.formAction) +//=> ['button', 'input'] +console.log(urlAttributes.href) +//=> ['a', 'area', 'base', 'link'] +``` + +## API + +This package exports the identifier +`urlAttributes`. +There is no default export. + +### `urlAttributes` + +HTML URL properties (`Record | null>`). + +Each key is a property name and each value is a list of tag names it applies +to or `null` if it applies to all elements. + +## Syntax + +HTML is parsed according to WHATWG HTML (the living standard), which is also +followed by all browsers. + +## Syntax tree + +The syntax tree used is [hast][]. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`html-url-attributes@^3`, +compatible with Node.js 16. + +## Security + +As **rehype** works on HTML and improper use of HTML can open you up to a +[cross-site scripting (XSS)][xss] attack, use of rehype can also be unsafe. +Use [`rehype-sanitize`][rehype-sanitize] to make the tree safe. + +## Contribute + +See [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[author]: https://wooorm.com + +[build]: https://github.com/rehypejs/rehype-minify/actions + +[build-badge]: https://github.com/rehypejs/rehype-minify/workflows/main/badge.svg + +[chat]: https://github.com/rehypejs/rehype/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md + +[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/rehypejs/rehype-minify + +[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg + +[downloads]: https://www.npmjs.com/package/html-url-attributes + +[downloads-badge]: https://img.shields.io/npm/dm/html-url-attributes.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esm-sh]: https://esm.sh + +[funding]: https://opencollective.com/unified + +[funding-backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[funding-sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[hast]: https://github.com/syntax-tree/hast + +[health]: https://github.com/rehypejs/.github + +[license]: https://github.com/rehypejs/rehype-minify/blob/main/license + +[npm]: https://docs.npmjs.com/cli/install + +[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[size]: https://bundlejs.com/?q=html-url-attributes + +[size-badge]: https://img.shields.io/bundlejs/size/html-url-attributes + +[support]: https://github.com/rehypejs/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting diff --git a/node_modules/inline-style-parser/LICENSE b/node_modules/inline-style-parser/LICENSE new file mode 100644 index 00000000..0239d9c6 --- /dev/null +++ b/node_modules/inline-style-parser/LICENSE @@ -0,0 +1,9 @@ +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/inline-style-parser/README.md b/node_modules/inline-style-parser/README.md new file mode 100644 index 00000000..fa69b0ba --- /dev/null +++ b/node_modules/inline-style-parser/README.md @@ -0,0 +1,229 @@ +# inline-style-parser + +[![NPM](https://nodei.co/npm/inline-style-parser.png)](https://nodei.co/npm/inline-style-parser/) + +[![NPM version](https://img.shields.io/npm/v/inline-style-parser)](https://www.npmjs.com/package/inline-style-parser) +[![NPM bundle size](https://img.shields.io/bundlephobia/minzip/inline-style-parser)](https://bundlephobia.com/package/inline-style-parser) +[![build](https://github.com/remarkablemark/inline-style-parser/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/inline-style-parser/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/remarkablemark/inline-style-parser/branch/master/graph/badge.svg?token=B8EEK5709W)](https://codecov.io/gh/remarkablemark/inline-style-parser) +[![NPM downloads](https://img.shields.io/npm/dm/inline-style-parser)](https://www.npmjs.com/package/inline-style-parser) + +Inline style parser copied from [`css/lib/parse/index.js`](https://github.com/reworkcss/css/blob/v2.2.4/lib/parse/index.js): + +``` +InlineStyleParser(string) +``` + +Example: + +```js +const parse = require('inline-style-parser'); + +parse('color: #BADA55;'); +``` + +Output: + +```js +[ { type: 'declaration', + property: 'color', + value: '#BADA55', + position: Position { start: [Object], end: [Object], source: undefined } } ] +``` + +[JSFiddle](https://jsfiddle.net/remarkablemark/hcxbpwq8/) | [Examples](https://github.com/remarkablemark/inline-style-parser/tree/master/examples) + +## Installation + +[NPM](https://www.npmjs.com/package/inline-style-parser): + +```sh +npm install inline-style-parser --save +``` + +[Yarn](https://yarnpkg.com/package/inline-style-parser): + +```sh +yarn add inline-style-parser +``` + +[CDN](https://unpkg.com/inline-style-parser/): + +```html + + +``` + +## Usage + +Import with ES Modules: + +```js +import parse from 'inline-style-parser'; +``` + +Or require with CommonJS: + +```js +const parse = require('inline-style-parser'); +``` + +Parse single declaration: + +```js +parse('left: 0'); +``` + +Output: + +```js +[ + { + type: 'declaration', + property: 'left', + value: '0', + position: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 8 }, + source: undefined + } + } +] +``` + +Parse multiple declarations: + +```js +parse('left: 0; right: 100px;'); +``` + +Output: + +```js +[ + { + type: 'declaration', + property: 'left', + value: '0', + position: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 8 }, + source: undefined + } + }, + { + type: 'declaration', + property: 'right', + value: '100px', + position: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 22 }, + source: undefined + } + } +] +``` + +Parse declaration with missing value: + +```js +parse('top:'); +``` + +Output: + +```js +[ + { + type: 'declaration', + property: 'top', + value: '', + position: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 5 }, + source: undefined + } + } +] +``` + +Parse unknown declaration: + +```js +parse('answer: 42;'); +``` + +Output: + +```js +[ + { + type: 'declaration', + property: 'answer', + value: '42', + position: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 11 }, + source: undefined + } + } +] +``` + +Invalid declarations: + +```js +parse(''); // [] +parse(); // throws TypeError +parse(1); // throws TypeError +parse('width'); // throws Error +parse('/*'); // throws Error +``` + +## Testing + +Run tests: + +```sh +npm test +``` + +Run tests in watch mode: + +```sh +npm run test:watch +``` + +Run tests with coverage: + +```sh +npm run test:coverage +``` + +Run tests in CI mode: + +```sh +npm run test:ci +``` + +Lint files: + +```sh +npm run lint +``` + +Fix lint errors: + +```sh +npm run lint:fix +``` + +## Release + +Release and publish are automated by [Release Please](https://github.com/googleapis/release-please). + +## License + +[MIT](https://github.com/remarkablemark/inline-style-parser/blob/master/LICENSE). See the [license](https://github.com/reworkcss/css/blob/v2.2.4/LICENSE) from the original project. diff --git a/node_modules/inline-style-parser/cjs/index.d.cts b/node_modules/inline-style-parser/cjs/index.d.cts new file mode 100644 index 00000000..5349435a --- /dev/null +++ b/node_modules/inline-style-parser/cjs/index.d.cts @@ -0,0 +1,34 @@ +interface Position { + start: { + line: number; + column: number; + }; + end: { + line: number; + column: number; + }; + source?: string; +} + +export interface Declaration { + type: 'declaration'; + property: string; + value: string; + position: Position; +} + +export interface Comment { + type: 'comment'; + comment: string; + position: Position; +} + +interface Options { + source?: string; + silent?: boolean; +} + +export default function InlineStyleParser( + style: string, + options?: Options +): (Declaration | Comment)[]; diff --git a/node_modules/inline-style-parser/cjs/index.js b/node_modules/inline-style-parser/cjs/index.js new file mode 100644 index 00000000..d57cabd2 --- /dev/null +++ b/node_modules/inline-style-parser/cjs/index.js @@ -0,0 +1,262 @@ +'use strict'; + +// http://www.w3.org/TR/CSS21/grammar.html +// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 +var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; + +var NEWLINE_REGEX = /\n/g; +var WHITESPACE_REGEX = /^\s*/; + +// declaration +var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; +var COLON_REGEX = /^:\s*/; +var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; +var SEMICOLON_REGEX = /^[;\s]*/; + +// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill +var TRIM_REGEX = /^\s+|\s+$/g; + +// strings +var NEWLINE = '\n'; +var FORWARD_SLASH = '/'; +var ASTERISK = '*'; +var EMPTY_STRING = ''; + +// types +var TYPE_COMMENT = 'comment'; +var TYPE_DECLARATION = 'declaration'; + +/** + * @param {String} style + * @param {Object} [options] + * @return {Object[]} + * @throws {TypeError} + * @throws {Error} + */ +function index (style, options) { + if (typeof style !== 'string') { + throw new TypeError('First argument must be a string'); + } + + if (!style) return []; + + options = options || {}; + + /** + * Positional. + */ + var lineno = 1; + var column = 1; + + /** + * Update lineno and column based on `str`. + * + * @param {String} str + */ + function updatePosition(str) { + var lines = str.match(NEWLINE_REGEX); + if (lines) lineno += lines.length; + var i = str.lastIndexOf(NEWLINE); + column = ~i ? str.length - i : column + str.length; + } + + /** + * Mark position and patch `node.position`. + * + * @return {Function} + */ + function position() { + var start = { line: lineno, column: column }; + return function (node) { + node.position = new Position(start); + whitespace(); + return node; + }; + } + + /** + * Store position information for a node. + * + * @constructor + * @property {Object} start + * @property {Object} end + * @property {undefined|String} source + */ + function Position(start) { + this.start = start; + this.end = { line: lineno, column: column }; + this.source = options.source; + } + + /** + * Non-enumerable source string. + */ + Position.prototype.content = style; + + /** + * Error `msg`. + * + * @param {String} msg + * @throws {Error} + */ + function error(msg) { + var err = new Error( + options.source + ':' + lineno + ':' + column + ': ' + msg + ); + err.reason = msg; + err.filename = options.source; + err.line = lineno; + err.column = column; + err.source = style; + + if (options.silent) ; else { + throw err; + } + } + + /** + * Match `re` and return captures. + * + * @param {RegExp} re + * @return {undefined|Array} + */ + function match(re) { + var m = re.exec(style); + if (!m) return; + var str = m[0]; + updatePosition(str); + style = style.slice(str.length); + return m; + } + + /** + * Parse whitespace. + */ + function whitespace() { + match(WHITESPACE_REGEX); + } + + /** + * Parse comments. + * + * @param {Object[]} [rules] + * @return {Object[]} + */ + function comments(rules) { + var c; + rules = rules || []; + while ((c = comment())) { + if (c !== false) { + rules.push(c); + } + } + return rules; + } + + /** + * Parse comment. + * + * @return {Object} + * @throws {Error} + */ + function comment() { + var pos = position(); + if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; + + var i = 2; + while ( + EMPTY_STRING != style.charAt(i) && + (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1)) + ) { + ++i; + } + i += 2; + + if (EMPTY_STRING === style.charAt(i - 1)) { + return error('End of comment missing'); + } + + var str = style.slice(2, i - 2); + column += 2; + updatePosition(str); + style = style.slice(i); + column += 2; + + return pos({ + type: TYPE_COMMENT, + comment: str + }); + } + + /** + * Parse declaration. + * + * @return {Object} + * @throws {Error} + */ + function declaration() { + var pos = position(); + + // prop + var prop = match(PROPERTY_REGEX); + if (!prop) return; + comment(); + + // : + if (!match(COLON_REGEX)) return error("property missing ':'"); + + // val + var val = match(VALUE_REGEX); + + var ret = pos({ + type: TYPE_DECLARATION, + property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), + value: val + ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) + : EMPTY_STRING + }); + + // ; + match(SEMICOLON_REGEX); + + return ret; + } + + /** + * Parse declarations. + * + * @return {Object[]} + */ + function declarations() { + var decls = []; + + comments(decls); + + // declarations + var decl; + while ((decl = declaration())) { + if (decl !== false) { + decls.push(decl); + comments(decls); + } + } + + return decls; + } + + whitespace(); + return declarations(); +} + +/** + * Trim `str`. + * + * @param {String} str + * @return {String} + */ +function trim(str) { + return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; +} + +module.exports = index; +//# sourceMappingURL=index.js.map diff --git a/node_modules/inline-style-parser/cjs/index.js.map b/node_modules/inline-style-parser/cjs/index.js.map new file mode 100644 index 00000000..4d532caf --- /dev/null +++ b/node_modules/inline-style-parser/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../index.js"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nexport default function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA,IAAI,aAAa,GAAG,iCAAiC;;AAErD,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,gBAAgB,GAAG,MAAM;;AAE7B;AACA,IAAI,cAAc,GAAG,wCAAwC;AAC7D,IAAI,WAAW,GAAG,OAAO;AACzB,IAAI,WAAW,GAAG,sDAAsD;AACxE,IAAI,eAAe,GAAG,SAAS;;AAE/B;AACA,IAAI,UAAU,GAAG,YAAY;;AAE7B;AACA,IAAI,OAAO,GAAG,IAAI;AAClB,IAAI,aAAa,GAAG,GAAG;AACvB,IAAI,QAAQ,GAAG,GAAG;AAClB,IAAI,YAAY,GAAG,EAAE;;AAErB;AACA,IAAI,YAAY,GAAG,SAAS;AAC5B,IAAI,gBAAgB,GAAG,aAAa;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,cAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;AACzC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACjC,IAAI,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC;AAC1D,EAAE;;AAEF,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;;AAEvB,EAAE,OAAO,GAAG,OAAO,IAAI,EAAE;;AAEzB;AACA;AACA;AACA,EAAE,IAAI,MAAM,GAAG,CAAC;AAChB,EAAE,IAAI,MAAM,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,cAAc,CAAC,GAAG,EAAE;AAC/B,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;AACxC,IAAI,IAAI,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM;AACrC,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;AACpC,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM;AACtD,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,GAAG;AACtB,IAAI,IAAI,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;AAChD,IAAI,OAAO,UAAU,IAAI,EAAE;AAC3B,MAAM,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC;AACzC,MAAM,UAAU,EAAE;AAClB,MAAM,OAAO,IAAI;AACjB,IAAI,CAAC;AACL,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;AAC3B,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK;AACtB,IAAI,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;AAC/C,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;AAChC,EAAE;;AAEF;AACA;AACA;AACA,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK;;AAIpC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,KAAK,CAAC,GAAG,EAAE;AACtB,IAAI,IAAI,GAAG,GAAG,IAAI,KAAK;AACvB,MAAM,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG;AAC5D,KAAK;AACL,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;AACpB,IAAI,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM;AACjC,IAAI,GAAG,CAAC,IAAI,GAAG,MAAM;AACrB,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM;AACvB,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK;;AAEtB,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAEnB,MAAM;AACX,MAAM,MAAM,GAAG;AACf,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,KAAK,CAAC,EAAE,EAAE;AACrB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,IAAI,IAAI,CAAC,CAAC,EAAE;AACZ,IAAI,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAClB,IAAI,cAAc,CAAC,GAAG,CAAC;AACvB,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;AACnC,IAAI,OAAO,CAAC;AACZ,EAAE;;AAEF;AACA;AACA;AACA,EAAE,SAAS,UAAU,GAAG;AACxB,IAAI,KAAK,CAAC,gBAAgB,CAAC;AAC3B,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;AAC3B,IAAI,IAAI,CAAC;AACT,IAAI,KAAK,GAAG,KAAK,IAAI,EAAE;AACvB,IAAI,QAAQ,CAAC,GAAG,OAAO,EAAE,GAAG;AAC5B,MAAM,IAAI,CAAC,KAAK,KAAK,EAAE;AACvB,QAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACrB,MAAM;AACN,IAAI;AACJ,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,OAAO,GAAG;AACrB,IAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;AACxB,IAAI,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;;AAEzE,IAAI,IAAI,CAAC,GAAG,CAAC;AACb,IAAI;AACJ,MAAM,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACrC,OAAO,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1E,MAAM;AACN,MAAM,EAAE,CAAC;AACT,IAAI;AACJ,IAAI,CAAC,IAAI,CAAC;;AAEV,IAAI,IAAI,YAAY,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;AAC9C,MAAM,OAAO,KAAK,CAAC,wBAAwB,CAAC;AAC5C,IAAI;;AAEJ,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACnC,IAAI,MAAM,IAAI,CAAC;AACf,IAAI,cAAc,CAAC,GAAG,CAAC;AACvB,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,IAAI,MAAM,IAAI,CAAC;;AAEf,IAAI,OAAO,GAAG,CAAC;AACf,MAAM,IAAI,EAAE,YAAY;AACxB,MAAM,OAAO,EAAE;AACf,KAAK,CAAC;AACN,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,WAAW,GAAG;AACzB,IAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;;AAExB;AACA,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC;AACpC,IAAI,IAAI,CAAC,IAAI,EAAE;AACf,IAAI,OAAO,EAAE;;AAEb;AACA,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,CAAC,sBAAsB,CAAC;;AAEjE;AACA,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;;AAEhC,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC;AAClB,MAAM,IAAI,EAAE,gBAAgB;AAC5B,MAAM,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAClE,MAAM,KAAK,EAAE;AACb,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC;AAC1D,UAAU;AACV,KAAK,CAAC;;AAEN;AACA,IAAI,KAAK,CAAC,eAAe,CAAC;;AAE1B,IAAI,OAAO,GAAG;AACd,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,YAAY,GAAG;AAC1B,IAAI,IAAI,KAAK,GAAG,EAAE;;AAElB,IAAI,QAAQ,CAAC,KAAK,CAAC;;AAEnB;AACA,IAAI,IAAI,IAAI;AACZ,IAAI,QAAQ,IAAI,GAAG,WAAW,EAAE,GAAG;AACnC,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE;AAC1B,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AACxB,QAAQ,QAAQ,CAAC,KAAK,CAAC;AACvB,MAAM;AACN,IAAI;;AAEJ,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,UAAU,EAAE;AACd,EAAE,OAAO,YAAY,EAAE;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI,CAAC,GAAG,EAAE;AACnB,EAAE,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,YAAY;AACnE;;;;"} \ No newline at end of file diff --git a/node_modules/inline-style-parser/esm/index.d.mts b/node_modules/inline-style-parser/esm/index.d.mts new file mode 100644 index 00000000..5349435a --- /dev/null +++ b/node_modules/inline-style-parser/esm/index.d.mts @@ -0,0 +1,34 @@ +interface Position { + start: { + line: number; + column: number; + }; + end: { + line: number; + column: number; + }; + source?: string; +} + +export interface Declaration { + type: 'declaration'; + property: string; + value: string; + position: Position; +} + +export interface Comment { + type: 'comment'; + comment: string; + position: Position; +} + +interface Options { + source?: string; + silent?: boolean; +} + +export default function InlineStyleParser( + style: string, + options?: Options +): (Declaration | Comment)[]; diff --git a/node_modules/inline-style-parser/esm/index.mjs b/node_modules/inline-style-parser/esm/index.mjs new file mode 100644 index 00000000..caf93084 --- /dev/null +++ b/node_modules/inline-style-parser/esm/index.mjs @@ -0,0 +1,260 @@ +// http://www.w3.org/TR/CSS21/grammar.html +// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 +var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; + +var NEWLINE_REGEX = /\n/g; +var WHITESPACE_REGEX = /^\s*/; + +// declaration +var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; +var COLON_REGEX = /^:\s*/; +var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; +var SEMICOLON_REGEX = /^[;\s]*/; + +// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill +var TRIM_REGEX = /^\s+|\s+$/g; + +// strings +var NEWLINE = '\n'; +var FORWARD_SLASH = '/'; +var ASTERISK = '*'; +var EMPTY_STRING = ''; + +// types +var TYPE_COMMENT = 'comment'; +var TYPE_DECLARATION = 'declaration'; + +/** + * @param {String} style + * @param {Object} [options] + * @return {Object[]} + * @throws {TypeError} + * @throws {Error} + */ +function index (style, options) { + if (typeof style !== 'string') { + throw new TypeError('First argument must be a string'); + } + + if (!style) return []; + + options = options || {}; + + /** + * Positional. + */ + var lineno = 1; + var column = 1; + + /** + * Update lineno and column based on `str`. + * + * @param {String} str + */ + function updatePosition(str) { + var lines = str.match(NEWLINE_REGEX); + if (lines) lineno += lines.length; + var i = str.lastIndexOf(NEWLINE); + column = ~i ? str.length - i : column + str.length; + } + + /** + * Mark position and patch `node.position`. + * + * @return {Function} + */ + function position() { + var start = { line: lineno, column: column }; + return function (node) { + node.position = new Position(start); + whitespace(); + return node; + }; + } + + /** + * Store position information for a node. + * + * @constructor + * @property {Object} start + * @property {Object} end + * @property {undefined|String} source + */ + function Position(start) { + this.start = start; + this.end = { line: lineno, column: column }; + this.source = options.source; + } + + /** + * Non-enumerable source string. + */ + Position.prototype.content = style; + + /** + * Error `msg`. + * + * @param {String} msg + * @throws {Error} + */ + function error(msg) { + var err = new Error( + options.source + ':' + lineno + ':' + column + ': ' + msg + ); + err.reason = msg; + err.filename = options.source; + err.line = lineno; + err.column = column; + err.source = style; + + if (options.silent) ; else { + throw err; + } + } + + /** + * Match `re` and return captures. + * + * @param {RegExp} re + * @return {undefined|Array} + */ + function match(re) { + var m = re.exec(style); + if (!m) return; + var str = m[0]; + updatePosition(str); + style = style.slice(str.length); + return m; + } + + /** + * Parse whitespace. + */ + function whitespace() { + match(WHITESPACE_REGEX); + } + + /** + * Parse comments. + * + * @param {Object[]} [rules] + * @return {Object[]} + */ + function comments(rules) { + var c; + rules = rules || []; + while ((c = comment())) { + if (c !== false) { + rules.push(c); + } + } + return rules; + } + + /** + * Parse comment. + * + * @return {Object} + * @throws {Error} + */ + function comment() { + var pos = position(); + if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; + + var i = 2; + while ( + EMPTY_STRING != style.charAt(i) && + (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1)) + ) { + ++i; + } + i += 2; + + if (EMPTY_STRING === style.charAt(i - 1)) { + return error('End of comment missing'); + } + + var str = style.slice(2, i - 2); + column += 2; + updatePosition(str); + style = style.slice(i); + column += 2; + + return pos({ + type: TYPE_COMMENT, + comment: str + }); + } + + /** + * Parse declaration. + * + * @return {Object} + * @throws {Error} + */ + function declaration() { + var pos = position(); + + // prop + var prop = match(PROPERTY_REGEX); + if (!prop) return; + comment(); + + // : + if (!match(COLON_REGEX)) return error("property missing ':'"); + + // val + var val = match(VALUE_REGEX); + + var ret = pos({ + type: TYPE_DECLARATION, + property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), + value: val + ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) + : EMPTY_STRING + }); + + // ; + match(SEMICOLON_REGEX); + + return ret; + } + + /** + * Parse declarations. + * + * @return {Object[]} + */ + function declarations() { + var decls = []; + + comments(decls); + + // declarations + var decl; + while ((decl = declaration())) { + if (decl !== false) { + decls.push(decl); + comments(decls); + } + } + + return decls; + } + + whitespace(); + return declarations(); +} + +/** + * Trim `str`. + * + * @param {String} str + * @return {String} + */ +function trim(str) { + return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; +} + +export { index as default }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/inline-style-parser/esm/index.mjs.map b/node_modules/inline-style-parser/esm/index.mjs.map new file mode 100644 index 00000000..1cdba351 --- /dev/null +++ b/node_modules/inline-style-parser/esm/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../index.js"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nexport default function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA,IAAI,aAAa,GAAG,iCAAiC;;AAErD,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,gBAAgB,GAAG,MAAM;;AAE7B;AACA,IAAI,cAAc,GAAG,wCAAwC;AAC7D,IAAI,WAAW,GAAG,OAAO;AACzB,IAAI,WAAW,GAAG,sDAAsD;AACxE,IAAI,eAAe,GAAG,SAAS;;AAE/B;AACA,IAAI,UAAU,GAAG,YAAY;;AAE7B;AACA,IAAI,OAAO,GAAG,IAAI;AAClB,IAAI,aAAa,GAAG,GAAG;AACvB,IAAI,QAAQ,GAAG,GAAG;AAClB,IAAI,YAAY,GAAG,EAAE;;AAErB;AACA,IAAI,YAAY,GAAG,SAAS;AAC5B,IAAI,gBAAgB,GAAG,aAAa;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,cAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;AACzC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACjC,IAAI,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC;AAC1D,EAAE;;AAEF,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;;AAEvB,EAAE,OAAO,GAAG,OAAO,IAAI,EAAE;;AAEzB;AACA;AACA;AACA,EAAE,IAAI,MAAM,GAAG,CAAC;AAChB,EAAE,IAAI,MAAM,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,cAAc,CAAC,GAAG,EAAE;AAC/B,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;AACxC,IAAI,IAAI,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM;AACrC,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;AACpC,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM;AACtD,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,GAAG;AACtB,IAAI,IAAI,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;AAChD,IAAI,OAAO,UAAU,IAAI,EAAE;AAC3B,MAAM,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC;AACzC,MAAM,UAAU,EAAE;AAClB,MAAM,OAAO,IAAI;AACjB,IAAI,CAAC;AACL,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;AAC3B,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK;AACtB,IAAI,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;AAC/C,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;AAChC,EAAE;;AAEF;AACA;AACA;AACA,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK;;AAIpC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,KAAK,CAAC,GAAG,EAAE;AACtB,IAAI,IAAI,GAAG,GAAG,IAAI,KAAK;AACvB,MAAM,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG;AAC5D,KAAK;AACL,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;AACpB,IAAI,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM;AACjC,IAAI,GAAG,CAAC,IAAI,GAAG,MAAM;AACrB,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM;AACvB,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK;;AAEtB,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAEnB,MAAM;AACX,MAAM,MAAM,GAAG;AACf,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,KAAK,CAAC,EAAE,EAAE;AACrB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,IAAI,IAAI,CAAC,CAAC,EAAE;AACZ,IAAI,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAClB,IAAI,cAAc,CAAC,GAAG,CAAC;AACvB,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;AACnC,IAAI,OAAO,CAAC;AACZ,EAAE;;AAEF;AACA;AACA;AACA,EAAE,SAAS,UAAU,GAAG;AACxB,IAAI,KAAK,CAAC,gBAAgB,CAAC;AAC3B,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;AAC3B,IAAI,IAAI,CAAC;AACT,IAAI,KAAK,GAAG,KAAK,IAAI,EAAE;AACvB,IAAI,QAAQ,CAAC,GAAG,OAAO,EAAE,GAAG;AAC5B,MAAM,IAAI,CAAC,KAAK,KAAK,EAAE;AACvB,QAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACrB,MAAM;AACN,IAAI;AACJ,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,OAAO,GAAG;AACrB,IAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;AACxB,IAAI,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;;AAEzE,IAAI,IAAI,CAAC,GAAG,CAAC;AACb,IAAI;AACJ,MAAM,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACrC,OAAO,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1E,MAAM;AACN,MAAM,EAAE,CAAC;AACT,IAAI;AACJ,IAAI,CAAC,IAAI,CAAC;;AAEV,IAAI,IAAI,YAAY,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;AAC9C,MAAM,OAAO,KAAK,CAAC,wBAAwB,CAAC;AAC5C,IAAI;;AAEJ,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACnC,IAAI,MAAM,IAAI,CAAC;AACf,IAAI,cAAc,CAAC,GAAG,CAAC;AACvB,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,IAAI,MAAM,IAAI,CAAC;;AAEf,IAAI,OAAO,GAAG,CAAC;AACf,MAAM,IAAI,EAAE,YAAY;AACxB,MAAM,OAAO,EAAE;AACf,KAAK,CAAC;AACN,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,WAAW,GAAG;AACzB,IAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;;AAExB;AACA,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC;AACpC,IAAI,IAAI,CAAC,IAAI,EAAE;AACf,IAAI,OAAO,EAAE;;AAEb;AACA,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,CAAC,sBAAsB,CAAC;;AAEjE;AACA,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;;AAEhC,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC;AAClB,MAAM,IAAI,EAAE,gBAAgB;AAC5B,MAAM,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAClE,MAAM,KAAK,EAAE;AACb,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC;AAC1D,UAAU;AACV,KAAK,CAAC;;AAEN;AACA,IAAI,KAAK,CAAC,eAAe,CAAC;;AAE1B,IAAI,OAAO,GAAG;AACd,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,YAAY,GAAG;AAC1B,IAAI,IAAI,KAAK,GAAG,EAAE;;AAElB,IAAI,QAAQ,CAAC,KAAK,CAAC;;AAEnB;AACA,IAAI,IAAI,IAAI;AACZ,IAAI,QAAQ,IAAI,GAAG,WAAW,EAAE,GAAG;AACnC,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE;AAC1B,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AACxB,QAAQ,QAAQ,CAAC,KAAK,CAAC;AACvB,MAAM;AACN,IAAI;;AAEJ,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,UAAU,EAAE;AACd,EAAE,OAAO,YAAY,EAAE;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI,CAAC,GAAG,EAAE;AACnB,EAAE,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,YAAY;AACnE;;;;"} \ No newline at end of file diff --git a/node_modules/inline-style-parser/index.d.ts b/node_modules/inline-style-parser/index.d.ts new file mode 100644 index 00000000..5349435a --- /dev/null +++ b/node_modules/inline-style-parser/index.d.ts @@ -0,0 +1,34 @@ +interface Position { + start: { + line: number; + column: number; + }; + end: { + line: number; + column: number; + }; + source?: string; +} + +export interface Declaration { + type: 'declaration'; + property: string; + value: string; + position: Position; +} + +export interface Comment { + type: 'comment'; + comment: string; + position: Position; +} + +interface Options { + source?: string; + silent?: boolean; +} + +export default function InlineStyleParser( + style: string, + options?: Options +): (Declaration | Comment)[]; diff --git a/node_modules/inline-style-parser/package.json b/node_modules/inline-style-parser/package.json new file mode 100644 index 00000000..77159e40 --- /dev/null +++ b/node_modules/inline-style-parser/package.json @@ -0,0 +1,77 @@ +{ + "name": "inline-style-parser", + "version": "0.2.7", + "description": "An inline style parser.", + "main": "./cjs/index.js", + "module": "./esm/index.mjs", + "types": "./esm/index.d.mts", + "exports": { + "import": { + "types": "./esm/index.d.mts", + "default": "./esm/index.mjs" + }, + "require": { + "types": "./cjs/index.d.cts", + "default": "./cjs/index.js" + } + }, + "scripts": { + "build": "run-s build:*", + "build:cjs": "rollup --config rollup.cjs.config.mjs --failAfterWarnings && cp index.d.ts cjs/index.d.cts", + "build:esm": "rollup --config rollup.esm.config.mjs --failAfterWarnings && cp index.d.ts esm/index.d.mts", + "build:umd": "rollup --config rollup.umd.config.mjs --failAfterWarnings", + "clean": "rm -rf cjs dist esm", + "lint": "eslint .", + "lint:fix": "npm run lint -- --fix", + "lint:package": "publint", + "prepare": "husky", + "prepublishOnly": "npm run lint && npm run build && npm test", + "test": "jest --colors --testPathIgnorePatterns=test/index.test.mjs", + "test:ci": "CI=true npm test -- --ci --coverage --collectCoverageFrom=cjs/index.js", + "test:esm": "node --test **/*.test.mjs", + "test:watch": "npm test -- --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/remarkablemark/inline-style-parser.git" + }, + "bugs": { + "url": "https://github.com/remarkablemark/inline-style-parser/issues" + }, + "keywords": [ + "inline-style-parser", + "inline-style", + "style", + "parser", + "css" + ], + "devDependencies": { + "@commitlint/cli": "20.1.0", + "@commitlint/config-conventional": "20.0.0", + "@eslint/compat": "2.0.0", + "@eslint/eslintrc": "3.3.1", + "@eslint/js": "9.39.1", + "@rollup/plugin-commonjs": "29.0.0", + "@rollup/plugin-node-resolve": "16.0.3", + "@rollup/plugin-terser": "0.4.4", + "css": "3.0.0", + "eslint": "9.39.1", + "eslint-plugin-prettier": "5.5.4", + "eslint-plugin-simple-import-sort": "12.1.1", + "globals": "16.5.0", + "husky": "9.1.7", + "jest": "30.2.0", + "lint-staged": "16.2.6", + "npm-run-all": "4.1.5", + "prettier": "3.6.2", + "publint": "0.3.15", + "rollup": "4.53.2" + }, + "files": [ + "/cjs", + "/dist", + "/esm", + "/index.d.ts" + ], + "license": "MIT" +} diff --git a/node_modules/is-alphabetical/index.d.ts b/node_modules/is-alphabetical/index.d.ts new file mode 100644 index 00000000..ceee1c61 --- /dev/null +++ b/node_modules/is-alphabetical/index.d.ts @@ -0,0 +1,8 @@ +/** + * Check if the given character code, or the character code at the first + * character, is alphabetical. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is alphabetical. + */ +export function isAlphabetical(character: string | number): boolean diff --git a/node_modules/is-alphabetical/index.js b/node_modules/is-alphabetical/index.js new file mode 100644 index 00000000..f71156a4 --- /dev/null +++ b/node_modules/is-alphabetical/index.js @@ -0,0 +1,16 @@ +/** + * Check if the given character code, or the character code at the first + * character, is alphabetical. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is alphabetical. + */ +export function isAlphabetical(character) { + const code = + typeof character === 'string' ? character.charCodeAt(0) : character + + return ( + (code >= 97 && code <= 122) /* a-z */ || + (code >= 65 && code <= 90) /* A-Z */ + ) +} diff --git a/node_modules/is-alphabetical/license b/node_modules/is-alphabetical/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/is-alphabetical/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-alphabetical/package.json b/node_modules/is-alphabetical/package.json new file mode 100644 index 00000000..c274f30d --- /dev/null +++ b/node_modules/is-alphabetical/package.json @@ -0,0 +1,73 @@ +{ + "name": "is-alphabetical", + "version": "2.0.1", + "description": "Check if a character is alphabetical", + "license": "MIT", + "keywords": [ + "string", + "character", + "char", + "code", + "alphabetical" + ], + "repository": "wooorm/is-alphabetical", + "bugs": "https://github.com/wooorm/is-alphabetical/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/is-alphabetical/readme.md b/node_modules/is-alphabetical/readme.md new file mode 100644 index 00000000..8c83eb60 --- /dev/null +++ b/node_modules/is-alphabetical/readme.md @@ -0,0 +1,141 @@ +# is-alphabetical + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Check if a character is alphabetical. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`isAlphabetical(character|code)`](#isalphabeticalcharactercode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a function that checks if a given character is ASCII alphabetical: +matching `[a-z]`, case insensitive. + +## When should I use this? + +Not often, as it’s relatively simple to do yourself. +This package exists because it’s needed in several related packages, at which +point it becomes useful to defer to one shared function. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install is-alphabetical +``` + +In Deno with [Skypack][]: + +```js +import {isAlphabetical} from 'https://cdn.skypack.dev/is-alphabetical@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {isAlphabetical} from 'is-alphabetical' + +isAlphabetical('a') // => true +isAlphabetical('B') // => true +isAlphabetical('0') // => false +isAlphabetical('💩') // => false +``` + +## API + +This package exports the following identifier: `isAlphabetical`. +There is no default export. + +### `isAlphabetical(character|code)` + +Check whether the given character code (`number`), or the character code at the +first position (`string`), is alphabetical. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/is-decimal`](https://github.com/wooorm/is-decimal) +* [`wooorm/is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`wooorm/is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) +* [`wooorm/is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) +* [`wooorm/is-word-character`](https://github.com/wooorm/is-word-character) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/is-alphabetical/workflows/main/badge.svg + +[build]: https://github.com/wooorm/is-alphabetical/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphabetical.svg + +[coverage]: https://codecov.io/github/wooorm/is-alphabetical + +[downloads-badge]: https://img.shields.io/npm/dm/is-alphabetical.svg + +[downloads]: https://www.npmjs.com/package/is-alphabetical + +[size-badge]: https://img.shields.io/bundlephobia/minzip/is-alphabetical.svg + +[size]: https://bundlephobia.com/result?p=is-alphabetical + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/is-alphanumerical/index.d.ts b/node_modules/is-alphanumerical/index.d.ts new file mode 100644 index 00000000..3fed2bd3 --- /dev/null +++ b/node_modules/is-alphanumerical/index.d.ts @@ -0,0 +1,8 @@ +/** + * Check if the given character code, or the character code at the first + * character, is alphanumerical. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is alphanumerical. + */ +export function isAlphanumerical(character: string | number): boolean diff --git a/node_modules/is-alphanumerical/index.js b/node_modules/is-alphanumerical/index.js new file mode 100644 index 00000000..10188f36 --- /dev/null +++ b/node_modules/is-alphanumerical/index.js @@ -0,0 +1,13 @@ +import {isAlphabetical} from 'is-alphabetical' +import {isDecimal} from 'is-decimal' + +/** + * Check if the given character code, or the character code at the first + * character, is alphanumerical. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is alphanumerical. + */ +export function isAlphanumerical(character) { + return isAlphabetical(character) || isDecimal(character) +} diff --git a/node_modules/is-alphanumerical/license b/node_modules/is-alphanumerical/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/is-alphanumerical/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-alphanumerical/package.json b/node_modules/is-alphanumerical/package.json new file mode 100644 index 00000000..2689af5d --- /dev/null +++ b/node_modules/is-alphanumerical/package.json @@ -0,0 +1,79 @@ +{ + "name": "is-alphanumerical", + "version": "2.0.1", + "description": "Check if a character is alphanumerical", + "license": "MIT", + "keywords": [ + "string", + "character", + "char", + "code", + "alphabetical", + "numerical", + "alphanumerical" + ], + "repository": "wooorm/is-alphanumerical", + "bugs": "https://github.com/wooorm/is-alphanumerical/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/is-alphanumerical/readme.md b/node_modules/is-alphanumerical/readme.md new file mode 100644 index 00000000..cacd9a64 --- /dev/null +++ b/node_modules/is-alphanumerical/readme.md @@ -0,0 +1,142 @@ +# is-alphanumerical + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Check if a character is alphanumerical. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`isAlphanumerical(character)`](#isalphanumericalcharacter) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a function that checks if a given character is ASCII alphanumerical: +it matches `[a-zA-Z0-9]`. + +## When should I use this? + +Not often, as it’s relatively simple to do yourself. +This package exists because it’s needed in several related packages, at which +point it becomes useful to defer to one shared function. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install is-alphanumerical +``` + +In Deno with [Skypack][]: + +```js +import {isAlphanumerical} from 'https://cdn.skypack.dev/is-alphanumerical@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {isAlphanumerical} from 'is-alphanumerical' + +isAlphanumerical('a') // => true +isAlphanumerical('Z') // => true +isAlphanumerical('0') // => true +isAlphanumerical(' ') // => false +isAlphanumerical('💩') // => false +``` + +## API + +This package exports the following identifier: `isAlphanumerical`. +There is no default export. + +### `isAlphanumerical(character)` + +Check whether the given character code (`number`), or the character code at the +first position (`string`), is alphanumerical. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`wooorm/is-decimal`](https://github.com/wooorm/is-decimal) +* [`wooorm/is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`wooorm/is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) +* [`wooorm/is-word-character`](https://github.com/wooorm/is-word-character) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/is-alphanumerical/workflows/main/badge.svg + +[build]: https://github.com/wooorm/is-alphanumerical/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphanumerical.svg + +[coverage]: https://codecov.io/github/wooorm/is-alphanumerical + +[downloads-badge]: https://img.shields.io/npm/dm/is-alphanumerical.svg + +[downloads]: https://www.npmjs.com/package/is-alphanumerical + +[size-badge]: https://img.shields.io/bundlephobia/minzip/is-alphanumerical.svg + +[size]: https://bundlephobia.com/result?p=is-alphanumerical + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/is-decimal/index.d.ts b/node_modules/is-decimal/index.d.ts new file mode 100644 index 00000000..5f162a71 --- /dev/null +++ b/node_modules/is-decimal/index.d.ts @@ -0,0 +1,8 @@ +/** + * Check if the given character code, or the character code at the first + * character, is decimal. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is a decimal + */ +export function isDecimal(character: string | number): boolean diff --git a/node_modules/is-decimal/index.js b/node_modules/is-decimal/index.js new file mode 100644 index 00000000..4fe00ff7 --- /dev/null +++ b/node_modules/is-decimal/index.js @@ -0,0 +1,13 @@ +/** + * Check if the given character code, or the character code at the first + * character, is decimal. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is a decimal + */ +export function isDecimal(character) { + const code = + typeof character === 'string' ? character.charCodeAt(0) : character + + return code >= 48 && code <= 57 /* 0-9 */ +} diff --git a/node_modules/is-decimal/license b/node_modules/is-decimal/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/is-decimal/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-decimal/package.json b/node_modules/is-decimal/package.json new file mode 100644 index 00000000..c0a59399 --- /dev/null +++ b/node_modules/is-decimal/package.json @@ -0,0 +1,73 @@ +{ + "name": "is-decimal", + "version": "2.0.1", + "description": "Check if a character is decimal", + "license": "MIT", + "keywords": [ + "string", + "character", + "char", + "code", + "decimal" + ], + "repository": "wooorm/is-decimal", + "bugs": "https://github.com/wooorm/is-decimal/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/is-decimal/readme.md b/node_modules/is-decimal/readme.md new file mode 100644 index 00000000..1595537c --- /dev/null +++ b/node_modules/is-decimal/readme.md @@ -0,0 +1,139 @@ +# is-decimal + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Check if a character is a decimal. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`isDecimal(character|code)`](#isdecimalcharactercode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a function that checks if a given character is an ASCII decimal. + +## When should I use this? + +Not often, as it’s relatively simple to do yourself. +This package exists because it’s needed in several related packages, at which +point it becomes useful to defer to one shared function. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install is-decimal +``` + +In Deno with [Skypack][]: + +```js +import {isDecimal} from 'https://cdn.skypack.dev/is-decimal@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {isDecimal} from 'is-decimal' + +isDecimal('0') // => true +isDecimal('9') // => true +isDecimal('a') // => false +isDecimal('💩') // => false +``` + +## API + +This package exports the following identifiers: `isDecimal`. +There is no default export. + +### `isDecimal(character|code)` + +Check whether the given character code (`number`), or the character code at the +first position (`string`), is decimal. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`wooorm/is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`wooorm/is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) +* [`wooorm/is-word-character`](https://github.com/wooorm/is-word-character) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/is-decimal/workflows/main/badge.svg + +[build]: https://github.com/wooorm/is-decimal/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-decimal.svg + +[coverage]: https://codecov.io/github/wooorm/is-decimal + +[downloads-badge]: https://img.shields.io/npm/dm/is-decimal.svg + +[downloads]: https://www.npmjs.com/package/is-decimal + +[size-badge]: https://img.shields.io/bundlephobia/minzip/is-decimal.svg + +[size]: https://bundlephobia.com/result?p=is-decimal + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/is-hexadecimal/index.d.ts b/node_modules/is-hexadecimal/index.d.ts new file mode 100644 index 00000000..1199b32a --- /dev/null +++ b/node_modules/is-hexadecimal/index.d.ts @@ -0,0 +1,8 @@ +/** + * Check if the given character code, or the character code at the first + * character, is hexadecimal. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is hexadecimal + */ +export function isHexadecimal(character: string | number): boolean diff --git a/node_modules/is-hexadecimal/index.js b/node_modules/is-hexadecimal/index.js new file mode 100644 index 00000000..2eda39fb --- /dev/null +++ b/node_modules/is-hexadecimal/index.js @@ -0,0 +1,17 @@ +/** + * Check if the given character code, or the character code at the first + * character, is hexadecimal. + * + * @param {string|number} character + * @returns {boolean} Whether `character` is hexadecimal + */ +export function isHexadecimal(character) { + const code = + typeof character === 'string' ? character.charCodeAt(0) : character + + return ( + (code >= 97 /* a */ && code <= 102) /* z */ || + (code >= 65 /* A */ && code <= 70) /* Z */ || + (code >= 48 /* A */ && code <= 57) /* Z */ + ) +} diff --git a/node_modules/is-hexadecimal/license b/node_modules/is-hexadecimal/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/is-hexadecimal/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-hexadecimal/package.json b/node_modules/is-hexadecimal/package.json new file mode 100644 index 00000000..e88ab447 --- /dev/null +++ b/node_modules/is-hexadecimal/package.json @@ -0,0 +1,73 @@ +{ + "name": "is-hexadecimal", + "version": "2.0.1", + "description": "Check if a character is hexadecimal", + "license": "MIT", + "keywords": [ + "string", + "character", + "char", + "code", + "hexadecimal" + ], + "repository": "wooorm/is-hexadecimal", + "bugs": "https://github.com/wooorm/is-hexadecimal/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^10.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.46.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/is-hexadecimal/readme.md b/node_modules/is-hexadecimal/readme.md new file mode 100644 index 00000000..a857ecd9 --- /dev/null +++ b/node_modules/is-hexadecimal/readme.md @@ -0,0 +1,141 @@ +# is-hexadecimal + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Check if a character is hexadecimal. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`isHexadecimal(character|code)`](#ishexadecimalcharactercode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a function that checks if a given character is a white space character: +whether it matches `[a-f0-9]`, case insensitive. + +## When should I use this? + +Not often, as it’s relatively simple to do yourself. +This package exists because it’s needed in several related packages, at which +point it becomes useful to defer to one shared function. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: + +```sh +npm install is-hexadecimal +``` + +In Deno with [Skypack][]: + +```js +import {isHexadecimal} from 'https://cdn.skypack.dev/is-hexadecimal@2?dts' +``` + +In browsers with [Skypack][]: + +```html + +``` + +## Use + +```js +import {isHexadecimal} from 'is-hexadecimal' + +isHexadecimal('a') // => true +isHexadecimal('0') // => true +isHexadecimal('G') // => false +isHexadecimal('💩') // => false +``` + +## API + +This package exports the following identifier: `isHexadecimal`. +There is no default export. + +### `isHexadecimal(character|code)` + +Check whether the given character code (`number`), or the character code at the +first position (`string`), is isHexadecimal. + +## Types + +This package is fully typed with [TypeScript][]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`wooorm/is-alphanumerical`](https://github.com/wooorm/is-alphabetical) +* [`wooorm/is-decimal`](https://github.com/wooorm/is-decimal) +* [`wooorm/is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) +* [`wooorm/is-word-character`](https://github.com/wooorm/is-word-character) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/is-hexadecimal/workflows/main/badge.svg + +[build]: https://github.com/wooorm/is-hexadecimal/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/is-hexadecimal.svg + +[coverage]: https://codecov.io/github/wooorm/is-hexadecimal + +[downloads-badge]: https://img.shields.io/npm/dm/is-hexadecimal.svg + +[downloads]: https://www.npmjs.com/package/is-hexadecimal + +[size-badge]: https://img.shields.io/bundlephobia/minzip/is-hexadecimal.svg + +[size]: https://bundlephobia.com/result?p=is-hexadecimal + +[npm]: https://docs.npmjs.com/cli/install + +[skypack]: https://www.skypack.dev + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/is-plain-obj/index.d.ts b/node_modules/is-plain-obj/index.d.ts new file mode 100644 index 00000000..3794c42e --- /dev/null +++ b/node_modules/is-plain-obj/index.d.ts @@ -0,0 +1,35 @@ +/** +Check if a value is a plain object. + +An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`. + +@example +``` +import isPlainObject from 'is-plain-obj'; +import {runInNewContext} from 'node:vm'; + +isPlainObject({foo: 'bar'}); +//=> true + +isPlainObject(new Object()); +//=> true + +isPlainObject(Object.create(null)); +//=> true + +// This works across realms +isPlainObject(runInNewContext('({})')); +//=> true + +isPlainObject([1, 2, 3]); +//=> false + +class Unicorn {} +isPlainObject(new Unicorn()); +//=> false + +isPlainObject(Math); +//=> false +``` +*/ +export default function isPlainObject(value: unknown): value is Record; diff --git a/node_modules/is-plain-obj/index.js b/node_modules/is-plain-obj/index.js new file mode 100644 index 00000000..92555c3d --- /dev/null +++ b/node_modules/is-plain-obj/index.js @@ -0,0 +1,8 @@ +export default function isPlainObject(value) { + if (typeof value !== 'object' || value === null) { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); +} diff --git a/node_modules/is-plain-obj/license b/node_modules/is-plain-obj/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/is-plain-obj/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-plain-obj/package.json b/node_modules/is-plain-obj/package.json new file mode 100644 index 00000000..2ee5a142 --- /dev/null +++ b/node_modules/is-plain-obj/package.json @@ -0,0 +1,41 @@ +{ + "name": "is-plain-obj", + "version": "4.1.0", + "description": "Check if a value is a plain object", + "license": "MIT", + "repository": "sindresorhus/is-plain-obj", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "object", + "is", + "check", + "test", + "type", + "plain", + "vanilla", + "pure", + "simple" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/is-plain-obj/readme.md b/node_modules/is-plain-obj/readme.md new file mode 100644 index 00000000..28de6fb5 --- /dev/null +++ b/node_modules/is-plain-obj/readme.md @@ -0,0 +1,58 @@ +# is-plain-obj + +> Check if a value is a plain object + +An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`. + +## Install + +``` +$ npm install is-plain-obj +``` + +## Usage + +```js +import isPlainObject from 'is-plain-obj'; +import {runInNewContext} from 'node:vm'; + +isPlainObject({foo: 'bar'}); +//=> true + +isPlainObject(new Object()); +//=> true + +isPlainObject(Object.create(null)); +//=> true + +// This works across realms +isPlainObject(runInNewContext('({})')); +//=> true + +isPlainObject([1, 2, 3]); +//=> false + +class Unicorn {} +isPlainObject(new Unicorn()); +//=> false + +isPlainObject(Math); +//=> false +``` + +## Related + +- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object +- [is](https://github.com/sindresorhus/is) - Type check values + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/longest-streak/index.d.ts b/node_modules/longest-streak/index.d.ts new file mode 100644 index 00000000..560c8183 --- /dev/null +++ b/node_modules/longest-streak/index.d.ts @@ -0,0 +1,11 @@ +/** + * Get the count of the longest repeating streak of `substring` in `value`. + * + * @param {string} value + * Content to search in. + * @param {string} substring + * Substring to look for, typically one character. + * @returns {number} + * Count of most frequent adjacent `substring`s in `value`. + */ +export function longestStreak(value: string, substring: string): number diff --git a/node_modules/longest-streak/index.js b/node_modules/longest-streak/index.js new file mode 100644 index 00000000..67e726d4 --- /dev/null +++ b/node_modules/longest-streak/index.js @@ -0,0 +1,36 @@ +/** + * Get the count of the longest repeating streak of `substring` in `value`. + * + * @param {string} value + * Content to search in. + * @param {string} substring + * Substring to look for, typically one character. + * @returns {number} + * Count of most frequent adjacent `substring`s in `value`. + */ +export function longestStreak(value, substring) { + const source = String(value) + let index = source.indexOf(substring) + let expected = index + let count = 0 + let max = 0 + + if (typeof substring !== 'string') { + throw new TypeError('Expected substring') + } + + while (index !== -1) { + if (index === expected) { + if (++count > max) { + max = count + } + } else { + count = 1 + } + + expected = index + substring.length + index = source.indexOf(substring, expected) + } + + return max +} diff --git a/node_modules/longest-streak/license b/node_modules/longest-streak/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/longest-streak/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/longest-streak/package.json b/node_modules/longest-streak/package.json new file mode 100644 index 00000000..75d6e903 --- /dev/null +++ b/node_modules/longest-streak/package.json @@ -0,0 +1,73 @@ +{ + "name": "longest-streak", + "version": "3.1.0", + "description": "Count the longest repeating streak of a substring", + "license": "MIT", + "keywords": [ + "count", + "length", + "longest", + "repeating", + "streak", + "substring", + "character" + ], + "repository": "wooorm/longest-streak", + "bugs": "https://github.com/wooorm/longest-streak/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^18.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.52.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/longest-streak/readme.md b/node_modules/longest-streak/readme.md new file mode 100644 index 00000000..db02bfcf --- /dev/null +++ b/node_modules/longest-streak/readme.md @@ -0,0 +1,150 @@ +# longest-streak + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Get the count of the longest repeating streak of `substring` in `value`. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`longestStreak(value, substring)`](#longeststreakvalue-substring) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a tiny package that finds the count of the longest adjacent repeating +substring. + +## When should I use this? + +This package is rather niche. +I use it for serializing markdown ASTs (particularly fenced code and math). + +You can use [`ccount`][ccount] if you need the total count of substrings +occuring in a value. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install longest-streak +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {longestStreak} from 'https://esm.sh/longest-streak@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {longestStreak} from 'longest-streak' + +longestStreak('` foo `` bar `', '`') // => 2 +``` + +## API + +This package exports the identifier `longestStreak`. +There is no default export. + +### `longestStreak(value, substring)` + +Get the count of the longest repeating streak of `substring` in `value`. + +###### Parameters + +* `value` (`string`) — content to search in +* `substring` (`string`) — substring to look for, typically one character + +###### Returns + +Count of most frequent adjacent `substring`s in `value` (`number`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`wooorm/ccount`](https://github.com/wooorm/ccount) + — count the total number of `substring`s in `value` +* [`wooorm/direction`](https://github.com/wooorm/direction) + — detect directionality: left-to-right, right-to-left, or neutral + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/longest-streak/workflows/main/badge.svg + +[build]: https://github.com/wooorm/longest-streak/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/longest-streak.svg + +[coverage]: https://codecov.io/github/wooorm/longest-streak + +[downloads-badge]: https://img.shields.io/npm/dm/longest-streak.svg + +[downloads]: https://www.npmjs.com/package/longest-streak + +[size-badge]: https://img.shields.io/bundlephobia/minzip/longest-streak.svg + +[size]: https://bundlephobia.com/result?p=longest-streak + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[ccount]: https://github.com/wooorm/ccount diff --git a/node_modules/markdown-table/index.d.ts b/node_modules/markdown-table/index.d.ts new file mode 100644 index 00000000..c7c5ddf2 --- /dev/null +++ b/node_modules/markdown-table/index.d.ts @@ -0,0 +1,171 @@ +/** + * Generate a markdown + * ([GFM](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables)) + * table. + * + * @param {ReadonlyArray>} table + * Table data (matrix of strings). + * @param {Readonly | null | undefined} [options] + * Configuration (optional). + * @returns {string} + * Result. + */ +export function markdownTable(table: ReadonlyArray>, options?: Readonly | null | undefined): string; +/** + * Configuration. + */ +export type MarkdownTableOptions = Options; +/** + * Configuration. + */ +export type Options = { + /** + * Whether to align the delimiters (default: `true`); + * they are aligned by default: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * Pass `false` to make them staggered: + * + * ```markdown + * | Alpha | B | + * | - | - | + * | C | Delta | + * ``` + */ + alignDelimiters?: boolean | null | undefined; + /** + * How to align columns (default: `''`); + * one style for all columns or styles for their respective columns; + * each style is either `'l'` (left), `'r'` (right), or `'c'` (center); + * other values are treated as `''`, which doesn’t place the colon in the + * alignment row but does align left; + * *only the lowercased first character is used, so `Right` is fine.* + */ + align?: ReadonlyArray | string | null | undefined; + /** + * Whether to end each row with the delimiter (default: `true`). + * + * > 👉 **Note**: please don’t use this: it could create fragile structures + * > that aren’t understandable to some markdown parsers. + * + * When `true`, there are ending delimiters: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there are no ending delimiters: + * + * ```markdown + * | Alpha | B + * | ----- | ----- + * | C | Delta + * ``` + */ + delimiterEnd?: boolean | null | undefined; + /** + * Whether to begin each row with the delimiter (default: `true`). + * + * > 👉 **Note**: please don’t use this: it could create fragile structures + * > that aren’t understandable to some markdown parsers. + * + * When `true`, there are starting delimiters: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there are no starting delimiters: + * + * ```markdown + * Alpha | B | + * ----- | ----- | + * C | Delta | + * ``` + */ + delimiterStart?: boolean | null | undefined; + /** + * Whether to add a space of padding between delimiters and cells + * (default: `true`). + * + * When `true`, there is padding: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there is no padding: + * + * ```markdown + * |Alpha|B | + * |-----|-----| + * |C |Delta| + * ``` + */ + padding?: boolean | null | undefined; + /** + * Function to detect the length of table cell content (optional); + * this is used when aligning the delimiters (`|`) between table cells; + * full-width characters and emoji mess up delimiter alignment when viewing + * the markdown source; + * to fix this, you can pass this function, + * which receives the cell content and returns its “visible” size; + * note that what is and isn’t visible depends on where the text is displayed. + * + * Without such a function, the following: + * + * ```js + * markdownTable([ + * ['Alpha', 'Bravo'], + * ['中文', 'Charlie'], + * ['👩‍❤️‍👩', 'Delta'] + * ]) + * ``` + * + * Yields: + * + * ```markdown + * | Alpha | Bravo | + * | - | - | + * | 中文 | Charlie | + * | 👩‍❤️‍👩 | Delta | + * ``` + * + * With [`string-width`](https://github.com/sindresorhus/string-width): + * + * ```js + * import stringWidth from 'string-width' + * + * markdownTable( + * [ + * ['Alpha', 'Bravo'], + * ['中文', 'Charlie'], + * ['👩‍❤️‍👩', 'Delta'] + * ], + * {stringLength: stringWidth} + * ) + * ``` + * + * Yields: + * + * ```markdown + * | Alpha | Bravo | + * | ----- | ------- | + * | 中文 | Charlie | + * | 👩‍❤️‍👩 | Delta | + * ``` + */ + stringLength?: ((value: string) => number) | null | undefined; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/markdown-table/index.d.ts.map b/node_modules/markdown-table/index.d.ts.map new file mode 100644 index 00000000..bf2f00e7 --- /dev/null +++ b/node_modules/markdown-table/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA6JA;;;;;;;;;;;GAWG;AACH,qCAPW,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,YAEvD,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAElC,MAAM,CAsMlB;;;;mCA1WY,OAAO;;;;;;;;;;;;;;;;;;;;;;;sBAON,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;YAiB1B,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;mBAOpE,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;qBAqB1B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;cAqB1B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAmB1B,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS"} \ No newline at end of file diff --git a/node_modules/markdown-table/index.js b/node_modules/markdown-table/index.js new file mode 100644 index 00000000..35be1cdb --- /dev/null +++ b/node_modules/markdown-table/index.js @@ -0,0 +1,393 @@ +// To do: next major: remove. +/** + * @typedef {Options} MarkdownTableOptions + * Configuration. + */ + +/** + * @typedef Options + * Configuration. + * @property {boolean | null | undefined} [alignDelimiters=true] + * Whether to align the delimiters (default: `true`); + * they are aligned by default: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * Pass `false` to make them staggered: + * + * ```markdown + * | Alpha | B | + * | - | - | + * | C | Delta | + * ``` + * @property {ReadonlyArray | string | null | undefined} [align] + * How to align columns (default: `''`); + * one style for all columns or styles for their respective columns; + * each style is either `'l'` (left), `'r'` (right), or `'c'` (center); + * other values are treated as `''`, which doesn’t place the colon in the + * alignment row but does align left; + * *only the lowercased first character is used, so `Right` is fine.* + * @property {boolean | null | undefined} [delimiterEnd=true] + * Whether to end each row with the delimiter (default: `true`). + * + * > 👉 **Note**: please don’t use this: it could create fragile structures + * > that aren’t understandable to some markdown parsers. + * + * When `true`, there are ending delimiters: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there are no ending delimiters: + * + * ```markdown + * | Alpha | B + * | ----- | ----- + * | C | Delta + * ``` + * @property {boolean | null | undefined} [delimiterStart=true] + * Whether to begin each row with the delimiter (default: `true`). + * + * > 👉 **Note**: please don’t use this: it could create fragile structures + * > that aren’t understandable to some markdown parsers. + * + * When `true`, there are starting delimiters: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there are no starting delimiters: + * + * ```markdown + * Alpha | B | + * ----- | ----- | + * C | Delta | + * ``` + * @property {boolean | null | undefined} [padding=true] + * Whether to add a space of padding between delimiters and cells + * (default: `true`). + * + * When `true`, there is padding: + * + * ```markdown + * | Alpha | B | + * | ----- | ----- | + * | C | Delta | + * ``` + * + * When `false`, there is no padding: + * + * ```markdown + * |Alpha|B | + * |-----|-----| + * |C |Delta| + * ``` + * @property {((value: string) => number) | null | undefined} [stringLength] + * Function to detect the length of table cell content (optional); + * this is used when aligning the delimiters (`|`) between table cells; + * full-width characters and emoji mess up delimiter alignment when viewing + * the markdown source; + * to fix this, you can pass this function, + * which receives the cell content and returns its “visible” size; + * note that what is and isn’t visible depends on where the text is displayed. + * + * Without such a function, the following: + * + * ```js + * markdownTable([ + * ['Alpha', 'Bravo'], + * ['中文', 'Charlie'], + * ['👩‍❤️‍👩', 'Delta'] + * ]) + * ``` + * + * Yields: + * + * ```markdown + * | Alpha | Bravo | + * | - | - | + * | 中文 | Charlie | + * | 👩‍❤️‍👩 | Delta | + * ``` + * + * With [`string-width`](https://github.com/sindresorhus/string-width): + * + * ```js + * import stringWidth from 'string-width' + * + * markdownTable( + * [ + * ['Alpha', 'Bravo'], + * ['中文', 'Charlie'], + * ['👩‍❤️‍👩', 'Delta'] + * ], + * {stringLength: stringWidth} + * ) + * ``` + * + * Yields: + * + * ```markdown + * | Alpha | Bravo | + * | ----- | ------- | + * | 中文 | Charlie | + * | 👩‍❤️‍👩 | Delta | + * ``` + */ + +/** + * @param {string} value + * Cell value. + * @returns {number} + * Cell size. + */ +function defaultStringLength(value) { + return value.length +} + +/** + * Generate a markdown + * ([GFM](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables)) + * table. + * + * @param {ReadonlyArray>} table + * Table data (matrix of strings). + * @param {Readonly | null | undefined} [options] + * Configuration (optional). + * @returns {string} + * Result. + */ +export function markdownTable(table, options) { + const settings = options || {} + // To do: next major: change to spread. + const align = (settings.align || []).concat() + const stringLength = settings.stringLength || defaultStringLength + /** @type {Array} Character codes as symbols for alignment per column. */ + const alignments = [] + /** @type {Array>} Cells per row. */ + const cellMatrix = [] + /** @type {Array>} Sizes of each cell per row. */ + const sizeMatrix = [] + /** @type {Array} */ + const longestCellByColumn = [] + let mostCellsPerRow = 0 + let rowIndex = -1 + + // This is a superfluous loop if we don’t align delimiters, but otherwise we’d + // do superfluous work when aligning, so optimize for aligning. + while (++rowIndex < table.length) { + /** @type {Array} */ + const row = [] + /** @type {Array} */ + const sizes = [] + let columnIndex = -1 + + if (table[rowIndex].length > mostCellsPerRow) { + mostCellsPerRow = table[rowIndex].length + } + + while (++columnIndex < table[rowIndex].length) { + const cell = serialize(table[rowIndex][columnIndex]) + + if (settings.alignDelimiters !== false) { + const size = stringLength(cell) + sizes[columnIndex] = size + + if ( + longestCellByColumn[columnIndex] === undefined || + size > longestCellByColumn[columnIndex] + ) { + longestCellByColumn[columnIndex] = size + } + } + + row.push(cell) + } + + cellMatrix[rowIndex] = row + sizeMatrix[rowIndex] = sizes + } + + // Figure out which alignments to use. + let columnIndex = -1 + + if (typeof align === 'object' && 'length' in align) { + while (++columnIndex < mostCellsPerRow) { + alignments[columnIndex] = toAlignment(align[columnIndex]) + } + } else { + const code = toAlignment(align) + + while (++columnIndex < mostCellsPerRow) { + alignments[columnIndex] = code + } + } + + // Inject the alignment row. + columnIndex = -1 + /** @type {Array} */ + const row = [] + /** @type {Array} */ + const sizes = [] + + while (++columnIndex < mostCellsPerRow) { + const code = alignments[columnIndex] + let before = '' + let after = '' + + if (code === 99 /* `c` */) { + before = ':' + after = ':' + } else if (code === 108 /* `l` */) { + before = ':' + } else if (code === 114 /* `r` */) { + after = ':' + } + + // There *must* be at least one hyphen-minus in each alignment cell. + let size = + settings.alignDelimiters === false + ? 1 + : Math.max( + 1, + longestCellByColumn[columnIndex] - before.length - after.length + ) + + const cell = before + '-'.repeat(size) + after + + if (settings.alignDelimiters !== false) { + size = before.length + size + after.length + + if (size > longestCellByColumn[columnIndex]) { + longestCellByColumn[columnIndex] = size + } + + sizes[columnIndex] = size + } + + row[columnIndex] = cell + } + + // Inject the alignment row. + cellMatrix.splice(1, 0, row) + sizeMatrix.splice(1, 0, sizes) + + rowIndex = -1 + /** @type {Array} */ + const lines = [] + + while (++rowIndex < cellMatrix.length) { + const row = cellMatrix[rowIndex] + const sizes = sizeMatrix[rowIndex] + columnIndex = -1 + /** @type {Array} */ + const line = [] + + while (++columnIndex < mostCellsPerRow) { + const cell = row[columnIndex] || '' + let before = '' + let after = '' + + if (settings.alignDelimiters !== false) { + const size = + longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0) + const code = alignments[columnIndex] + + if (code === 114 /* `r` */) { + before = ' '.repeat(size) + } else if (code === 99 /* `c` */) { + if (size % 2) { + before = ' '.repeat(size / 2 + 0.5) + after = ' '.repeat(size / 2 - 0.5) + } else { + before = ' '.repeat(size / 2) + after = before + } + } else { + after = ' '.repeat(size) + } + } + + if (settings.delimiterStart !== false && !columnIndex) { + line.push('|') + } + + if ( + settings.padding !== false && + // Don’t add the opening space if we’re not aligning and the cell is + // empty: there will be a closing space. + !(settings.alignDelimiters === false && cell === '') && + (settings.delimiterStart !== false || columnIndex) + ) { + line.push(' ') + } + + if (settings.alignDelimiters !== false) { + line.push(before) + } + + line.push(cell) + + if (settings.alignDelimiters !== false) { + line.push(after) + } + + if (settings.padding !== false) { + line.push(' ') + } + + if ( + settings.delimiterEnd !== false || + columnIndex !== mostCellsPerRow - 1 + ) { + line.push('|') + } + } + + lines.push( + settings.delimiterEnd === false + ? line.join('').replace(/ +$/, '') + : line.join('') + ) + } + + return lines.join('\n') +} + +/** + * @param {string | null | undefined} [value] + * Value to serialize. + * @returns {string} + * Result. + */ +function serialize(value) { + return value === null || value === undefined ? '' : String(value) +} + +/** + * @param {string | null | undefined} value + * Value. + * @returns {number} + * Alignment. + */ +function toAlignment(value) { + const code = typeof value === 'string' ? value.codePointAt(0) : 0 + + return code === 67 /* `C` */ || code === 99 /* `c` */ + ? 99 /* `c` */ + : code === 76 /* `L` */ || code === 108 /* `l` */ + ? 108 /* `l` */ + : code === 82 /* `R` */ || code === 114 /* `r` */ + ? 114 /* `r` */ + : 0 +} diff --git a/node_modules/markdown-table/license b/node_modules/markdown-table/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/markdown-table/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/markdown-table/package.json b/node_modules/markdown-table/package.json new file mode 100644 index 00000000..9e669109 --- /dev/null +++ b/node_modules/markdown-table/package.json @@ -0,0 +1,77 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/wooorm/markdown-table/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "description": "Generate a markdown (GFM) table", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "chalk": "^5.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "strip-ansi": "^7.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.59.0" + }, + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "keywords": [ + "align", + "markdown", + "rows", + "table", + "tabular", + "text" + ], + "license": "MIT", + "main": "index.js", + "name": "markdown-table", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "wooorm/markdown-table", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --check-coverage --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true + }, + "types": "index.d.ts", + "type": "module", + "version": "3.0.4", + "xo": { + "prettier": true, + "rules": { + "complexity": "off", + "unicorn/prefer-switch": "off" + } + } +} diff --git a/node_modules/markdown-table/readme.md b/node_modules/markdown-table/readme.md new file mode 100644 index 00000000..86e8a225 --- /dev/null +++ b/node_modules/markdown-table/readme.md @@ -0,0 +1,344 @@ +# markdown-table + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Generate a markdown ([GFM][]) table. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`markdownTable(table[, options])`](#markdowntabletable-options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Inspiration](#inspiration) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a simple package that takes table data and generates a [GitHub flavored +markdown (GFM)][gfm] table. + +## When should I use this? + +You can use this package when you want to generate the source code of a GFM +table from some data. + +This is a simple solution in that it doesn’t handle escapes or HTML or any of +that. +For a complete but heavier solution, build an AST and serialize it with +[`mdast-util-to-markdown`][mdast-util-to-markdown] (with +[`mdast-util-gfm`][mdast-util-gfm]). + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install markdown-table +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {markdownTable} from 'https://esm.sh/markdown-table@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Typical usage (defaults to align left): + +```js +import {markdownTable} from 'markdown-table' + +markdownTable([ + ['Branch', 'Commit'], + ['main', '0123456789abcdef'], + ['staging', 'fedcba9876543210'] +]) +``` + +Yields: + +```markdown +| Branch | Commit | +| ------- | ---------------- | +| main | 0123456789abcdef | +| staging | fedcba9876543210 | +``` + +With align: + +```js +markdownTable( + [ + ['Beep', 'No.', 'Boop'], + ['beep', '1024', 'xyz'], + ['boop', '3388450', 'tuv'], + ['foo', '10106', 'qrstuv'], + ['bar', '45', 'lmno'] + ], + {align: ['l', 'c', 'r']} +) +``` + +Yields: + +```markdown +| Beep | No. | Boop | +| :--- | :-----: | -----: | +| beep | 1024 | xyz | +| boop | 3388450 | tuv | +| foo | 10106 | qrstuv | +| bar | 45 | lmno | +``` + +## API + +This package exports the identifier `markdownTable`. +There is no default export. + +### `markdownTable(table[, options])` + +Generate a markdown table from table data (matrix of strings). + +##### `options` + +Configuration (optional). + +###### `options.align` + +One style for all columns, or styles for their respective columns (`string` or +`Array`). +Each style is either `'l'` (left), `'r'` (right), or `'c'` (center). +Other values are treated as `''`, which doesn’t place the colon in the alignment +row but does align left. +*Only the lowercased first character is used, so `Right` is fine.* + +###### `options.padding` + +Whether to add a space of padding between delimiters and cells (`boolean`, +default: `true`). + +When `true`, there is padding: + +```markdown +| Alpha | B | +| ----- | ----- | +| C | Delta | +``` + +When `false`, there is no padding: + +```markdown +|Alpha|B | +|-----|-----| +|C |Delta| +``` + +###### `options.delimiterStart` + +Whether to begin each row with the delimiter (`boolean`, default: `true`). + +> 👉 **Note**: please don’t use this: it could create fragile structures that +> aren’t understandable to some markdown parsers. + +When `true`, there are starting delimiters: + +```markdown +| Alpha | B | +| ----- | ----- | +| C | Delta | +``` + +When `false`, there are no starting delimiters: + +```markdown +Alpha | B | +----- | ----- | +C | Delta | +``` + +###### `options.delimiterEnd` + +Whether to end each row with the delimiter (`boolean`, default: `true`). + +> 👉 **Note**: please don’t use this: it could create fragile structures that +> aren’t understandable to some markdown parsers. + +When `true`, there are ending delimiters: + +```markdown +| Alpha | B | +| ----- | ----- | +| C | Delta | +``` + +When `false`, there are no ending delimiters: + +```markdown +| Alpha | B +| ----- | ----- +| C | Delta +``` + +###### `options.alignDelimiters` + +Whether to align the delimiters (`boolean`, default: `true`). +By default, they are aligned: + +```markdown +| Alpha | B | +| ----- | ----- | +| C | Delta | +``` + +Pass `false` to make them staggered: + +```markdown +| Alpha | B | +| - | - | +| C | Delta | +``` + +###### `options.stringLength` + +Function to detect the length of table cell content (`Function`, default: +`s => s.length`). +This is used when aligning the delimiters (`|`) between table cells. +Full-width characters and emoji mess up delimiter alignment when viewing the +markdown source. +To fix this, you can pass this function, which receives the cell content and +returns its “visible” size. +Note that what is and isn’t visible depends on where the text is displayed. + +Without such a function, the following: + +```js +markdownTable([ + ['Alpha', 'Bravo'], + ['中文', 'Charlie'], + ['👩‍❤️‍👩', 'Delta'] +]) +``` + +Yields: + +```markdown +| Alpha | Bravo | +| - | - | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +With [`string-width`][string-width]: + +```js +import stringWidth from 'string-width' + +markdownTable( + [ + ['Alpha', 'Bravo'], + ['中文', 'Charlie'], + ['👩‍❤️‍👩', 'Delta'] + ], + {stringLength: stringWidth} +) +``` + +Yields: + +```markdown +| Alpha | Bravo | +| ----- | ------- | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type `Options`. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Inspiration + +The original idea and basic implementation was inspired by James Halliday’s +[`text-table`][text-table] library. + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/markdown-table/workflows/main/badge.svg + +[build]: https://github.com/wooorm/markdown-table/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-table.svg + +[coverage]: https://codecov.io/github/wooorm/markdown-table + +[downloads-badge]: https://img.shields.io/npm/dm/markdown-table.svg + +[downloads]: https://www.npmjs.com/package/markdown-table + +[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-table.svg + +[size]: https://bundlephobia.com/result?p=markdown-table + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[gfm]: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables + +[text-table]: https://github.com/substack/text-table + +[string-width]: https://github.com/sindresorhus/string-width + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm diff --git a/node_modules/mdast-util-find-and-replace/index.d.ts b/node_modules/mdast-util-find-and-replace/index.d.ts new file mode 100644 index 00000000..cc25ad44 --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/index.d.ts @@ -0,0 +1,9 @@ +export { findAndReplace } from "./lib/index.js"; +export type FindAndReplaceList = import("./lib/index.js").FindAndReplaceList; +export type FindAndReplaceTuple = import("./lib/index.js").FindAndReplaceTuple; +export type Find = import("./lib/index.js").Find; +export type Options = import("./lib/index.js").Options; +export type RegExpMatchObject = import("./lib/index.js").RegExpMatchObject; +export type ReplaceFunction = import("./lib/index.js").ReplaceFunction; +export type Replace = import("./lib/index.js").Replace; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/mdast-util-find-and-replace/index.d.ts.map b/node_modules/mdast-util-find-and-replace/index.d.ts.map new file mode 100644 index 00000000..ca6bcb73 --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";iCACa,OAAO,gBAAgB,EAAE,kBAAkB;kCAC3C,OAAO,gBAAgB,EAAE,mBAAmB;mBAC5C,OAAO,gBAAgB,EAAE,IAAI;sBAC7B,OAAO,gBAAgB,EAAE,OAAO;gCAChC,OAAO,gBAAgB,EAAE,iBAAiB;8BAC1C,OAAO,gBAAgB,EAAE,eAAe;sBACxC,OAAO,gBAAgB,EAAE,OAAO"} \ No newline at end of file diff --git a/node_modules/mdast-util-find-and-replace/index.js b/node_modules/mdast-util-find-and-replace/index.js new file mode 100644 index 00000000..6273f921 --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/index.js @@ -0,0 +1,11 @@ +/** + * @typedef {import('./lib/index.js').FindAndReplaceList} FindAndReplaceList + * @typedef {import('./lib/index.js').FindAndReplaceTuple} FindAndReplaceTuple + * @typedef {import('./lib/index.js').Find} Find + * @typedef {import('./lib/index.js').Options} Options + * @typedef {import('./lib/index.js').RegExpMatchObject} RegExpMatchObject + * @typedef {import('./lib/index.js').ReplaceFunction} ReplaceFunction + * @typedef {import('./lib/index.js').Replace} Replace + */ + +export {findAndReplace} from './lib/index.js' diff --git a/node_modules/mdast-util-find-and-replace/license b/node_modules/mdast-util-find-and-replace/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-find-and-replace/package.json b/node_modules/mdast-util-find-and-replace/package.json new file mode 100644 index 00000000..0950ae27 --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/package.json @@ -0,0 +1,85 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/mdast-util-find-and-replace/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "description": "mdast utility to find and replace text in a tree", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-builder": "^4.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "find", + "markdown", + "mdast-util", + "mdast", + "unist", + "utility", + "util", + "replace" + ], + "license": "MIT", + "name": "mdast-util-find-and-replace", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/mdast-util-find-and-replace", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "ignoreFiles": [ + "lib/index.d.ts" + ], + "strict": true + }, + "type": "module", + "version": "3.0.2", + "xo": { + "prettier": true, + "rules": { + "unicorn/prefer-at": "off" + } + } +} diff --git a/node_modules/mdast-util-find-and-replace/readme.md b/node_modules/mdast-util-find-and-replace/readme.md new file mode 100644 index 00000000..810110d0 --- /dev/null +++ b/node_modules/mdast-util-find-and-replace/readme.md @@ -0,0 +1,368 @@ +# mdast-util-find-and-replace + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] utility to find and replace things. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`findAndReplace(tree, list[, options])`](#findandreplacetree-list-options) + * [`Find`](#find) + * [`FindAndReplaceList`](#findandreplacelist) + * [`FindAndReplaceTuple`](#findandreplacetuple) + * [`Options`](#options) + * [`RegExpMatchObject`](#regexpmatchobject) + * [`Replace`](#replace) + * [`ReplaceFunction`](#replacefunction) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that lets you find patterns (`string`, `RegExp`) in +text and replace them with nodes. + +## When should I use this? + +This utility is typically useful when you have regexes and want to modify mdast. +One example is when you have some form of “mentions” (such as +`/@([a-z][_a-z0-9])\b/gi`) and want to create links to persons from them. + +A similar package, [`hast-util-find-and-replace`][hast-util-find-and-replace] +does the same but on [hast][]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-find-and-replace +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {findAndReplace} from 'https://esm.sh/mdast-util-find-and-replace@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {findAndReplace} from 'mdast-util-find-and-replace' +import {u} from 'unist-builder' +import {inspect} from 'unist-util-inspect' + +const tree = u('paragraph', [ + u('text', 'Some '), + u('emphasis', [u('text', 'emphasis')]), + u('text', ' and '), + u('strong', [u('text', 'importance')]), + u('text', '.') +]) + +findAndReplace(tree, [ + [/and/gi, 'or'], + [/emphasis/gi, 'em'], + [/importance/gi, 'strong'], + [ + /Some/g, + function ($0) { + return u('link', {url: '//example.com#' + $0}, [u('text', $0)]) + } + ] +]) + +console.log(inspect(tree)) +``` + +Yields: + +```txt +paragraph[8] +├─0 link[1] +│ │ url: "//example.com#Some" +│ └─0 text "Some" +├─1 text " " +├─2 emphasis[1] +│ └─0 text "em" +├─3 text " " +├─4 text "or" +├─5 text " " +├─6 strong[1] +│ └─0 text "strong" +└─7 text "." +``` + +## API + +This package exports the identifier [`findAndReplace`][api-find-and-replace]. +There is no default export. + +### `findAndReplace(tree, list[, options])` + +Find patterns in a tree and replace them. + +The algorithm searches the tree in *[preorder][]* for complete values in +[`Text`][text] nodes. +Partial matches are not supported. + +###### Parameters + +* `tree` ([`Node`][node]) + — tree to change +* `list` ([`FindAndReplaceList`][api-find-and-replace-list] or + [`FindAndReplaceTuple`][api-find-and-replace-tuple]) + — one or more find-and-replace pairs +* `options` ([`Options`][api-options]) + — configuration + +###### Returns + +Nothing (`undefined`). + +### `Find` + +Pattern to find (TypeScript type). + +Strings are escaped and then turned into global expressions. + +###### Type + +```ts +type Find = RegExp | string +``` + +### `FindAndReplaceList` + +Several find and replaces, in array form (TypeScript type). + +###### Type + +```ts +type FindAndReplaceList = Array +``` + +See [`FindAndReplaceTuple`][api-find-and-replace-tuple]. + +### `FindAndReplaceTuple` + +Find and replace in tuple form (TypeScript type). + +###### Type + +```ts +type FindAndReplaceTuple = [Find, Replace?] +``` + +See [`Find`][api-find] and [`Replace`][api-replace]. + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `ignore` ([`Test`][test], optional) + — test for which elements to ignore + +### `RegExpMatchObject` + +Info on the match (TypeScript type). + +###### Fields + +* `index` (`number`) + — the index of the search at which the result was found +* `input` (`string`) + — a copy of the search string in the text node +* `stack` ([`Array`][node]) + — all ancestors of the text node, where the last node is the text itself + +### `Replace` + +Thing to replace with (TypeScript type). + +###### Type + +```ts +type Replace = ReplaceFunction | string +``` + +See [`ReplaceFunction`][api-replace-function]. + +### `ReplaceFunction` + +Callback called when a search matches (TypeScript type). + +###### Parameters + +The parameters are the result of corresponding search expression: + +* `value` (`string`) + — whole match +* `...capture` (`Array`) + — matches from regex capture groups +* `match` ([`RegExpMatchObject`][api-regexp-match-object]) + — info on the match + +###### Returns + +Thing to replace with: + +* when `null`, `undefined`, `''`, remove the match +* …or when `false`, do not replace at all +* …or when `string`, replace with a text node of that value +* …or when `Node` or `Array`, replace with those nodes + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`Find`][api-find], +[`FindAndReplaceList`][api-find-and-replace-list], +[`FindAndReplaceTuple`][api-find-and-replace-tuple], +[`Options`][api-options], +[`RegExpMatchObject`][api-regexp-match-object], +[`Replace`][api-replace], and +[`ReplaceFunction`][api-replace-function]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-find-and-replace@^3`, compatible with Node.js 16. + +## Security + +Use of `mdast-util-find-and-replace` does not involve [hast][] or user content +so there are no openings for [cross-site scripting (XSS)][xss] attacks. + +## Related + +* [`hast-util-find-and-replace`](https://github.com/syntax-tree/hast-util-find-and-replace) + — find and replace in hast +* [`hast-util-select`](https://github.com/syntax-tree/hast-util-select) + — `querySelector`, `querySelectorAll`, and `matches` +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — select unist nodes with CSS-like selectors + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-find-and-replace/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-find-and-replace/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-find-and-replace.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-find-and-replace + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-find-and-replace.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-find-and-replace + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-find-and-replace + +[size]: https://bundlejs.com/?q=mdast-util-find-and-replace + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[hast]: https://github.com/syntax-tree/hast + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[text]: https://github.com/syntax-tree/mdast#text + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[test]: https://github.com/syntax-tree/unist-util-is#api + +[hast-util-find-and-replace]: https://github.com/syntax-tree/hast-util-find-and-replace + +[api-find-and-replace]: #findandreplacetree-list-options + +[api-options]: #options + +[api-find]: #find + +[api-replace]: #replace + +[api-replace-function]: #replacefunction + +[api-find-and-replace-list]: #findandreplacelist + +[api-find-and-replace-tuple]: #findandreplacetuple + +[api-regexp-match-object]: #regexpmatchobject diff --git a/node_modules/mdast-util-from-markdown/dev/index.d.ts b/node_modules/mdast-util-from-markdown/dev/index.d.ts new file mode 100644 index 00000000..2a7eb0b7 --- /dev/null +++ b/node_modules/mdast-util-from-markdown/dev/index.d.ts @@ -0,0 +1,23 @@ +export type {Encoding, Token, Value} from 'micromark-util-types' +export type { + CompileContext, + CompileData, + Extension, + Handles, + Handle, + OnEnterError, + OnExitError, + Options, + Transform +} from './lib/types.js' +export {fromMarkdown} from './lib/index.js' + +declare module 'micromark-util-types' { + interface TokenTypeMap { + listItem: 'listItem' + } + + interface Token { + _spread?: boolean + } +} diff --git a/node_modules/mdast-util-from-markdown/dev/index.js b/node_modules/mdast-util-from-markdown/dev/index.js new file mode 100644 index 00000000..d8bcf034 --- /dev/null +++ b/node_modules/mdast-util-from-markdown/dev/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts`. +export {fromMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-from-markdown/index.d.ts b/node_modules/mdast-util-from-markdown/index.d.ts new file mode 100644 index 00000000..2a7eb0b7 --- /dev/null +++ b/node_modules/mdast-util-from-markdown/index.d.ts @@ -0,0 +1,23 @@ +export type {Encoding, Token, Value} from 'micromark-util-types' +export type { + CompileContext, + CompileData, + Extension, + Handles, + Handle, + OnEnterError, + OnExitError, + Options, + Transform +} from './lib/types.js' +export {fromMarkdown} from './lib/index.js' + +declare module 'micromark-util-types' { + interface TokenTypeMap { + listItem: 'listItem' + } + + interface Token { + _spread?: boolean + } +} diff --git a/node_modules/mdast-util-from-markdown/index.js b/node_modules/mdast-util-from-markdown/index.js new file mode 100644 index 00000000..6ceffc9a --- /dev/null +++ b/node_modules/mdast-util-from-markdown/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts`. +export { fromMarkdown } from './lib/index.js'; \ No newline at end of file diff --git a/node_modules/mdast-util-from-markdown/license b/node_modules/mdast-util-from-markdown/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/mdast-util-from-markdown/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-from-markdown/package.json b/node_modules/mdast-util-from-markdown/package.json new file mode 100644 index 00000000..e102ee6a --- /dev/null +++ b/node_modules/mdast-util-from-markdown/package.json @@ -0,0 +1,139 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/mdast-util-from-markdown/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "description": "mdast utility to parse markdown", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "commonmark.json": "^0.31.0", + "esbuild": "^0.24.0", + "gzip-size-cli": "^5.0.0", + "hast-util-from-html": "^2.0.0", + "hast-util-to-html": "^9.0.0", + "mdast-util-to-hast": "^13.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "terser": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.59.0" + }, + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "ast", + "markdown", + "markup", + "mdast-util", + "mdast", + "parse", + "syntax", + "tree", + "unist", + "utility", + "util" + ], + "license": "MIT", + "name": "mdast-util-from-markdown", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/mdast-util-from-markdown", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build && esbuild . --bundle --minify | terser | gzip-size --raw", + "format": "remark --frail --quiet --output -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api-dev": "node --conditions development test/index.js", + "test-api-prod": "node --conditions production test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "2.0.2", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": "test/**/*.js", + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "complexity": "off", + "max-depth": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/mdast-util-from-markdown/readme.md b/node_modules/mdast-util-from-markdown/readme.md new file mode 100644 index 00000000..ccee0bbe --- /dev/null +++ b/node_modules/mdast-util-from-markdown/readme.md @@ -0,0 +1,537 @@ +# mdast-util-from-markdown + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**[mdast][]** utility that turns markdown into a syntax tree. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`fromMarkdown(value[, encoding][, options])`](#frommarkdownvalue-encoding-options) + * [`CompileContext`](#compilecontext) + * [`CompileData`](#compiledata) + * [`Encoding`](#encoding) + * [`Extension`](#extension) + * [`Handle`](#handle) + * [`OnEnterError`](#onentererror) + * [`OnExitError`](#onexiterror) + * [`Options`](#options) + * [`Token`](#token) + * [`Transform`](#transform) + * [`Value`](#value) +* [List of extensions](#list-of-extensions) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that takes markdown input and turns it into an +[mdast][] syntax tree. + +This utility uses [`micromark`][micromark], which turns markdown into tokens, +and then turns those tokens into nodes. +This package is used inside [`remark-parse`][remark-parse], which focusses on +making it easier to transform content by abstracting these internals away. + +## When should I use this? + +If you want to handle syntax trees manually, use this. +When you *just* want to turn markdown into HTML, use [`micromark`][micromark] +instead. +For an easier time processing content, use the **[remark][]** ecosystem instead. + +You can combine this package with other packages to add syntax extensions to +markdown. +Notable examples that deeply integrate with this package are +[`mdast-util-gfm`][mdast-util-gfm], +[`mdast-util-mdx`][mdast-util-mdx], +[`mdast-util-frontmatter`][mdast-util-frontmatter], +[`mdast-util-math`][mdast-util-math], and +[`mdast-util-directive`][mdast-util-directive]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-from-markdown +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {fromMarkdown} from 'https://esm.sh/mdast-util-from-markdown@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say we have the following markdown file `example.md`: + +```markdown +## Hello, *World*! +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {fromMarkdown} from 'mdast-util-from-markdown' + +const doc = await fs.readFile('example.md') +const tree = fromMarkdown(doc) + +console.log(tree) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'heading', + depth: 2, + children: [ + {type: 'text', value: 'Hello, '}, + {type: 'emphasis', children: [{type: 'text', value: 'World'}]}, + {type: 'text', value: '!'} + ] + } + ] +} +``` + +## API + +This package exports the identifier [`fromMarkdown`][api-from-markdown]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development example.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `fromMarkdown(value[, encoding][, options])` + +Turn markdown into a syntax tree. + +###### Overloads + +* `(value: Value, encoding: Encoding, options?: Options) => Root` +* `(value: Value, options?: Options) => Root` + +###### Parameters + +* `value` ([`Value`][api-value]) + — markdown to parse +* `encoding` ([`Encoding`][api-encoding], default: `'utf8'`) + — [character encoding][encoding] for when `value` is + [`Uint8Array`][uint8-array] +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +mdast tree ([`Root`][root]). + +### `CompileContext` + +mdast compiler context (TypeScript type). + +###### Fields + +* `stack` ([`Array`][node]) + — stack of nodes +* `tokenStack` (`Array<[Token, OnEnterError | undefined]>`) + — stack of tokens +* `data` ([`CompileData`][api-compile-data]) + — info passed around; key/value store +* `buffer` (`() => undefined`) + — capture some of the output data +* `resume` (`() => string`) + — stop capturing and access the output data +* `enter` (`(node: Node, token: Token, onError?: OnEnterError) => undefined`) + — enter a node +* `exit` (`(token: Token, onError?: OnExitError) => undefined`) + — exit a node +* `sliceSerialize` (`(token: Token, expandTabs?: boolean) => string`) + — get the string value of a token +* `config` (`Required`) + — configuration + +### `CompileData` + +Interface of tracked data (TypeScript type). + +###### Type + +```ts +interface CompileData { /* see code */ } +``` + +When working on extensions that use more data, extend the corresponding +interface to register their types: + +```ts +declare module 'mdast-util-from-markdown' { + interface CompileData { + // Register a new field. + mathFlowInside?: boolean | undefined + } +} +``` + +### `Encoding` + +Encodings supported by the [`Uint8Array`][uint8-array] class (TypeScript type). + +See [`micromark`][micromark-api] for more info. + +###### Type + +```ts +type Encoding = 'utf8' | /* … */ +``` + +### `Extension` + +Change how markdown tokens from micromark are turned into mdast (TypeScript +type). + +###### Properties + +* `canContainEols` (`Array`, optional) + — token types where line endings are used +* `enter` ([`Record`][api-handle], optional) + — opening handles +* `exit` ([`Record`][api-handle], optional) + — closing handles +* `transforms` ([`Array`][api-transform], optional) + — tree transforms + +### `Handle` + +Handle a token (TypeScript type). + +###### Parameters + +* `this` ([`CompileContext`][api-compile-context]) + — context +* `token` ([`Token`][api-token]) + — current token + +###### Returns + +Nothing (`undefined`). + +### `OnEnterError` + +Handle the case where the `right` token is open, but it is closed (by the +`left` token) or because we reached the end of the document (TypeScript type). + +###### Parameters + +* `this` ([`CompileContext`][api-compile-context]) + — context +* `left` ([`Token`][api-token] or `undefined`) + — left token +* `right` ([`Token`][api-token]) + — right token + +###### Returns + +Nothing (`undefined`). + +### `OnExitError` + +Handle the case where the `right` token is open but it is closed by +exiting the `left` token (TypeScript type). + +###### Parameters + +* `this` ([`CompileContext`][api-compile-context]) + — context +* `left` ([`Token`][api-token]) + — left token +* `right` ([`Token`][api-token]) + — right token + +###### Returns + +Nothing (`undefined`). + +### `Options` + +Configuration (TypeScript type). + +###### Properties + +* `extensions` ([`Array`][micromark-extension], optional) + — micromark extensions to change how markdown is parsed +* `mdastExtensions` ([`Array>`][api-extension], + optional) + — extensions for this utility to change how tokens are turned into a tree + +### `Token` + +Token from micromark (TypeScript type). + +###### Type + +```ts +type Token = { /* … */ } +``` + +### `Transform` + +Extra transform, to change the AST afterwards (TypeScript type). + +###### Parameters + +* `tree` ([`Root`][root]) + — tree to transform + +###### Returns + +New tree ([`Root`][root]) or nothing (in which case the current tree is used). + +### `Value` + +Contents of the file (TypeScript type). + +See [`micromark`][micromark-api] for more info. + +###### Type + +```ts +type Value = Uint8Array | string +``` + +## List of extensions + +* [`syntax-tree/mdast-util-directive`](https://github.com/syntax-tree/mdast-util-directive) + — directives +* [`syntax-tree/mdast-util-frontmatter`](https://github.com/syntax-tree/mdast-util-frontmatter) + — frontmatter (YAML, TOML, more) +* [`syntax-tree/mdast-util-gfm`](https://github.com/syntax-tree/mdast-util-gfm) + — GFM +* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal) + — GFM autolink literals +* [`syntax-tree/mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote) + — GFM footnotes +* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough) + — GFM strikethrough +* [`syntax-tree/mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table) + — GFM tables +* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item) + — GFM task list items +* [`syntax-tree/mdast-util-math`](https://github.com/syntax-tree/mdast-util-math) + — math +* [`syntax-tree/mdast-util-mdx`](https://github.com/syntax-tree/mdast-util-mdx) + — MDX +* [`syntax-tree/mdast-util-mdx-expression`](https://github.com/syntax-tree/mdast-util-mdx-expression) + — MDX expressions +* [`syntax-tree/mdast-util-mdx-jsx`](https://github.com/syntax-tree/mdast-util-mdx-jsx) + — MDX JSX +* [`syntax-tree/mdast-util-mdxjs-esm`](https://github.com/syntax-tree/mdast-util-mdxjs-esm) + — MDX ESM + +## Syntax + +Markdown is parsed according to CommonMark. +Extensions can add support for other syntax. +If you’re interested in extending markdown, +[more information is available in micromark’s readme][micromark-extension]. + +## Syntax tree + +The syntax tree is [mdast][]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`CompileContext`][api-compile-context], +[`CompileData`][api-compile-data], +[`Encoding`][api-encoding], +[`Extension`][api-extension], +[`Handle`][api-handle], +[`OnEnterError`][api-on-enter-error], +[`OnExitError`][api-on-exit-error], +[`Options`][api-options], +[`Token`][api-token], +[`Transform`][api-transform], and +[`Value`][api-value]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-from-markdown@^2`, compatible with Node.js 16. + +## Security + +As markdown is sometimes used for HTML, and improper use of HTML can open you up +to a [cross-site scripting (XSS)][xss] attack, use of `mdast-util-from-markdown` +can also be unsafe. +When going to HTML, use this utility in combination with +[`hast-util-sanitize`][hast-util-sanitize] to make the tree safe. + +## Related + +* [`syntax-tree/mdast-util-to-markdown`](https://github.com/syntax-tree/mdast-util-to-markdown) + — serialize mdast as markdown +* [`micromark/micromark`](https://github.com/micromark/micromark) + — parse markdown +* [`remarkjs/remark`](https://github.com/remarkjs/remark) + — process markdown + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-from-markdown/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-from-markdown/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-from-markdown.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-from-markdown + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-from-markdown.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-from-markdown + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-from-markdown + +[size]: https://bundlejs.com/?q=mdast-util-from-markdown + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx + +[mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter + +[mdast-util-math]: https://github.com/syntax-tree/mdast-util-math + +[mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive + +[root]: https://github.com/syntax-tree/mdast#root + +[uint8-array]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array + +[encoding]: https://nodejs.org/api/util.html#whatwg-supported-encodings + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[micromark]: https://github.com/micromark/micromark + +[micromark-api]: https://github.com/micromark/micromark/tree/main/packages/micromark#micromarkvalue-encoding-options + +[micromark-extension]: https://github.com/micromark/micromark#extensions + +[remark]: https://github.com/remarkjs/remark + +[remark-parse]: https://github.com/remarkjs/remark/tree/main/packages/remark-parse + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[api-from-markdown]: #frommarkdownvalue-encoding-options + +[api-compile-context]: #compilecontext + +[api-compile-data]: #compiledata + +[api-encoding]: #encoding + +[api-extension]: #extension + +[api-handle]: #handle + +[api-on-enter-error]: #onentererror + +[api-on-exit-error]: #onexiterror + +[api-options]: #options + +[api-token]: #token + +[api-transform]: #transform + +[api-value]: #value diff --git a/node_modules/mdast-util-gfm-autolink-literal/index.d.ts b/node_modules/mdast-util-gfm-autolink-literal/index.d.ts new file mode 100644 index 00000000..fa02be6f --- /dev/null +++ b/node_modules/mdast-util-gfm-autolink-literal/index.d.ts @@ -0,0 +1 @@ +export { gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown } from "./lib/index.js"; diff --git a/node_modules/mdast-util-gfm-autolink-literal/index.js b/node_modules/mdast-util-gfm-autolink-literal/index.js new file mode 100644 index 00000000..029dcffb --- /dev/null +++ b/node_modules/mdast-util-gfm-autolink-literal/index.js @@ -0,0 +1,4 @@ +export { + gfmAutolinkLiteralFromMarkdown, + gfmAutolinkLiteralToMarkdown +} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-autolink-literal/license b/node_modules/mdast-util-gfm-autolink-literal/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-gfm-autolink-literal/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm-autolink-literal/package.json b/node_modules/mdast-util-gfm-autolink-literal/package.json new file mode 100644 index 00000000..b0fea137 --- /dev/null +++ b/node_modules/mdast-util-gfm-autolink-literal/package.json @@ -0,0 +1,106 @@ +{ + "name": "mdast-util-gfm-autolink-literal", + "version": "2.0.1", + "description": "mdast extension to parse and serialize GFM autolink literals", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "autolink", + "auto", + "link", + "literal", + "url", + "raw", + "gfm" + ], + "repository": "syntax-tree/mdast-util-gfm-autolink-literal", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "hast-util-to-html": "^9.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-hast": "^13.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.59.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": "test/**/*.js", + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/mdast-util-gfm-autolink-literal/readme.md b/node_modules/mdast-util-gfm-autolink-literal/readme.md new file mode 100644 index 00000000..309466e2 --- /dev/null +++ b/node_modules/mdast-util-gfm-autolink-literal/readme.md @@ -0,0 +1,334 @@ +# mdast-util-gfm-autolink-literal + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] autolink literals. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmAutolinkLiteralFromMarkdown()`](#gfmautolinkliteralfrommarkdown) + * [`gfmAutolinkLiteralToMarkdown()`](#gfmautolinkliteraltomarkdown) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM autolink literals +syntax in markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +GFM autolinks in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +GFM autolinks in syntax trees to markdown). + +GitHub employs different algorithms to autolink: one at parse time and one at +transform time (similar to how `@mentions` are done at transform time). +This difference can be observed because character references and escapes are +handled differently. +But also because issues/PRs/comments omit (perhaps by accident?) the second +algorithm for `www.`, `http://`, and `https://` links (but not for email links). + +As the corresponding micromark extension +[`micromark-extension-gfm-autolink-literal`][extension] is a syntax extension, +it can only perform the first algorithm. +The tree extension `gfmAutolinkLiteralFromMarkdown` from this package can +perform the second algorithm, and as they are combined, both are done. + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with +[`micromark-extension-gfm-autolink-literal`][extension]. + +When you don’t need a syntax tree, you can use [`micromark`][micromark] +directly with `micromark-extension-gfm-autolink-literal`. + +When you are working with syntax trees and want all of GFM, use +[`mdast-util-gfm`][mdast-util-gfm] instead. + +All these packages are used [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm-autolink-literal +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown} from 'https://esm.sh/mdast-util-gfm-autolink-literal@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +www.example.com, https://example.com, and contact@example.com. +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {gfmAutolinkLiteral} from 'micromark-extension-gfm-autolink-literal' +import {fromMarkdown} from 'mdast-util-from-markdown' +import { + gfmAutolinkLiteralFromMarkdown, + gfmAutolinkLiteralToMarkdown +} from 'mdast-util-gfm-autolink-literal' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.md') + +const tree = fromMarkdown(doc, { + extensions: [gfmAutolinkLiteral()], + mdastExtensions: [gfmAutolinkLiteralFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [gfmAutolinkLiteralToMarkdown()]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'link', + title: null, + url: 'http://www.example.com', + children: [{type: 'text', value: 'www.example.com'}] + }, + {type: 'text', value: ', '}, + { + type: 'link', + title: null, + url: 'https://example.com', + children: [{type: 'text', value: 'https://example.com'}] + }, + {type: 'text', value: ', and '}, + { + type: 'link', + title: null, + url: 'mailto:contact@example.com', + children: [{type: 'text', value: 'contact@example.com'}] + }, + {type: 'text', value: '.'} + ] + } + ] +} +``` + +```markdown +[www.example.com](http://www.example.com), , and . +``` + +## API + +This package exports the identifiers +[`gfmAutolinkLiteralFromMarkdown`][api-gfm-autolink-literal-from-markdown] and +[`gfmAutolinkLiteralToMarkdown`][api-gfm-autolink-literal-to-markdown]. +There is no default export. + +### `gfmAutolinkLiteralFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM autolink literals in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM autolink literals +([`FromMarkdownExtension`][from-markdown-extension]). + +### `gfmAutolinkLiteralToMarkdown()` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to +enable GFM autolink literals in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM autolink literals +([`ToMarkdownExtension`][to-markdown-extension]). + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Syntax + +See [Syntax in `micromark-extension-gfm-autolink-literal`][syntax]. + +## Syntax tree + +There are no interfaces added to **[mdast][]** by this utility, as it reuses +the existing **[Link][dfn-link]** interface. + +## Types + +This package is fully typed with [TypeScript][]. +It does not export additional types. + +The `Link` type of the mdast nodes is exposed from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-gfm-autolink-literal@^2`, compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`remarkjs/remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm] + — same but all of GFM (autolink literals, footnotes, strikethrough, tables, + tasklists) +* [`micromark/micromark-extension-gfm-autolink-literal`][extension] + — micromark extension to parse GFM autolink literals + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-autolink-literal.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-autolink-literal + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-autolink-literal.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm-autolink-literal + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-autolink-literal + +[size]: https://bundlejs.com/?q=mdast-util-gfm-autolink-literal + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[micromark]: https://github.com/micromark/micromark + +[extension]: https://github.com/micromark/micromark-extension-gfm-autolink-literal + +[syntax]: https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax + +[gfm]: https://github.github.com/gfm/ + +[dfn-link]: https://github.com/syntax-tree/mdast#link + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[api-gfm-autolink-literal-from-markdown]: #gfmautolinkliteralfrommarkdown + +[api-gfm-autolink-literal-to-markdown]: #gfmautolinkliteraltomarkdown diff --git a/node_modules/mdast-util-gfm-footnote/index.d.ts b/node_modules/mdast-util-gfm-footnote/index.d.ts new file mode 100644 index 00000000..0ff949a3 --- /dev/null +++ b/node_modules/mdast-util-gfm-footnote/index.d.ts @@ -0,0 +1,34 @@ +export {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from './lib/index.js' + +export interface ToMarkdownOptions { + // To do: next major: change default. + /** + * Use a blank line for the first line of footnote definitions + * (`boolean`, default: `false`). + */ + firstLineBlank?: boolean | null | undefined +} + +declare module 'mdast-util-to-markdown' { + interface ConstructNameMap { + /** + * Footnote definition. + * + * ```markdown + * > | [^a]: B. + * ^^^^^^^^ + * ``` + */ + footnoteDefinition: 'footnoteDefinition' + + /** + * Footnote reference. + * + * ```markdown + * > | A[^b]. + * ^^^^ + * ``` + */ + footnoteReference: 'footnoteReference' + } +} diff --git a/node_modules/mdast-util-gfm-footnote/index.js b/node_modules/mdast-util-gfm-footnote/index.js new file mode 100644 index 00000000..be45f3ae --- /dev/null +++ b/node_modules/mdast-util-gfm-footnote/index.js @@ -0,0 +1,2 @@ +// Note: extra types exported from `index.d.ts`. +export {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-footnote/license b/node_modules/mdast-util-gfm-footnote/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/mdast-util-gfm-footnote/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm-footnote/package.json b/node_modules/mdast-util-gfm-footnote/package.json new file mode 100644 index 00000000..9cc99725 --- /dev/null +++ b/node_modules/mdast-util-gfm-footnote/package.json @@ -0,0 +1,111 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm-footnote/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "description": "mdast extension to parse and serialize GFM footnotes", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "footnote", + "gfm", + "markdown", + "markup", + "mdast-util", + "mdast", + "note", + "unist", + "utility", + "util" + ], + "license": "MIT", + "name": "mdast-util-gfm-footnote", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/mdast-util-gfm-footnote", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api-dev": "node --conditions development test.js", + "test-api-prod": "node --conditions production test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "2.1.0", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "unicorn/prefer-at": "off" + } + } +} diff --git a/node_modules/mdast-util-gfm-footnote/readme.md b/node_modules/mdast-util-gfm-footnote/readme.md new file mode 100644 index 00000000..b3fda579 --- /dev/null +++ b/node_modules/mdast-util-gfm-footnote/readme.md @@ -0,0 +1,494 @@ +# mdast-util-gfm-footnote + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] footnotes. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmFootnoteFromMarkdown()`](#gfmfootnotefrommarkdown) + * [`gfmFootnoteToMarkdown(options?)`](#gfmfootnotetomarkdownoptions) + * [`ToMarkdownOptions`](#tomarkdownoptions) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM footnote syntax +in markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +footnotes in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +footnotes in syntax trees to markdown). + +GFM footnotes were [announced September 30, 2021][post] but are not specified. +Their implementation on github.com is currently buggy. +The bugs have been reported on [`cmark-gfm`][cmark-gfm]. + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-gfm-footnote`][micromark-extension-gfm-footnote]. + +When you don’t need a syntax tree, you can use [`micromark`][micromark] +directly with `micromark-extension-gfm-footnote`. + +When you are working with syntax trees and want all of GFM, use +[`mdast-util-gfm`][mdast-util-gfm] instead. + +All these packages are used [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. +If your content is not in English, you should configure that utility. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm-footnote +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +In the Solar System, Mercury[^mercury] and Venus[^venus] have very small tilts. + +[^mercury]: + **Mercury** is the first planet from the Sun and the smallest + in the Solar System. + +[^venus]: + **Venus** is the second planet from + the Sun. +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {fromMarkdown} from 'mdast-util-from-markdown' +import { + gfmFootnoteFromMarkdown, + gfmFootnoteToMarkdown +} from 'mdast-util-gfm-footnote' +import {toMarkdown} from 'mdast-util-to-markdown' +import {gfmFootnote} from 'micromark-extension-gfm-footnote' + +const value = await fs.readFile('example.md', 'utf8') + +const tree = fromMarkdown(value, { + extensions: [gfmFootnote()], + mdastExtensions: [gfmFootnoteFromMarkdown()] +}) + +console.log(tree) + +const result = toMarkdown(tree, { + extensions: [gfmFootnoteToMarkdown({firstLineBlank: true})] +}) + +console.log(result) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + {type: 'text', value: 'In the Solar System, Mercury'}, + {type: 'footnoteReference', identifier: 'mercury', label: 'mercury'}, + {type: 'text', value: ' and Venus'}, + {type: 'footnoteReference', identifier: 'venus', label: 'venus'}, + {type: 'text', value: ' have very small tilts.'} + ] + }, + { + type: 'footnoteDefinition', + identifier: 'mercury', + label: 'mercury', + children: [ + { + type: 'paragraph', + children: [ + {type: 'strong', children: [{type: 'text', value: 'Mercury'}]}, + { + type: 'text', + value: + ' is the first planet from the Sun and the smallest\n' + + 'in the Solar System.' + } + ] + } + ] + }, + { + type: 'footnoteDefinition', + identifier: 'venus', + label: 'venus', + children: [ + { + type: 'paragraph', + children: [ + {type: 'strong', children: [{type: 'text', value: 'Venus'}]}, + {type: 'text', value: ' is the second planet from\nthe Sun.'} + ] + } + ] + } + ] +} +``` + +```markdown +In the Solar System, Mercury[^mercury] and Venus[^venus] have very small tilts. + +[^mercury]: + **Mercury** is the first planet from the Sun and the smallest + in the Solar System. + +[^venus]: + **Venus** is the second planet from + the Sun. +``` + +## API + +This package exports the identifiers +[`gfmFootnoteFromMarkdown`][api-gfmfootnotefrommarkdown] and +[`gfmFootnoteToMarkdown`][api-gfmfootnotetomarkdown]. +There is no default export. +It exports the type [`ToMarkdownOptions`][api-to-markdown-options]. + +### `gfmFootnoteFromMarkdown()` + +Create an extension for +[`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM footnotes in markdown. + +###### Returns + +Extension for `mdast-util-from-markdown` +([`FromMarkdownExtension`][frommarkdownextension]). + +### `gfmFootnoteToMarkdown(options?)` + +Create an extension for +[`mdast-util-to-markdown`][mdast-util-to-markdown] +to enable GFM footnotes in markdown. + +###### Parameters + +* `options` ([`ToMarkdownOptions`][api-to-markdown-options], optional) + — configuration + +###### Returns + +Extension for `mdast-util-to-markdown` +([`ToMarkdownExtension`][tomarkdownextension]). + +### `ToMarkdownOptions` + +Configuration (TypeScript type). + +###### Fields + +* `firstLineBlank` (`boolean`, default: `false`) + — use a blank line for the first line of footnote definitions + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. +If your content is not in English, you should configure that utility. + +## Syntax + +See [Syntax in `micromark-extension-gfm-footnote`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `FootnoteDefinition` + +```idl +interface FootnoteDefinition <: Parent { + type: 'footnoteDefinition' + children: [FlowContent] +} + +FootnoteDefinition includes Association +``` + +**FootnoteDefinition** (**[Parent][dfn-parent]**) represents content relating +to the document that is outside its flow. + +**FootnoteDefinition** can be used where **[flow][dfn-flow-content]** content +is expected. +Its content model is also **[flow][dfn-flow-content]** content. + +**FootnoteDefinition** includes the mixin +**[Association][dfn-mxn-association]**. + +**FootnoteDefinition** should be associated with +**[FootnoteReferences][dfn-footnote-reference]**. + +For example, the following markdown: + +```markdown +[^alpha]: bravo and charlie. +``` + +Yields: + +```js +{ + type: 'footnoteDefinition', + identifier: 'alpha', + label: 'alpha', + children: [{ + type: 'paragraph', + children: [{type: 'text', value: 'bravo and charlie.'}] + }] +} +``` + +#### `FootnoteReference` + +```idl +interface FootnoteReference <: Node { + type: 'footnoteReference' +} + +FootnoteReference includes Association +``` + +**FootnoteReference** (**[Node][dfn-node]**) represents a marker through +association. + +**FootnoteReference** can be used where +**[phrasing][dfn-phrasing-content]** content is expected. +It has no content model. + +**FootnoteReference** includes the mixin **[Association][dfn-mxn-association]**. + +**FootnoteReference** should be associated with a +**[FootnoteDefinition][dfn-footnote-definition]**. + +For example, the following markdown: + +```markdown +[^alpha] +``` + +Yields: + +```js +{ + type: 'footnoteReference', + identifier: 'alpha', + label: 'alpha' +} +``` + +### Content model + +#### `FlowContent` (GFM footnotes) + +```idl +type FlowContentGfm = FootnoteDefinition | FlowContent +``` + +#### `PhrasingContent` (GFM footnotes) + +```idl +type PhrasingContentGfm = FootnoteReference | PhrasingContent +``` + +## Types + +This package is fully typed with [TypeScript][]. +It does not export additional types. + +The `FootnoteDefinition` and `FootnoteReference` types of the mdast nodes are +exposed from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-gfm-footnote@^2`, compatible with Node.js 16. + +## Related + +* [`remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`mdast-util-gfm`][mdast-util-gfm] + — same but all of GFM (autolink literals, footnotes, strikethrough, tables, + tasklists) +* [`micromark-extension-gfm-footnote`][micromark-extension-gfm-footnote] + — micromark extension to parse GFM footnotes + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[api-gfmfootnotefrommarkdown]: #gfmfootnotefrommarkdown + +[api-gfmfootnotetomarkdown]: #gfmfootnotetomarkdownoptions + +[api-to-markdown-options]: #tomarkdownoptions + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm-footnote/actions + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-footnote/workflows/main/badge.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[cmark-gfm]: https://github.com/github/cmark-gfm + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[collective]: https://opencollective.com/unified + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-footnote + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-footnote.svg + +[dfn-flow-content]: #flowcontent-gfm-footnotes + +[dfn-footnote-definition]: #footnotedefinition + +[dfn-footnote-reference]: #footnotereference + +[dfn-mxn-association]: https://github.com/syntax-tree/mdast#association + +[dfn-node]: https://github.com/syntax-tree/unist#node + +[dfn-parent]: https://github.com/syntax-tree/mdast#parent + +[dfn-phrasing-content]: #phrasingcontent-gfm-footnotes + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm-footnote + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-footnote.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[frommarkdownextension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[gfm]: https://github.github.com/gfm/ + +[health]: https://github.com/syntax-tree/.github + +[license]: license + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm-footnote]: https://github.com/micromark/micromark-extension-gfm-footnote + +[npm]: https://docs.npmjs.com/cli/install + +[post]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/ + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[size]: https://bundlejs.com/?q=mdast-util-gfm-footnote + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-footnote + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[syntax]: https://github.com/micromark/micromark-extension-gfm-footnote#syntax + +[tomarkdownextension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/mdast-util-gfm-strikethrough/index.d.ts b/node_modules/mdast-util-gfm-strikethrough/index.d.ts new file mode 100644 index 00000000..d3b616a1 --- /dev/null +++ b/node_modules/mdast-util-gfm-strikethrough/index.d.ts @@ -0,0 +1,19 @@ +export { + gfmStrikethroughFromMarkdown, + gfmStrikethroughToMarkdown +} from './lib/index.js' + +// Add custom data tracked to turn a syntax tree into markdown. +declare module 'mdast-util-to-markdown' { + interface ConstructNameMap { + /** + * Whole strikethrough. + * + * ```markdown + * > | ~~a~~ + * ^^^^^ + * ``` + */ + strikethrough: 'strikethrough' + } +} diff --git a/node_modules/mdast-util-gfm-strikethrough/index.js b/node_modules/mdast-util-gfm-strikethrough/index.js new file mode 100644 index 00000000..97c87f60 --- /dev/null +++ b/node_modules/mdast-util-gfm-strikethrough/index.js @@ -0,0 +1,5 @@ +// Note: extra types in `index.d.ts`. +export { + gfmStrikethroughFromMarkdown, + gfmStrikethroughToMarkdown +} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-strikethrough/license b/node_modules/mdast-util-gfm-strikethrough/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-gfm-strikethrough/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm-strikethrough/package.json b/node_modules/mdast-util-gfm-strikethrough/package.json new file mode 100644 index 00000000..d24d63fc --- /dev/null +++ b/node_modules/mdast-util-gfm-strikethrough/package.json @@ -0,0 +1,99 @@ +{ + "name": "mdast-util-gfm-strikethrough", + "version": "2.0.0", + "description": "mdast extension to parse and serialize GFM strikethrough", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "strikethrough", + "strike", + "through", + "del", + "delete", + "deletion", + "gfm" + ], + "repository": "syntax-tree/mdast-util-gfm-strikethrough", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm-strikethrough/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true + } +} diff --git a/node_modules/mdast-util-gfm-strikethrough/readme.md b/node_modules/mdast-util-gfm-strikethrough/readme.md new file mode 100644 index 00000000..d192cea6 --- /dev/null +++ b/node_modules/mdast-util-gfm-strikethrough/readme.md @@ -0,0 +1,350 @@ +# mdast-util-gfm-strikethrough + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] strikethrough. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmStrikethroughFromMarkdown()`](#gfmstrikethroughfrommarkdown) + * [`gfmStrikethroughToMarkdown()`](#gfmstrikethroughtomarkdown) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM strikethrough +syntax in markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +strikethrough in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +strikethrough in syntax trees to markdown). + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-gfm-strikethrough`][extension]. + +When you don’t need a syntax tree, you can use [`micromark`][micromark] +directly with `micromark-extension-gfm-strikethrough`. + +When you are working with syntax trees and want all of GFM, use +[`mdast-util-gfm`][mdast-util-gfm] instead. + +All these packages are used [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. +If you want a different element, you should configure that utility. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm-strikethrough +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown} from 'https://esm.sh/mdast-util-gfm-strikethrough@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +*Emphasis*, **importance**, and ~~strikethrough~~. +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {gfmStrikethrough} from 'micromark-extension-gfm-strikethrough' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown} from 'mdast-util-gfm-strikethrough' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.md') + +const tree = fromMarkdown(doc, { + extensions: [gfmStrikethrough()], + mdastExtensions: [gfmStrikethroughFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [gfmStrikethroughToMarkdown()]}) + +console.log(out) +``` + +Now, running `node example` yields: + +```js +{ + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + {type: 'emphasis', children: [{type: 'text', value: 'Emphasis'}]}, + {type: 'text', value: ', '}, + {type: 'strong', children: [{type: 'text', value: 'importance'}]}, + {type: 'text', value: ', and '}, + {type: 'delete', children: [{type: 'text', value: 'strikethrough'}]}, + {type: 'text', value: '.'} + ] + } + ] +} +``` + +```markdown +*Emphasis*, **importance**, and ~~strikethrough~~. +``` + +## API + +This package exports the identifiers +[`gfmStrikethroughFromMarkdown`][api-gfm-strikethrough-from-markdown] and +[`gfmStrikethroughToMarkdown`][api-gfm-strikethrough-to-markdown]. +There is no default export. + +### `gfmStrikethroughFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM strikethrough in markdown. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable GFM strikethrough +([`FromMarkdownExtension`][from-markdown-extension]). + +### `gfmStrikethroughToMarkdown()` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to +enable GFM strikethrough in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM strikethrough +([`ToMarkdownExtension`][to-markdown-extension]). + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. +If you want a different element, you should configure that utility. + +## Syntax + +See [Syntax in `micromark-extension-gfm-strikethrough`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `Delete` + +```idl +interface Delete <: Parent { + type: 'delete' + children: [TransparentContent] +} +``` + +**Delete** (**[Parent][dfn-parent]**) represents contents that are no longer +accurate or no longer relevant. + +**Delete** can be used where **[phrasing][dfn-phrasing-content]** +content is expected. +Its content model is **[transparent][dfn-transparent-content]** content. + +For example, the following markdown: + +```markdown +~~alpha~~ +``` + +Yields: + +```js +{ + type: 'delete', + children: [{type: 'text', value: 'alpha'}] +} +``` + +### Content model + +#### `PhrasingContent` (GFM strikethrough) + +```idl +type PhrasingContentGfm = Delete | PhrasingContent +``` + +## Types + +This package is fully typed with [TypeScript][]. +It does not export additional types. + +The `Delete` type of the mdast node is exposed from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-gfm-strikethrough@^2`, compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`remarkjs/remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm] + — same but all of GFM (autolink literals, footnotes, strikethrough, tables, + tasklists) +* [`micromark/micromark-extension-gfm-strikethrough`][extension] + — micromark extension to parse GFM strikethrough + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-strikethrough.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-strikethrough + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-strikethrough.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm-strikethrough + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-strikethrough + +[size]: https://bundlejs.com/?q=mdast-util-gfm-strikethrough + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[gfm]: https://github.github.com/gfm/ + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[mdast]: https://github.com/syntax-tree/mdast + +[dfn-transparent-content]: https://github.com/syntax-tree/mdast#transparentcontent + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[micromark]: https://github.com/micromark/micromark + +[extension]: https://github.com/micromark/micromark-extension-gfm-strikethrough + +[syntax]: https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax + +[dfn-parent]: https://github.com/syntax-tree/mdast#parent + +[dfn-phrasing-content]: #phrasingcontent-gfm-strikethrough + +[api-gfm-strikethrough-from-markdown]: #gfmstrikethroughfrommarkdown + +[api-gfm-strikethrough-to-markdown]: #gfmstrikethroughtomarkdown diff --git a/node_modules/mdast-util-gfm-table/index.d.ts b/node_modules/mdast-util-gfm-table/index.d.ts new file mode 100644 index 00000000..f616ca16 --- /dev/null +++ b/node_modules/mdast-util-gfm-table/index.d.ts @@ -0,0 +1,54 @@ +export type {Options} from './lib/index.js' + +export {gfmTableFromMarkdown, gfmTableToMarkdown} from './lib/index.js' + +// Add custom data tracked to turn markdown into a tree. +declare module 'mdast-util-from-markdown' { + interface CompileData { + /** + * Whether we’re currently in a table. + */ + inTable?: boolean | undefined + } +} + +// Add custom data tracked to turn a syntax tree into markdown. +declare module 'mdast-util-to-markdown' { + interface ConstructNameMap { + /** + * Whole table. + * + * ```markdown + * > | | a | + * ^^^^^ + * > | | - | + * ^^^^^ + * ``` + */ + table: 'table' + + /** + * Table cell. + * + * ```markdown + * > | | a | + * ^^^^^ + * | | - | + * ``` + */ + tableCell: 'tableCell' + + /** + * Table row. + * + * ```markdown + * > | | a | + * ^^^^^ + * | | - | + * ``` + */ + tableRow: 'tableRow' + } +} + +// Note: `Table` is exposed from `@types/mdast`. diff --git a/node_modules/mdast-util-gfm-table/index.js b/node_modules/mdast-util-gfm-table/index.js new file mode 100644 index 00000000..3f2bab47 --- /dev/null +++ b/node_modules/mdast-util-gfm-table/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {gfmTableFromMarkdown, gfmTableToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-table/license b/node_modules/mdast-util-gfm-table/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-gfm-table/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm-table/package.json b/node_modules/mdast-util-gfm-table/package.json new file mode 100644 index 00000000..2ca97be9 --- /dev/null +++ b/node_modules/mdast-util-gfm-table/package.json @@ -0,0 +1,101 @@ +{ + "name": "mdast-util-gfm-table", + "version": "2.0.0", + "description": "mdast extension to parse and serialize GFM tables", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "table", + "row", + "column", + "cell", + "tabular", + "gfm" + ], + "repository": "syntax-tree/mdast-util-gfm-table", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm-table/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "string-width": "^6.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true + } +} diff --git a/node_modules/mdast-util-gfm-table/readme.md b/node_modules/mdast-util-gfm-table/readme.md new file mode 100644 index 00000000..24068931 --- /dev/null +++ b/node_modules/mdast-util-gfm-table/readme.md @@ -0,0 +1,605 @@ +# mdast-util-gfm-table + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] tables. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTableFromMarkdown`](#gfmtablefrommarkdown) + * [`gfmTableToMarkdown(options?)`](#gfmtabletomarkdownoptions) + * [`Options`](#options) +* [Examples](#examples) + * [Example: `stringLength`](#example-stringlength) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Enumeration](#enumeration) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM table syntax in +markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +tables in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +tables in syntax trees to markdown). + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-gfm-table`][extension]. + +When you don’t need a syntax tree, you can use [`micromark`][micromark] +directly with `micromark-extension-gfm-table`. + +When you are working with syntax trees and want all of GFM, use +[`mdast-util-gfm`][mdast-util-gfm] instead. + +All these packages are used [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm-table +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'https://esm.sh/mdast-util-gfm-table@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +| a | b | c | d | +| - | :- | -: | :-: | +| e | f | +| g | h | i | j | k | +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {gfmTable} from 'micromark-extension-gfm-table' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.md') + +const tree = fromMarkdown(doc, { + extensions: [gfmTable()], + mdastExtensions: [gfmTableFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [gfmTableToMarkdown()]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'table', + align: [null, 'left', 'right', 'center'], + children: [ + { + type: 'tableRow', + children: [ + {type: 'tableCell', children: [{type: 'text', value: 'a'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'b'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'c'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'd'}]} + ] + }, + { + type: 'tableRow', + children: [ + {type: 'tableCell', children: [{type: 'text', value: 'e'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'f'}]} + ] + }, + { + type: 'tableRow', + children: [ + {type: 'tableCell', children: [{type: 'text', value: 'g'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'h'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'i'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'j'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'k'}]} + ] + } + ] + } + ] +} +``` + +```markdown +| a | b | c | d | | +| - | :- | -: | :-: | - | +| e | f | | | | +| g | h | i | j | k | +``` + +## API + +This package exports the identifiers +[`gfmTableFromMarkdown`][api-gfm-table-from-markdown] and +[`gfmTableToMarkdown`][api-gfm-table-to-markdown]. +There is no default export. + +### `gfmTableFromMarkdown` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM tables in markdown. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable GFM tables +([`FromMarkdownExtension`][from-markdown-extension]). + +### `gfmTableToMarkdown(options?)` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to +enable GFM tables in markdown. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM tables +([`ToMarkdownExtension`][to-markdown-extension]). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `tableCellPadding` (`boolean`, default: `true`) + — whether to add a space of padding between delimiters and cells +* `tablePipeAlign` (`boolean`, default: `true`) + — whether to align the delimiters +* `stringLength` (`((value: string) => number)`, default: `s => s.length`) + — function to detect the length of table cell content, used when aligning + the delimiters between cells + +## Examples + +### Example: `stringLength` + +It’s possible to align tables based on the visual width of cells. +First, let’s show the problem: + +```js +import {gfmTable} from 'micromark-extension-gfm-table' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = `| Alpha | Bravo | +| - | - | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta |` + +const tree = fromMarkdown(doc, { + extensions: [gfmTable], + mdastExtensions: [gfmTableFromMarkdown] +}) + +console.log(toMarkdown(tree, {extensions: [gfmTableToMarkdown()]})) +``` + +The above code shows how these utilities can be used to format markdown. +The output is as follows: + +```markdown +| Alpha | Bravo | +| -------- | ------- | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +To improve the alignment of these full-width characters and emoji, pass a +`stringLength` function that calculates the visual width of cells. +One such algorithm is [`string-width`][string-width]. +It can be used like so: + +```diff +@@ -2,6 +2,7 @@ import {gfmTable} from 'micromark-extension-gfm-table' + import {fromMarkdown} from 'mdast-util-from-markdown' + import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table' + import {toMarkdown} from 'mdast-util-to-markdown' ++import stringWidth from 'string-width' + + const doc = `| Alpha | Bravo | + | - | - | +@@ -13,4 +14,8 @@ const tree = fromMarkdown(doc, { + mdastExtensions: [gfmTableFromMarkdown()] + }) + +-console.log(toMarkdown(tree, {extensions: [gfmTableToMarkdown()]})) ++console.log( ++ toMarkdown(tree, { ++ extensions: [gfmTableToMarkdown({stringLength: stringWidth})] ++ }) ++) +``` + +The output of our code with these changes is as follows: + +```markdown +| Alpha | Bravo | +| ----- | ------- | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Syntax + +See [Syntax in `micromark-extension-gfm-table`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `Table` + +```idl +interface Table <: Parent { + type: 'table' + align: [alignType]? + children: [TableContent] +} +``` + +**Table** (**[Parent][dfn-parent]**) represents two-dimensional data. + +**Table** can be used where **[flow][dfn-flow-content]** content is expected. +Its content model is **[table][dfn-table-content]** content. + +The *[head][term-head]* of the node represents the labels of the columns. + +An `align` field can be present. +If present, it must be a list of **[alignTypes][dfn-enum-align-type]**. +It represents how cells in columns are aligned. + +For example, the following markdown: + +```markdown +| foo | bar | +| :-- | :-: | +| baz | qux | +``` + +Yields: + +```js +{ + type: 'table', + align: ['left', 'center'], + children: [ + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [{type: 'text', value: 'foo'}] + }, + { + type: 'tableCell', + children: [{type: 'text', value: 'bar'}] + } + ] + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [{type: 'text', value: 'baz'}] + }, + { + type: 'tableCell', + children: [{type: 'text', value: 'qux'}] + } + ] + } + ] +} +``` + +#### `TableRow` + +```idl +interface TableRow <: Parent { + type: "tableRow" + children: [RowContent] +} +``` + +**TableRow** (**[Parent][dfn-parent]**) represents a row of cells in a table. + +**TableRow** can be used where **[table][dfn-table-content]** content is +expected. +Its content model is **[row][dfn-row-content]** content. + +If the node is a *[head][term-head]*, it represents the labels of the columns +for its parent **[Table][dfn-table]**. + +For an example, see **[Table][dfn-table]**. + +#### `TableCell` + +```idl +interface TableCell <: Parent { + type: "tableCell" + children: [PhrasingContent] +} +``` + +**TableCell** (**[Parent][dfn-parent]**) represents a header cell in a +**[Table][dfn-table]**, if its parent is a *[head][term-head]*, or a data +cell otherwise. + +**TableCell** can be used where **[row][dfn-row-content]** content is expected. +Its content model is **[phrasing][dfn-phrasing-content]** content excluding +**[Break][dfn-break]** nodes. + +For an example, see **[Table][dfn-table]**. + +### Enumeration + +#### `alignType` + +```idl +enum alignType { + 'center' | 'left' | 'right' | null +} +``` + +**alignType** represents how phrasing content is aligned +([\[CSSTEXT\]][css-text]). + +* **`'left'`**: See the [`left`][css-left] value of the `text-align` CSS + property +* **`'right'`**: See the [`right`][css-right] value of the `text-align` + CSS property +* **`'center'`**: See the [`center`][css-center] value of the `text-align` + CSS property +* **`null`**: phrasing content is aligned as defined by the host environment + +### Content model + +#### `FlowContent` (GFM table) + +```idl +type FlowContentGfm = Table | FlowContent +``` + +#### `TableContent` + +```idl +type TableContent = TableRow +``` + +**Table** content represent the rows in a table. + +#### `RowContent` + +```idl +type RowContent = TableCell +``` + +**Row** content represent the cells in a row. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +The `Table`, `TableRow`, and `TableCell` types of the mdast nodes are exposed +from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-gfm-table@^2`, +compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`remarkjs/remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm] + — same but all of GFM (autolink literals, footnotes, strikethrough, tables, + tasklists) +* [`micromark/micromark-extension-gfm-table`][extension] + — micromark extension to parse GFM tables + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-table/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm-table/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-table.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-table + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-table.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm-table + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-table + +[size]: https://bundlejs.com/?q=mdast-util-gfm-table + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[micromark]: https://github.com/micromark/micromark + +[extension]: https://github.com/micromark/micromark-extension-gfm-table + +[syntax]: https://github.com/micromark/micromark-extension-gfm-table#syntax + +[gfm]: https://github.github.com/gfm/ + +[string-width]: https://github.com/sindresorhus/string-width + +[css-text]: https://drafts.csswg.org/css-text/ + +[css-left]: https://drafts.csswg.org/css-text/#valdef-text-align-left + +[css-right]: https://drafts.csswg.org/css-text/#valdef-text-align-right + +[css-center]: https://drafts.csswg.org/css-text/#valdef-text-align-center + +[term-head]: https://github.com/syntax-tree/unist#head + +[dfn-parent]: https://github.com/syntax-tree/mdast#parent + +[dfn-phrasing-content]: https://github.com/syntax-tree/mdast#phrasingcontent + +[dfn-break]: https://github.com/syntax-tree/mdast#break + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[api-gfm-table-from-markdown]: #gfmtablefrommarkdown + +[api-gfm-table-to-markdown]: #gfmtabletomarkdownoptions + +[api-options]: #options + +[dfn-flow-content]: #flowcontent-gfm-table + +[dfn-table-content]: #tablecontent + +[dfn-enum-align-type]: #aligntype + +[dfn-row-content]: #rowcontent + +[dfn-table]: #table diff --git a/node_modules/mdast-util-gfm-task-list-item/index.d.ts b/node_modules/mdast-util-gfm-task-list-item/index.d.ts new file mode 100644 index 00000000..9c0c593e --- /dev/null +++ b/node_modules/mdast-util-gfm-task-list-item/index.d.ts @@ -0,0 +1,4 @@ +export { + gfmTaskListItemFromMarkdown, + gfmTaskListItemToMarkdown +} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-task-list-item/index.js b/node_modules/mdast-util-gfm-task-list-item/index.js new file mode 100644 index 00000000..9c0c593e --- /dev/null +++ b/node_modules/mdast-util-gfm-task-list-item/index.js @@ -0,0 +1,4 @@ +export { + gfmTaskListItemFromMarkdown, + gfmTaskListItemToMarkdown +} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm-task-list-item/license b/node_modules/mdast-util-gfm-task-list-item/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-gfm-task-list-item/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm-task-list-item/package.json b/node_modules/mdast-util-gfm-task-list-item/package.json new file mode 100644 index 00000000..f0a5c21b --- /dev/null +++ b/node_modules/mdast-util-gfm-task-list-item/package.json @@ -0,0 +1,90 @@ +{ + "name": "mdast-util-gfm-task-list-item", + "version": "2.0.0", + "description": "mdast extension to parse and serialize GFM task list items", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "task", + "list", + "item", + "check", + "checkbox", + "todo", + "gfm" + ], + "repository": "syntax-tree/mdast-util-gfm-task-list-item", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm-task-list-item/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/mdast-util-gfm-task-list-item/readme.md b/node_modules/mdast-util-gfm-task-list-item/readme.md new file mode 100644 index 00000000..e7959c85 --- /dev/null +++ b/node_modules/mdast-util-gfm-task-list-item/readme.md @@ -0,0 +1,366 @@ +# mdast-util-gfm-task-list-item + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] task list items. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTaskListItemFromMarkdown()`](#gfmtasklistitemfrommarkdown) + * [`gfmTaskListItemToMarkdown()`](#gfmtasklistitemtomarkdown) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM task list item +syntax in markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +task lists in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +task lists in syntax trees to markdown). + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with +[`micromark-extension-gfm-task-list-item`][extension]. + +When you don’t need a syntax tree, you can use [`micromark`][micromark] +directly with `micromark-extension-gfm-task-list-item`. + +When you are working with syntax trees and want all of GFM, use +[`mdast-util-gfm`][mdast-util-gfm] instead. + +All these packages are used [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm-task-list-item +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'https://esm.sh/mdast-util-gfm-task-list-item@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +* [ ] To do +* [x] Done + +1. Mixed… +2. [x] …messages +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {gfmTaskListItem} from 'micromark-extension-gfm-task-list-item' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'mdast-util-gfm-task-list-item' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.md') + +const tree = fromMarkdown(doc, { + extensions: [gfmTaskListItem], + mdastExtensions: [gfmTaskListItemFromMarkdown] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [gfmTaskListItemToMarkdown]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: false, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'To do'}]} + ] + }, + { + type: 'listItem', + spread: false, + checked: true, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'Done'}]} + ] + } + ] + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'Mixed…'}]} + ] + }, + { + type: 'listItem', + spread: false, + checked: true, + children: [ + {type: 'paragraph', children: [{type: 'text', value: '…messages'}]} + ] + } + ] + } + ] +} +``` + +```markdown +* [ ] To do +* [x] Done + +1. Mixed… +2. [x] …messages +``` + +## API + +This package exports the identifiers +[`gfmTaskListItemFromMarkdown`][api-gfm-task-list-item-from-markdown] and +[`gfmTaskListItemToMarkdown`][api-gfm-task-list-item-to-markdown]. +There is no default export. + +### `gfmTaskListItemFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM task list items in markdown. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable GFM task list items +([`FromMarkdownExtension`][frommarkdownextension]). + +### `gfmTaskListItemToMarkdown()` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to +enable GFM task list items in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM task list items +([`ToMarkdownExtension`][tomarkdownextension]). + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Syntax + +See [Syntax in `micromark-extension-gfm-task-list-item`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `ListItem` (GFM) + +```idl +interface ListItemGfm <: ListItem { + checked: boolean? +} +``` + +In GFM, a `checked` field can be present. +It represents whether the item is done (when `true`), not done (when `false`), +or indeterminate or not applicable (when `null` or not present). + +### Content model + +#### `ListContent` (GFM) + +```idl +type ListContentGfm = ListItemGfm +``` + +## Types + +This package is fully typed with [TypeScript][]. +It does not export additional types. + +The `ListItem` type of the mdast nodes are exposed from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-gfm-task-list-item@^2`, compatible with Node.js 16. + +## Related + +* [`remarkjs/remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm] + — same but all of GFM (autolink literals, footnotes, strikethrough, tables, + tasklists) +* [`micromark/micromark-extension-gfm-task-list-item`][extension] + — micromark extension to parse GFM task list items + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-task-list-item.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-task-list-item + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-task-list-item.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm-task-list-item + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-task-list-item + +[size]: https://bundlejs.com/?q=mdast-util-gfm-task-list-item + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[micromark]: https://github.com/micromark/micromark + +[extension]: https://github.com/micromark/micromark-extension-gfm-task-list-item + +[syntax]: https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax + +[frommarkdownextension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[tomarkdownextension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[gfm]: https://github.github.com/gfm/ + +[api-gfm-task-list-item-from-markdown]: #gfmtasklistitemfrommarkdown + +[api-gfm-task-list-item-to-markdown]: #gfmtasklistitemtomarkdown diff --git a/node_modules/mdast-util-gfm/index.d.ts b/node_modules/mdast-util-gfm/index.d.ts new file mode 100644 index 00000000..f53affed --- /dev/null +++ b/node_modules/mdast-util-gfm/index.d.ts @@ -0,0 +1,12 @@ +import type {ToMarkdownOptions as FootnoteOptions} from 'mdast-util-gfm-footnote' +import type {Options as TableOptions} from 'mdast-util-gfm-table' + +/** + * Configuration for `gfmToMarkdown` from `mdast-util-gfm`. + * + * Currently supports options for `mdast-util-gfm-footnote` and + * `mdast-util-gfm-table`. + */ +export interface Options extends FootnoteOptions, TableOptions {} + +export {gfmFromMarkdown, gfmToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm/index.js b/node_modules/mdast-util-gfm/index.js new file mode 100644 index 00000000..24a40dee --- /dev/null +++ b/node_modules/mdast-util-gfm/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {gfmFromMarkdown, gfmToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-gfm/license b/node_modules/mdast-util-gfm/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/mdast-util-gfm/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-gfm/package.json b/node_modules/mdast-util-gfm/package.json new file mode 100644 index 00000000..296c0d7e --- /dev/null +++ b/node_modules/mdast-util-gfm/package.json @@ -0,0 +1,125 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/mdast-util-gfm/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "description": "mdast extension to parse and serialize GFM (GitHub Flavored Markdown)", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "github-slugger": "^2.0.0", + "hast-util-to-html": "^9.0.0", + "mdast-util-to-hast": "^13.0.0", + "micromark-extension-gfm": "^3.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "undici": "^7.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "autolink", + "gfm", + "github", + "markdown", + "markup", + "mdast-util", + "mdast", + "strikethrough", + "table", + "tagfilter", + "tasklist", + "unist", + "utility", + "util" + ], + "license": "MIT", + "name": "mdast-util-gfm", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/mdast-util-gfm", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "crawl": "node --conditions development script/crawl-tests.js", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "3.1.0", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": "test/**/*.js", + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true + } +} diff --git a/node_modules/mdast-util-gfm/readme.md b/node_modules/mdast-util-gfm/readme.md new file mode 100644 index 00000000..4fd7f0c8 --- /dev/null +++ b/node_modules/mdast-util-gfm/readme.md @@ -0,0 +1,497 @@ +# mdast-util-gfm + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [GFM][] (autolink literals, +footnotes, strikethrough, tables, tasklists). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmFromMarkdown()`](#gfmfrommarkdown) + * [`gfmToMarkdown(options?)`](#gfmtomarkdownoptions) + * [`Options`](#options) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for GFM syntax in +markdown to [mdast][]: autolink literals (`www.x.com`), footnotes (`[^1]`), +strikethrough (`~~stuff~~`), tables (`| cell |…`), and tasklists (`* [x]`). +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +GFM in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +GFM in syntax trees to markdown). + +## When to use this + +This project is useful when you want to support the same features that GitHub +does in files in a repo, Gists, and several other places. +Users frequently believe that some of these extensions, specifically autolink +literals and tables, are part of normal markdown, so using `mdast-util-gfm` will +help match your implementation to their understanding of markdown. +There are several edge cases where GitHub’s implementation works in unexpected +ways or even different than described in their spec, so *writing* in GFM is not +always the best choice. + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-gfm`][extension]. + +Instead of this package, you can also use the extensions separately: + +* [`mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal) + — support GFM autolink literals +* [`mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote) + — support GFM footnotes +* [`mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough) + — support GFM strikethrough +* [`mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table) + — support GFM tables +* [`mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item) + — support GFM tasklists + +A different utility, [`mdast-util-frontmatter`][mdast-util-frontmatter], adds +support for frontmatter. +GitHub supports YAML frontmatter for files in repos and Gists but they don’t +treat it as part of GFM. + +All these packages are used in [`remark-gfm`][remark-gfm], which +focusses on making it easier to transform content by abstracting these +internals away. + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. +If your content is not in English, you should configure that utility. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-gfm +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmFromMarkdown, gfmToMarkdown} from 'https://esm.sh/mdast-util-gfm@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +# GFM + +## Autolink literals + +www.example.com, https://example.com, and contact@example.com. + +## Footnote + +A note[^1] + +[^1]: Big note. + +## Strikethrough + +~one~ or ~~two~~ tildes. + +## Table + +| a | b | c | d | +| - | :- | -: | :-: | + +## Tasklist + +* [ ] to do +* [x] done +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmFromMarkdown, gfmToMarkdown} from 'mdast-util-gfm' +import {toMarkdown} from 'mdast-util-to-markdown' +import {gfm} from 'micromark-extension-gfm' + +const value = await fs.readFile('example.md', 'utf8') + +const tree = fromMarkdown(value, { + extensions: [gfm()], + mdastExtensions: [gfmFromMarkdown()] +}) + +console.log(tree) + +const result = toMarkdown(tree, {extensions: [gfmToMarkdown()]}) + +console.log(result) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + {type: 'heading', depth: 1, children: [{type: 'text', value: 'GFM'}]}, + { + type: 'heading', + depth: 2, + children: [{type: 'text', value: 'Autolink literals'}] + }, + { + type: 'paragraph', + children: [ + { + type: 'link', + title: null, + url: 'http://www.example.com', + children: [{type: 'text', value: 'www.example.com'}] + }, + {type: 'text', value: ', '}, + { + type: 'link', + title: null, + url: 'https://example.com', + children: [{type: 'text', value: 'https://example.com'}] + }, + {type: 'text', value: ', and '}, + { + type: 'link', + title: null, + url: 'mailto:contact@example.com', + children: [{type: 'text', value: 'contact@example.com'}] + }, + {type: 'text', value: '.'} + ] + }, + {type: 'heading', depth: 2, children: [{type: 'text', value: 'Footnote'}]}, + { + type: 'paragraph', + children: [ + {type: 'text', value: 'A note'}, + {type: 'footnoteReference', identifier: '1', label: '1'} + ] + }, + { + type: 'footnoteDefinition', + identifier: '1', + label: '1', + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'Big note.'}]} + ] + }, + { + type: 'heading', + depth: 2, + children: [{type: 'text', value: 'Strikethrough'}] + }, + { + type: 'paragraph', + children: [ + { + type: 'delete', + children: [{type: 'text', value: 'one'}] + }, + {type: 'text', value: ' or '}, + { + type: 'delete', + children: [{type: 'text', value: 'two'}] + }, + {type: 'text', value: ' tildes.'} + ] + }, + {type: 'heading', depth: 2, children: [{type: 'text', value: 'Table'}]}, + { + type: 'table', + align: [null, 'left', 'right', 'center'], + children: [ + { + type: 'tableRow', + children: [ + {type: 'tableCell', children: [{type: 'text', value: 'a'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'b'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'c'}]}, + {type: 'tableCell', children: [{type: 'text', value: 'd'}]} + ] + } + ] + }, + {type: 'heading', depth: 2, children: [{type: 'text', value: 'Tasklist'}]}, + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: false, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'to do'}]} + ] + }, + { + type: 'listItem', + spread: false, + checked: true, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'done'}]} + ] + } + ] + } + ] +} +``` + +```markdown +# GFM + +## Autolink literals + +[www.example.com](http://www.example.com), , and . + +## Footnote + +A note[^1] + +[^1]: Big note. + +## Strikethrough + +~~one~~ or ~~two~~ tildes. + +## Table + +| a | b | c | d | +| - | :- | -: | :-: | + +## Tasklist + +* [ ] to do +* [x] done +``` + +## API + +This package exports the identifiers [`gfmFromMarkdown`][api-gfm-from-markdown] +and [`gfmToMarkdown`][api-gfm-to-markdown]. +There is no default export. + +### `gfmFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable GFM (autolink literals, footnotes, strikethrough, tables, tasklists). + +###### Returns + +Extension for `mdast-util-from-markdown` to enable GFM +([`Array`][from-markdown-extension]). + +### `gfmToMarkdown(options?)` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] +to enable GFM (autolink literals, footnotes, strikethrough, tables, tasklists). + +###### Parameters + +* `options` ([`Options`][api-options]) + — configuration + +###### Returns + +Extension for `mdast-util-to-markdown` to enable GFM +([`Array`][to-markdown-extension]). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `firstLineBlank` (`boolean`, default: `false`) + — use a blank line for the first line of footnote definitions +* `stringLength` (`((value: string) => number)`, default: `s => s.length`) + — function to detect the length of table cell content, used when aligning + the delimiters between cells +* `tableCellPadding` (`boolean`, default: `true`) + — whether to add a space of padding between delimiters and cells +* `tablePipeAlign` (`boolean`, default: `true`) + — whether to align the delimiters + +## HTML + +This utility does not handle how markdown is turned to HTML. +That’s done by [`mdast-util-to-hast`][mdast-util-to-hast]. + +## Syntax + +See [Syntax in `micromark-extension-gfm`][syntax]. + +## Syntax tree + +This utility combines several mdast utilities. +See their readmes for the node types supported in the tree: + +* [`mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal#syntax-tree) + — GFM autolink literals +* [`mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote#syntax-tree) + — GFM footnotes +* [`mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough#syntax-tree) + — GFM strikethrough +* [`mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table#syntax-tree) + — GFM tables +* [`mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item#syntax-tree) + — GFM tasklists + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +The `Delete`, `FootnoteDefinition`, `FootnoteReference`, `Table`, `TableRow`, +and `TableCell` types of the mdast nodes are exposed from `@types/mdast`. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-gfm@^3`, +compatible with Node.js 16. + +## Related + +* [`remark-gfm`][remark-gfm] + — remark plugin to support GFM +* [`micromark-extension-gfm`][extension] + — micromark extension to parse GFM + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[api-gfm-from-markdown]: #gfmfrommarkdown + +[api-gfm-to-markdown]: #gfmtomarkdownoptions + +[api-options]: #options + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-gfm/actions + +[build-badge]: https://github.com/syntax-tree/mdast-util-gfm/workflows/main/badge.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[collective]: https://opencollective.com/unified + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-gfm + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[extension]: https://github.com/micromark/micromark-extension-gfm + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[gfm]: https://github.github.com/gfm/ + +[health]: https://github.com/syntax-tree/.github + +[license]: license + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[npm]: https://docs.npmjs.com/cli/install + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[size]: https://bundlejs.com/?q=mdast-util-gfm + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[syntax]: https://github.com/micromark/micromark-extension-gfm#syntax + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/mdast-util-mdx-expression/index.d.ts b/node_modules/mdast-util-mdx-expression/index.d.ts new file mode 100644 index 00000000..19d5c933 --- /dev/null +++ b/node_modules/mdast-util-mdx-expression/index.d.ts @@ -0,0 +1,161 @@ +import type {Program} from 'estree-jsx' +import type {Data as HastData, Literal as HastLiteral} from 'hast' +import type {Data as MdastData, Literal as MdastLiteral} from 'mdast' + +export { + mdxExpressionFromMarkdown, + mdxExpressionToMarkdown +} from './lib/index.js' + +/** + * MDX expression node, occurring in flow (block). + */ +export interface MdxFlowExpression extends MdastLiteral { + /** + * Node type. + */ + type: 'mdxFlowExpression' + + /** + * Data associated with the mdast MDX expression (flow). + */ + data?: MdxFlowExpressionData | undefined +} + +/** + * Info associated with mdast MDX expression (flow) nodes by the ecosystem. + */ +export interface MdxFlowExpressionData extends MdastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX expression node, occurring in text (phrasing). + */ +export interface MdxTextExpression extends MdastLiteral { + /** + * Node type. + */ + type: 'mdxTextExpression' + + /** + * Data associated with the mdast MDX expression (text). + */ + data?: MdxTextExpressionData | undefined +} + +/** + * Info associated with mdast MDX expression (text) nodes by the ecosystem. + */ +export interface MdxTextExpressionData extends MdastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX expression node, occurring in flow (block), for hast. + */ +export interface MdxFlowExpressionHast extends HastLiteral { + /** + * Node type. + */ + type: 'mdxFlowExpression' + + /** + * Data associated with the hast MDX expression (flow). + */ + data?: MdxFlowExpressionHastData | undefined +} + +/** + * Info associated with hast MDX expression (flow) nodes by the ecosystem. + */ +export interface MdxFlowExpressionHastData extends HastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX expression node, occurring in text (phrasing), for hast. + */ +export interface MdxTextExpressionHast extends HastLiteral { + /** + * Node type. + */ + type: 'mdxTextExpression' + + /** + * Data associated with the hast MDX expression (text). + */ + data?: MdxTextExpressionHastData | undefined +} + +/** + * Info associated with hast MDX expression (text) nodes by the ecosystem. + */ +export interface MdxTextExpressionHastData extends HastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +// Add nodes to mdast content. +declare module 'mdast' { + interface RootContentMap { + /** + * MDX expression node, occurring in text (phrasing). + */ + mdxTextExpression: MdxTextExpression + /** + * MDX expression node, occurring in flow (block). + */ + mdxFlowExpression: MdxFlowExpression + } + + interface PhrasingContentMap { + /** + * MDX expression node, occurring in text (phrasing). + */ + mdxTextExpression: MdxTextExpression + } + + interface BlockContentMap { + /** + * MDX expression node, occurring in flow (block). + */ + mdxFlowExpression: MdxFlowExpression + } +} + +// Add nodes to hast content. +declare module 'hast' { + interface RootContentMap { + /** + * MDX expression node, occurring in flow (block). + */ + mdxFlowExpression: MdxFlowExpressionHast + /** + * MDX expression node, occurring in text (phrasing). + */ + mdxTextExpression: MdxTextExpressionHast + } + + interface ElementContentMap { + /** + * MDX expression node, occurring in flow (block). + */ + mdxFlowExpression: MdxFlowExpressionHast + /** + * MDX expression node, occurring in text (phrasing). + */ + mdxTextExpression: MdxTextExpressionHast + } +} diff --git a/node_modules/mdast-util-mdx-expression/index.js b/node_modules/mdast-util-mdx-expression/index.js new file mode 100644 index 00000000..318a6f9f --- /dev/null +++ b/node_modules/mdast-util-mdx-expression/index.js @@ -0,0 +1,5 @@ +// Note: types exposed from `index.d.ts`. +export { + mdxExpressionFromMarkdown, + mdxExpressionToMarkdown +} from './lib/index.js' diff --git a/node_modules/mdast-util-mdx-expression/license b/node_modules/mdast-util-mdx-expression/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-mdx-expression/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-mdx-expression/package.json b/node_modules/mdast-util-mdx-expression/package.json new file mode 100644 index 00000000..b007d5a9 --- /dev/null +++ b/node_modules/mdast-util-mdx-expression/package.json @@ -0,0 +1,106 @@ +{ + "name": "mdast-util-mdx-expression", + "version": "2.0.1", + "description": "mdast extension to parse and serialize MDX (or MDX.js) expressions", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "mdx", + "mdxjs", + "expression", + "extension" + ], + "repository": "syntax-tree/mdast-util-mdx-expression", + "bugs": "https://github.com/syntax-tree/mdast-util-mdx-expression/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "complex-types.d.ts", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "devDependencies": { + "@types/acorn": "^4.0.0", + "@types/node": "^22.0.0", + "acorn": "^8.0.0", + "c8": "^10.0.0", + "micromark-extension-mdx-expression": "^3.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.59.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/prefer-at": "off" + } + } +} diff --git a/node_modules/mdast-util-mdx-expression/readme.md b/node_modules/mdast-util-mdx-expression/readme.md new file mode 100644 index 00000000..38208dc9 --- /dev/null +++ b/node_modules/mdast-util-mdx-expression/readme.md @@ -0,0 +1,531 @@ +# mdast-util-mdx-expression + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [MDX][] expressions (`{Math.PI}`). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`mdxExpressionFromMarkdown()`](#mdxexpressionfrommarkdown) + * [`mdxExpressionToMarkdown()`](#mdxexpressiontomarkdown) + * [`MdxFlowExpression`](#mdxflowexpression) + * [`MdxTextExpression`](#mdxtextexpression) + * [`MdxFlowExpressionHast`](#mdxflowexpressionhast) + * [`MdxTextExpressionHast`](#mdxtextexpressionhast) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for MDX expression syntax +in markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +expressions in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +expressions in syntax trees to markdown). + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-mdx-expression`][extension]. + +When you are working with syntax trees and want all of MDX, use +[`mdast-util-mdx`][mdast-util-mdx] instead. + +All these packages are used in [`remark-mdx`][remark-mdx], which +focusses on making it easier to transform content by abstracting these +internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-mdx-expression +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {mdxExpressionFromMarkdown, mdxExpressionToMarkdown} from 'https://esm.sh/mdast-util-mdx-expression@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.mdx` contains: + +```mdx +{ + a + 1 +} + +b {true}. +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import * as acorn from 'acorn' +import {mdxExpression} from 'micromark-extension-mdx-expression' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {mdxExpressionFromMarkdown, mdxExpressionToMarkdown} from 'mdast-util-mdx-expression' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.mdx') + +const tree = fromMarkdown(doc, { + extensions: [mdxExpression({acorn, addResult: true})], + mdastExtensions: [mdxExpressionFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [mdxExpressionToMarkdown()]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'mdxFlowExpression', + value: '\na + 1\n', + data: { + estree: { + type: 'Program', + body: [ + { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + left: {type: 'Identifier', name: 'a'}, + operator: '+', + right: {type: 'Literal', value: 1, raw: '1'} + } + } + ], + sourceType: 'module' + } + } + }, + { + type: 'paragraph', + children: [ + {type: 'text', value: 'b '}, + { + type: 'mdxTextExpression', + value: 'true', + data: { + estree: { + type: 'Program', + body: [ + { + type: 'ExpressionStatement', + expression: {type: 'Literal', value: true, raw: 'true'} + } + ], + sourceType: 'module' + } + } + }, + {type: 'text', value: '.'} + ] + } + ] +} +``` + +```markdown +{ + a + 1 +} + +b {true}. +``` + +## API + +This package exports the identifiers +[`mdxExpressionFromMarkdown`][api-mdx-expression-from-markdown] and +[`mdxExpressionToMarkdown`][api-mdx-expression-to-markdown]. +There is no default export. + +### `mdxExpressionFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable MDX expressions in markdown. + +When using the [micromark syntax extension][extension] with `addResult`, nodes +will have a `data.estree` field set to an ESTree [`Program`][program] node. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable MDX expressions +([`FromMarkdownExtension`][from-markdown-extension]). + +### `mdxExpressionToMarkdown()` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] +to enable MDX expressions in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable MDX expressions +([`ToMarkdownExtension`][to-markdown-extension]). + +### `MdxFlowExpression` + +MDX expression node, occurring in flow (block) (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'mdast' + +interface MdxFlowExpression extends Literal { + type: 'mdxFlowExpression' + data?: MdxFlowExpressionData | undefined +} + +interface MdxFlowExpressionData extends Data { + estree?: Program | null | undefined +} +``` + +### `MdxTextExpression` + +MDX expression node, occurring in text (block) (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'mdast' + +interface MdxTextExpression extends Literal { + type: 'mdxTextExpression' + data?: MdxTextExpressionData | undefined +} + +interface MdxTextExpressionData extends Data { + estree?: Program | null | undefined +} +``` + +### `MdxFlowExpressionHast` + +Same as [`MdxFlowExpression`][api-mdx-flow-expression], but registered with +`@types/hast` (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'hast' + +interface MdxFlowExpressionHast extends Literal { + type: 'mdxFlowExpression' + data?: MdxFlowExpressionData | undefined +} + +interface MdxFlowExpressionData extends Data { + estree?: Program | null | undefined +} +``` + +### `MdxTextExpressionHast` + +Same as [`MdxTextExpression`][api-mdx-text-expression], but registered with +`@types/hast` (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'hast' + +interface MdxTextExpressionHast extends Literal { + type: 'mdxTextExpression' + data?: MdxTextExpressionData | undefined +} + +interface MdxTextExpressionData extends Data { + estree?: Program | null | undefined +} +``` + +## HTML + +MDX expressions have no representation in HTML. +Though, when you are dealing with MDX, you will likely go *through* hast. +You can enable passing MDX expressions through to hast by configuring +[`mdast-util-to-hast`][mdast-util-to-hast] with +`passThrough: ['mdxFlowExpression', 'mdxTextExpression']`. + +## Syntax + +See [Syntax in `micromark-extension-mdx-expression`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `MdxFlowExpression` + +```idl +interface MdxFlowExpression <: Literal { + type: 'mdxFlowExpression' +} +``` + +**MdxFlowExpression** (**[Literal][dfn-literal]**) represents a JavaScript +expression embedded in flow (block). +It can be used where **[flow][dfn-flow-content]** content is expected. +Its content is represented by its `value` field. + +For example, the following markdown: + +```markdown +{ + 1 + 1 +} +``` + +Yields: + +```js +{type: 'mdxFlowExpression', value: '\n1 + 1\n'} +``` + +#### `MdxTextExpression` + +```idl +interface MdxTextExpression <: Literal { + type: 'mdxTextExpression" +} +``` + +**MdxTextExpression** (**[Literal][dfn-literal]**) represents a JavaScript +expression embedded in text (span, inline). +It can be used where **[phrasing][dfn-phrasing-content]** content is expected. +Its content is represented by its `value` field. + +For example, the following markdown: + +```markdown +a {1 + 1} b. +``` + +Yields: + +```js +{type: 'mdxTextExpression', value: '1 + 1'} +``` + +### Content model + +#### `FlowContent` (MDX expression) + +```idl +type FlowContentMdxExpression = MdxFlowExpression | FlowContent +``` + +#### `PhrasingContent` (MDX expression) + +```idl +type PhrasingContentMdxExpression = MdxTextExpression | PhrasingContent +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`MdxFlowExpression`][api-mdx-flow-expression], +[`MdxFlowExpressionHast`][api-mdx-flow-expression-hast], +[`MdxTextExpression`][api-mdx-text-expression], and +[`MdxTextExpressionHast`][api-mdx-text-expression-hast]. + +It also registers the node types with `@types/mdast` and `@types/hast`. +If you’re working with the syntax tree, make sure to import this utility +somewhere in your types, as that registers the new node types in the tree. + +```js +/** + * @import {} from 'mdast-util-mdx-expression' + * @import {Root} from 'mdast' + */ + +import {visit} from 'unist-util-visit' + +/** @type {Root} */ +const tree = getMdastNodeSomeHow() + +visit(tree, function (node) { + // `node` can now be an expression node. +}) +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`mdast-util-mdx-expression@^2`, compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`remarkjs/remark-mdx`][remark-mdx] + — remark plugin to support MDX +* [`syntax-tree/mdast-util-mdx`][mdast-util-mdx] + — mdast utility to support MDX +* [`micromark/micromark-extension-mdx-expression`][extension] + — micromark extension to parse MDX expressions + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-mdx-expression/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-mdx-expression/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-mdx-expression.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-mdx-expression + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-mdx-expression.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-mdx-expression + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-mdx-expression + +[size]: https://bundlejs.com/?q=mdast-util-mdx-expression + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx + +[extension]: https://github.com/micromark/micromark-extension-mdx-expression + +[syntax]: https://github.com/micromark/micromark-extension-mdx-expression#syntax + +[program]: https://github.com/estree/estree/blob/master/es2015.md#programs + +[dfn-literal]: https://github.com/syntax-tree/mdast#literal + +[remark-mdx]: https://mdxjs.com/packages/remark-mdx/ + +[mdx]: https://mdxjs.com + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[api-mdx-expression-from-markdown]: #mdxexpressionfrommarkdown + +[api-mdx-expression-to-markdown]: #mdxexpressiontomarkdown + +[api-mdx-flow-expression]: #mdxflowexpression + +[api-mdx-text-expression]: #mdxtextexpression + +[api-mdx-flow-expression-hast]: #mdxflowexpressionhast + +[api-mdx-text-expression-hast]: #mdxtextexpressionhast + +[dfn-flow-content]: #flowcontent-mdx-expression + +[dfn-phrasing-content]: #phrasingcontent-mdx-expression diff --git a/node_modules/mdast-util-mdx-jsx/index.d.ts b/node_modules/mdast-util-mdx-jsx/index.d.ts new file mode 100644 index 00000000..1bd5ddb6 --- /dev/null +++ b/node_modules/mdast-util-mdx-jsx/index.d.ts @@ -0,0 +1,344 @@ +import type {Program} from 'estree-jsx' +import type {Data as HastData, ElementContent, Parent as HastParent} from 'hast' +import type { + BlockContent, + Data as MdastData, + DefinitionContent, + Parent as MdastParent, + PhrasingContent +} from 'mdast' +import type {Data, Node} from 'unist' +import type {Tag} from './lib/index.js' + +// Expose JavaScript API. +export {mdxJsxFromMarkdown, mdxJsxToMarkdown} from './lib/index.js' + +// Expose options. +export type {ToMarkdownOptions} from './lib/index.js' + +// Expose node types. +/** + * MDX JSX attribute value set to an expression. + * + * ```markdown + * > | + * ^^^ + * ``` + */ +export interface MdxJsxAttributeValueExpression extends Node { + /** + * Node type. + */ + type: 'mdxJsxAttributeValueExpression' + + /** + * Value. + */ + value: string + + /** + * Data associated with the mdast MDX JSX attribute value expression. + */ + data?: MdxJsxAttributeValueExpressionData | undefined +} + +/** + * Info associated with mdast MDX JSX attribute value expression nodes by the + * ecosystem. + */ +export interface MdxJsxAttributeValueExpressionData extends Data { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX JSX attribute as an expression. + * + * ```markdown + * > | + * ^^^^^^ + * ``` + */ +export interface MdxJsxExpressionAttribute extends Node { + /** + * Node type. + */ + type: 'mdxJsxExpressionAttribute' + + /** + * Value. + */ + value: string + + /** + * Data associated with the mdast MDX JSX expression attributes. + */ + data?: MdxJsxExpressionAttributeData | undefined +} + +/** + * Info associated with mdast MDX JSX expression attribute nodes by the + * ecosystem. + */ +export interface MdxJsxExpressionAttributeData extends Data { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX JSX attribute with a key. + * + * ```markdown + * > | + * ^^^^^ + * ``` + */ +export interface MdxJsxAttribute extends Node { + /** + * Node type. + */ + type: 'mdxJsxAttribute' + /** + * Attribute name. + */ + name: string + /** + * Attribute value. + */ + value?: MdxJsxAttributeValueExpression | string | null | undefined + /** + * Data associated with the mdast MDX JSX attribute. + */ + data?: MdxJsxAttributeData | undefined +} + +/** + * Info associated with mdast MDX JSX attribute nodes by the + * ecosystem. + */ +export interface MdxJsxAttributeData extends Data {} + +/** + * MDX JSX element node, occurring in flow (block). + */ +export interface MdxJsxFlowElement extends MdastParent { + /** + * Node type. + */ + type: 'mdxJsxFlowElement' + /** + * MDX JSX element name (`null` for fragments). + */ + name: string | null + /** + * MDX JSX element attributes. + */ + attributes: Array + /** + * Content. + */ + children: Array + /** + * Data associated with the mdast MDX JSX elements (flow). + */ + data?: MdxJsxFlowElementData | undefined +} + +/** + * Info associated with mdast MDX JSX element (flow) nodes by the + * ecosystem. + */ +export interface MdxJsxFlowElementData extends MdastData {} + +/** + * MDX JSX element node, occurring in text (phrasing). + */ +export interface MdxJsxTextElement extends MdastParent { + /** + * Node type. + */ + type: 'mdxJsxTextElement' + /** + * MDX JSX element name (`null` for fragments). + */ + name: string | null + /** + * MDX JSX element attributes. + */ + attributes: Array + /** + * Content. + */ + children: PhrasingContent[] + /** + * Data associated with the mdast MDX JSX elements (text). + */ + data?: MdxJsxTextElementData | undefined +} + +/** + * Info associated with mdast MDX JSX element (text) nodes by the + * ecosystem. + */ +export interface MdxJsxTextElementData extends MdastData {} + +/** + * MDX JSX element node, occurring in flow (block), for hast. + */ +export interface MdxJsxFlowElementHast extends HastParent { + /** + * Node type. + */ + type: 'mdxJsxFlowElement' + /** + * MDX JSX element name (`null` for fragments). + */ + name: string | null + /** + * MDX JSX element attributes. + */ + attributes: Array + /** + * Content. + */ + children: ElementContent[] + /** + * Data associated with the hast MDX JSX elements (flow). + */ + data?: MdxJsxFlowElementHastData | undefined +} + +/** + * Info associated with hast MDX JSX element (flow) nodes by the + * ecosystem. + */ +export interface MdxJsxFlowElementHastData extends HastData {} + +/** + * MDX JSX element node, occurring in text (phrasing), for hast. + */ +export interface MdxJsxTextElementHast extends HastParent { + /** + * Node type. + */ + type: 'mdxJsxTextElement' + /** + * MDX JSX element name (`null` for fragments). + */ + name: string | null + /** + * MDX JSX element attributes. + */ + attributes: Array + /** + * Content. + */ + children: ElementContent[] + /** + * Data associated with the hast MDX JSX elements (text). + */ + data?: MdxJsxTextElementHastData | undefined +} + +/** + * Info associated with hast MDX JSX element (text) nodes by the + * ecosystem. + */ +export interface MdxJsxTextElementHastData extends HastData {} + +// Add nodes to mdast content. +declare module 'mdast' { + interface BlockContentMap { + /** + * MDX JSX element node, occurring in flow (block). + */ + mdxJsxFlowElement: MdxJsxFlowElement + } + + interface PhrasingContentMap { + /** + * MDX JSX element node, occurring in text (phrasing). + */ + mdxJsxTextElement: MdxJsxTextElement + } + + interface RootContentMap { + /** + * MDX JSX element node, occurring in flow (block). + */ + mdxJsxFlowElement: MdxJsxFlowElement + /** + * MDX JSX element node, occurring in text (phrasing). + */ + mdxJsxTextElement: MdxJsxTextElement + } +} + +// Add nodes to hast content. +declare module 'hast' { + interface ElementContentMap { + /** + * MDX JSX element node, occurring in text (phrasing). + */ + mdxJsxTextElement: MdxJsxTextElementHast + /** + * MDX JSX element node, occurring in flow (block). + */ + mdxJsxFlowElement: MdxJsxFlowElementHast + } + + interface RootContentMap { + /** + * MDX JSX element node, occurring in text (phrasing). + */ + mdxJsxTextElement: MdxJsxTextElementHast + /** + * MDX JSX element node, occurring in flow (block). + */ + mdxJsxFlowElement: MdxJsxFlowElementHast + } +} + +// Add custom data tracked to turn markdown into a tree. +declare module 'mdast-util-from-markdown' { + interface CompileData { + /** + * Current MDX JSX tag. + */ + mdxJsxTag?: Tag | undefined + + /** + * Current stack of open MDX JSX tags. + */ + mdxJsxTagStack?: Tag[] | undefined + } +} + +// Add custom data tracked to turn a syntax tree into markdown. +declare module 'mdast-util-to-markdown' { + interface ConstructNameMap { + /** + * Whole JSX element, in flow. + * + * ```markdown + * > | + * ^^^^^ + * ``` + */ + mdxJsxFlowElement: 'mdxJsxFlowElement' + + /** + * Whole JSX element, in text. + * + * ```markdown + * > | a . + * ^^^^^ + * ``` + */ + mdxJsxTextElement: 'mdxJsxTextElement' + } +} diff --git a/node_modules/mdast-util-mdx-jsx/index.js b/node_modules/mdast-util-mdx-jsx/index.js new file mode 100644 index 00000000..37d9cd53 --- /dev/null +++ b/node_modules/mdast-util-mdx-jsx/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {mdxJsxFromMarkdown, mdxJsxToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-mdx-jsx/license b/node_modules/mdast-util-mdx-jsx/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-mdx-jsx/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-mdx-jsx/package.json b/node_modules/mdast-util-mdx-jsx/package.json new file mode 100644 index 00000000..6bf2a96c --- /dev/null +++ b/node_modules/mdast-util-mdx-jsx/package.json @@ -0,0 +1,113 @@ +{ + "name": "mdast-util-mdx-jsx", + "version": "3.2.0", + "description": "mdast extension to parse and serialize MDX or MDX.js JSX", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "mdx", + "mdxjs", + "jsx", + "extension" + ], + "repository": "syntax-tree/mdast-util-mdx-jsx", + "bugs": "https://github.com/syntax-tree/mdast-util-mdx-jsx/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "acorn": "^8.0.0", + "c8": "^10.0.0", + "micromark-extension-mdx-jsx": "^3.0.0", + "micromark-extension-mdx-md": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.60.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/prefer-at": "off" + } + } +} diff --git a/node_modules/mdast-util-mdx-jsx/readme.md b/node_modules/mdast-util-mdx-jsx/readme.md new file mode 100644 index 00000000..1657e0bd --- /dev/null +++ b/node_modules/mdast-util-mdx-jsx/readme.md @@ -0,0 +1,719 @@ +# mdast-util-mdx-jsx + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [MDX][] JSX (``). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`mdxJsxFromMarkdown()`](#mdxjsxfrommarkdown) + * [`mdxJsxToMarkdown(options?)`](#mdxjsxtomarkdownoptions) + * [`MdxJsxAttribute`](#mdxjsxattribute) + * [`MdxJsxAttributeValueExpression`](#mdxjsxattributevalueexpression) + * [`MdxJsxExpressionAttribute`](#mdxjsxexpressionattribute) + * [`MdxJsxFlowElement`](#mdxjsxflowelement) + * [`MdxJsxFlowElementHast`](#mdxjsxflowelementhast) + * [`MdxJsxTextElement`](#mdxjsxtextelement) + * [`MdxJsxTextElementHast`](#mdxjsxtextelementhast) + * [`ToMarkdownOptions`](#tomarkdownoptions) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Mixin](#mixin) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for MDX JSX syntax in +markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +JSX in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +JSX in syntax trees to markdown). + +[JSX][] is an XML-like syntax extension to ECMAScript (JavaScript), which MDX +brings to markdown. +For more info on MDX, see [What is MDX?][what-is-mdx] + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-mdx-jsx`][micromark-extension-mdx-jsx]. + +When you are working with syntax trees and want all of MDX, use +[`mdast-util-mdx`][mdast-util-mdx] instead. + +All these packages are used in [`remark-mdx`][remark-mdx], which +focusses on making it easier to transform content by abstracting these +internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-mdx-jsx +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'https://esm.sh/mdast-util-mdx-jsx@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.mdx` contains: + +```mdx + + - a list + + + + +HTML is a lovely language. +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import * as acorn from 'acorn' +import {mdxJsx} from 'micromark-extension-mdx-jsx' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'mdast-util-mdx-jsx' +import {toMarkdown} from 'mdast-util-to-markdown' + +const doc = await fs.readFile('example.mdx') + +const tree = fromMarkdown(doc, { + extensions: [mdxJsx({acorn, addResult: true})], + mdastExtensions: [mdxJsxFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [mdxJsxToMarkdown()]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'mdxJsxFlowElement', + name: 'Box', + attributes: [], + children: [ + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + {type: 'paragraph', children: [{type: 'text', value: 'a list'}]} + ] + } + ] + } + ] + }, + { + type: 'mdxJsxFlowElement', + name: 'MyComponent', + attributes: [ + { + type: 'mdxJsxExpressionAttribute', + value: '...props', + data: { + estree: { + type: 'Program', + body: [ + { + type: 'ExpressionStatement', + expression: { + type: 'ObjectExpression', + properties: [ + { + type: 'SpreadElement', + argument: {type: 'Identifier', name: 'props'} + } + ] + } + } + ], + sourceType: 'module' + } + } + } + ], + children: [] + }, + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'abbr', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'title', + value: 'Hypertext Markup Language' + } + ], + children: [{type: 'text', value: 'HTML'}] + }, + {type: 'text', value: ' is a lovely language.'} + ] + } + ] +} +``` + +```markdown + + * a list + + + + +HTML is a lovely language. +``` + +## API + +This package exports the identifiers +[`mdxJsxFromMarkdown`][api-mdx-jsx-from-markdown] and +[`mdxJsxToMarkdown`][api-mdx-jsx-to-markdown]. +There is no default export. + +### `mdxJsxFromMarkdown()` + +Create an extension for +[`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable MDX JSX. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable MDX JSX +([`FromMarkdownExtension`][from-markdown-extension]). + +When using the [micromark syntax extension][micromark-extension-mdx-jsx] with +`addResult`, nodes will have a `data.estree` field set to an ESTree +[`Program`][program] node. + +### `mdxJsxToMarkdown(options?)` + +Create an extension for +[`mdast-util-to-markdown`][mdast-util-to-markdown] +to enable MDX JSX. + +This extension configures `mdast-util-to-markdown` with +[`options.fences: true`][mdast-util-to-markdown-fences] and +[`options.resourceLink: true`][mdast-util-to-markdown-resourcelink] too, do not +overwrite them! + +###### Parameters + +* `options` ([`ToMarkdownOptions`][api-to-markdown-options]) + — configuration + +###### Returns + +Extension for `mdast-util-to-markdown` to enable MDX JSX +([`FromMarkdownExtension`][to-markdown-extension]). + +### `MdxJsxAttribute` + +MDX JSX attribute with a key (TypeScript type). + +###### Type + +```ts +import type {Literal} from 'mdast' + +interface MdxJsxAttribute extends Literal { + type: 'mdxJsxAttribute' + name: string + value?: MdxJsxAttributeValueExpression | string | null | undefined +} +``` + +### `MdxJsxAttributeValueExpression` + +MDX JSX attribute value set to an expression (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Literal} from 'mdast' + +interface MdxJsxAttributeValueExpression extends Literal { + type: 'mdxJsxAttributeValueExpression' + data?: {estree?: Program | null | undefined} & Literal['data'] +} +``` + +### `MdxJsxExpressionAttribute` + +MDX JSX attribute as an expression (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Literal} from 'mdast' + +interface MdxJsxExpressionAttribute extends Literal { + type: 'mdxJsxExpressionAttribute' + data?: {estree?: Program | null | undefined} & Literal['data'] +} +``` + +### `MdxJsxFlowElement` + +MDX JSX element node, occurring in flow (block) (TypeScript type). + +###### Type + +```ts +import type {BlockContent, DefinitionContent, Parent} from 'mdast' + +export interface MdxJsxFlowElement extends Parent { + type: 'mdxJsxFlowElement' + name: string | null + attributes: Array + children: Array +} +``` + +### `MdxJsxFlowElementHast` + +Same as [`MdxJsxFlowElement`][api-mdx-jsx-flow-element], but registered with +`@types/hast` (TypeScript type). + +###### Type + +```ts +import type {ElementContent, Parent} from 'hast' + +export interface MdxJsxFlowElementHast extends Parent { + type: 'mdxJsxFlowElement' + name: string | null + attributes: Array + children: Array +} +``` + +### `MdxJsxTextElement` + +MDX JSX element node, occurring in text (phrasing) (TypeScript type). + +###### Type + +```ts +import type {Parent, PhrasingContent} from 'mdast' + +export interface MdxJsxTextElement extends Parent { + type: 'mdxJsxTextElement' + name: string | null + attributes: Array + children: Array +} +``` + +### `MdxJsxTextElementHast` + +Same as [`MdxJsxTextElement`][api-mdx-jsx-text-element], but registered with +`@types/hast` (TypeScript type). + +###### Type + +```ts +import type {ElementContent, Parent} from 'hast' + +export interface MdxJsxTextElementHast extends Parent { + type: 'mdxJsxTextElement' + name: string | null + attributes: Array + children: Array +} +``` + +### `ToMarkdownOptions` + +Configuration (TypeScript type). + +##### Fields + +* `quote` (`'"'` or `"'"`, default: `'"'`) + — preferred quote to use around attribute values +* `quoteSmart` (`boolean`, default: `false`) + — use the other quote if that results in less bytes +* `tightSelfClosing` (`boolean`, default: `false`) + — do not use an extra space when closing self-closing elements: `` + instead of `` +* `printWidth` (`number`, default: `Infinity`) + — try and wrap syntax at this width. + When set to a finite number (say, `80`), the formatter will print + attributes on separate lines when a tag doesn’t fit on one line. + The normal behavior is to print attributes with spaces between them instead + of line endings + +## HTML + +MDX JSX has no representation in HTML. +Though, when you are dealing with MDX, you will likely go *through* hast. +You can enable passing MDX JSX through to hast by configuring +[`mdast-util-to-hast`][mdast-util-to-hast] with +`passThrough: ['mdxJsxFlowElement', 'mdxJsxTextElement']`. + +## Syntax + +See [Syntax in `micromark-extension-mdx-jsx`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `MdxJsxFlowElement` + +```idl +interface MdxJsxFlowElement <: Parent { + type: 'mdxJsxFlowElement' +} + +MdxJsxFlowElement includes MdxJsxElement +``` + +**MdxJsxFlowElement** (**[Parent][dfn-parent]**) represents JSX in flow (block). +It can be used where **[flow][dfn-content-flow]** content is expected. +It includes the mixin **[MdxJsxElement][dfn-mixin-mdx-jsx-element]**. + +For example, the following markdown: + +```markdown + + z + +``` + +Yields: + +```js +{ + type: 'mdxJsxFlowElement', + name: 'w', + attributes: [{type: 'mdxJsxAttribute', name: 'x', value: 'y'}], + children: [{type: 'paragraph', children: [{type: 'text', value: 'z'}]}] +} +``` + +#### `MdxJsxTextElement` + +```idl +interface MdxJsxTextElement <: Parent { + type: 'mdxJsxTextElement' +} + +MdxJsxTextElement includes MdxJsxElement +``` + +**MdxJsxTextElement** (**[Parent][dfn-parent]**) represents JSX in text (span, +inline). +It can be used where **[phrasing][dfn-content-phrasing]** content is +expected. +It includes the mixin **[MdxJsxElement][dfn-mixin-mdx-jsx-element]**. + +For example, the following markdown: + +```markdown +a d e. +``` + +Yields: + +```js +{ + type: 'mdxJsxTextElement', + name: 'b', + attributes: [{type: 'mdxJsxAttribute', name: 'c', value: null}], + children: [{type: 'text', value: 'd'}] +} +``` + +### Mixin + +#### `MdxJsxElement` + +```idl +interface mixin MdxJsxElement { + name: string? + attributes: [MdxJsxExpressionAttribute | MdxJsxAttribute] +} + +interface MdxJsxExpressionAttribute <: Literal { + type: 'mdxJsxExpressionAttribute' +} + +interface MdxJsxAttribute <: Node { + type: 'mdxJsxAttribute' + name: string + value: MdxJsxAttributeValueExpression | string? +} + +interface MdxJsxAttributeValueExpression <: Literal { + type: 'mdxJsxAttributeValueExpression' +} +``` + +**MdxJsxElement** represents a JSX element. + +The `name` field can be present and represents an identifier. +Without `name`, the element represents a fragment, in which case no attributes +must be present. + +The `attributes` field represents information associated with the node. +The value of the `attributes` field is a list of **MdxJsxExpressionAttribute** +and **MdxJsxAttribute** nodes. + +**MdxJsxExpressionAttribute** represents an expression (typically in a +programming language) that when evaluated results in multiple attributes. + +**MdxJsxAttribute** represents a single attribute. +The `name` field must be present. +The `value` field can be present, in which case it is either a string (a static +value) or an expression (typically in a programming language) that when +evaluated results in an attribute value. + +### Content model + +###### `FlowContent` (MDX JSX) + +```idl +type MdxJsxFlowContent = MdxJsxFlowElement | FlowContent +``` + +###### `PhrasingContent` (MDX JSX) + +```idl +type MdxJsxPhrasingContent = MdxJsxTextElement | PhrasingContent +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`MdxJsxAttribute`][api-mdx-jsx-attribute], +[`MdxJsxAttributeValueExpression`][api-mdx-jsx-attribute-value-expression], +[`MdxJsxExpressionAttribute`][api-mdx-jsx-expression-attribute], +[`MdxJsxFlowElement`][api-mdx-jsx-flow-element], +[`MdxJsxFlowElementHast`][api-mdx-jsx-flow-element-hast], +[`MdxJsxTextElement`][api-mdx-jsx-text-element], +[`MdxJsxTextElementHast`][api-mdx-jsx-text-element-hast], and +[`ToMarkdownOptions`][api-to-markdown-options]. + +It also registers the node types with `@types/mdast` and `@types/hast`. +If you’re working with the syntax tree, make sure to import this utility +somewhere in your types, as that registers the new node types in the tree. + +```js +/** + * @import {} from 'mdast-util-mdx-jsx' + * @import {Root} from 'mdast' + */ + +import {visit} from 'unist-util-visit' + +/** @type {Root} */ +const tree = getMdastNodeSomeHow() + +visit(tree, function (node) { + // `node` can now be one of the JSX nodes. +}) +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-mdx-jsx@3`, +compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`micromark/micromark-extension-mdx-jsx`][micromark-extension-mdx-jsx] + — support MDX JSX in micromark +* [`syntax-tree/mdast-util-mdx`][mdast-util-mdx] + — support MDX in mdast +* [`remarkjs/remark-mdx`][remark-mdx] + — support MDX in remark + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://github.com/syntax-tree/mdast-util-mdx-jsx/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-mdx-jsx/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-mdx-jsx.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-mdx-jsx + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-mdx-jsx.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-mdx-jsx + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-mdx-jsx + +[size]: https://bundlejs.com/?q=mdast-util-mdx-jsx + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx + +[program]: https://github.com/estree/estree/blob/master/es2015.md#programs + +[dfn-parent]: https://github.com/syntax-tree/mdast#parent + +[dfn-content-flow]: #flowcontent-mdx-jsx + +[dfn-content-phrasing]: #phrasingcontent-mdx-jsx + +[dfn-mixin-mdx-jsx-element]: #mdxjsxelement + +[jsx]: https://facebook.github.io/jsx/ + +[what-is-mdx]: https://mdxjs.com/docs/what-is-mdx/ + +[micromark-extension-mdx-jsx]: https://github.com/micromark/micromark-extension-mdx-jsx + +[syntax]: https://github.com/micromark/micromark-extension-mdx-jsx#syntax + +[mdast-util-to-markdown-fences]: https://github.com/syntax-tree/mdast-util-to-markdown#optionsfences + +[mdast-util-to-markdown-resourcelink]: https://github.com/syntax-tree/mdast-util-to-markdown#optionsresourcelink + +[remark-mdx]: https://mdxjs.com/packages/remark-mdx/ + +[mdx]: https://mdxjs.com + +[api-mdx-jsx-from-markdown]: #mdxjsxfrommarkdown + +[api-mdx-jsx-to-markdown]: #mdxjsxtomarkdownoptions + +[api-mdx-jsx-attribute]: #mdxjsxattribute + +[api-mdx-jsx-attribute-value-expression]: #mdxjsxattributevalueexpression + +[api-mdx-jsx-expression-attribute]: #mdxjsxexpressionattribute + +[api-mdx-jsx-flow-element]: #mdxjsxflowelement + +[api-mdx-jsx-flow-element-hast]: #mdxjsxflowelementhast + +[api-mdx-jsx-text-element]: #mdxjsxtextelement + +[api-mdx-jsx-text-element-hast]: #mdxjsxtextelementhast + +[api-to-markdown-options]: #tomarkdownoptions diff --git a/node_modules/mdast-util-mdxjs-esm/index.d.ts b/node_modules/mdast-util-mdxjs-esm/index.d.ts new file mode 100644 index 00000000..203f687e --- /dev/null +++ b/node_modules/mdast-util-mdxjs-esm/index.d.ts @@ -0,0 +1,82 @@ +import type {Program} from 'estree-jsx' +import type {Data as HastData, Literal as HastLiteral} from 'hast' +import type {Data as MdastData, Literal as MdastLiteral} from 'mdast' + +export {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from './lib/index.js' + +/** + * MDX ESM (import/export) node. + */ +export interface MdxjsEsm extends MdastLiteral { + /** + * Node type. + */ + type: 'mdxjsEsm' + + /** + * Data associated with mdast MDX.js ESM. + */ + data?: MdxjsEsmData | undefined +} + +/** + * Info associated with mdast MDX.js ESM nodes by the ecosystem. + */ +export interface MdxjsEsmData extends MdastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +/** + * MDX ESM (import/export) node (for hast). + */ +export interface MdxjsEsmHast extends HastLiteral { + /** + * Node type. + */ + type: 'mdxjsEsm' + + /** + * Data associated with hast MDX.js ESM. + */ + data?: MdxjsEsmHastData | undefined +} + +/** + * Info associated with hast MDX.js ESM nodes by the ecosystem. + */ +export interface MdxjsEsmHastData extends HastData { + /** + * Program node from estree. + */ + estree?: Program | null | undefined +} + +// Add nodes to mdast content. +declare module 'mdast' { + interface FrontmatterContentMap { + /** + * MDX ESM. + */ + mdxjsEsm: MdxjsEsm + } + + interface RootContentMap { + /** + * MDX ESM. + */ + mdxjsEsm: MdxjsEsm + } +} + +// Add nodes to hast content. +declare module 'hast' { + interface RootContentMap { + /** + * MDX ESM. + */ + mdxjsEsm: MdxjsEsmHast + } +} diff --git a/node_modules/mdast-util-mdxjs-esm/index.js b/node_modules/mdast-util-mdxjs-esm/index.js new file mode 100644 index 00000000..2aa76935 --- /dev/null +++ b/node_modules/mdast-util-mdxjs-esm/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from './lib/index.js' diff --git a/node_modules/mdast-util-mdxjs-esm/license b/node_modules/mdast-util-mdxjs-esm/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/mdast-util-mdxjs-esm/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-mdxjs-esm/package.json b/node_modules/mdast-util-mdxjs-esm/package.json new file mode 100644 index 00000000..2743942b --- /dev/null +++ b/node_modules/mdast-util-mdxjs-esm/package.json @@ -0,0 +1,106 @@ +{ + "name": "mdast-util-mdxjs-esm", + "version": "2.0.1", + "description": "mdast extension to parse and serialize MDX.js ESM (import/exports)", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "markup", + "mdx", + "mdxjs", + "esm", + "import", + "export", + "extension" + ], + "repository": "syntax-tree/mdast-util-mdxjs-esm", + "bugs": "https://github.com/syntax-tree/mdast-util-mdxjs-esm/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "acorn": "^8.0.0", + "c8": "^8.0.0", + "micromark-extension-mdxjs-esm": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.55.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test.js", + "test-api-dev": "node --conditions development test.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/prefer-at": "off" + } + } +} diff --git a/node_modules/mdast-util-mdxjs-esm/readme.md b/node_modules/mdast-util-mdxjs-esm/readme.md new file mode 100644 index 00000000..7f814458 --- /dev/null +++ b/node_modules/mdast-util-mdxjs-esm/readme.md @@ -0,0 +1,448 @@ +# mdast-util-mdxjs-esm + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] extensions to parse and serialize [MDX][] ESM (import/exports). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`mdxjsEsmFromMarkdown()`](#mdxjsesmfrommarkdown) + * [`mdxjsEsmToMarkdown()`](#mdxjsesmtomarkdown) + * [`MdxjsEsm`](#mdxjsesm) + * [`MdxjsEsmHast`](#mdxjsesmhast) +* [HTML](#html) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) + * [Nodes](#nodes) + * [Content model](#content-model) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for MDX ESM syntax in +markdown to [mdast][]. +These extensions plug into +[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing +ESM in markdown into a syntax tree) and +[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing +ESM in syntax trees to markdown). + +## When to use this + +You can use these extensions when you are working with +`mdast-util-from-markdown` and `mdast-util-to-markdown` already. + +When working with `mdast-util-from-markdown`, you must combine this package +with [`micromark-extension-mdxjs-esm`][extension]. + +When you are working with syntax trees and want all of MDX, use +[`mdast-util-mdx`][mdast-util-mdx] instead. + +All these packages are used in [`remark-mdx`][remark-mdx], which +focusses on making it easier to transform content by abstracting these +internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-mdxjs-esm +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from 'https://esm.sh/mdast-util-mdxjs-esm@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.mdx` contains: + +```mdx +import a from 'b' +export const c = '' + +d +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import * as acorn from 'acorn' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {toMarkdown} from 'mdast-util-to-markdown' +import {mdxjsEsm} from 'micromark-extension-mdxjs-esm' +import {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from 'mdast-util-mdxjs-esm' + +const doc = await fs.readFile('example.mdx') + +const tree = fromMarkdown(doc, { + extensions: [mdxjsEsm({acorn, addResult: true})], + mdastExtensions: [mdxjsEsmFromMarkdown()] +}) + +console.log(tree) + +const out = toMarkdown(tree, {extensions: [mdxjsEsmToMarkdown()]}) + +console.log(out) +``` + +…now running `node example.js` yields (positional info removed for brevity): + +```js +{ + type: 'root', + children: [ + { + type: 'mdxjsEsm', + value: "import a from 'b'\nexport const c = ''", + data: { + estree: { + type: 'Program', + body: [ + { + type: 'ImportDeclaration', + specifiers: [ + { + type: 'ImportDefaultSpecifier', + local: {type: 'Identifier', name: 'a'} + } + ], + source: {type: 'Literal', value: 'b', raw: "'b'"} + }, + { + type: 'ExportNamedDeclaration', + declaration: { + type: 'VariableDeclaration', + declarations: [ + { + type: 'VariableDeclarator', + id: {type: 'Identifier', name: 'c'}, + init: {type: 'Literal', value: '', raw: "''"} + } + ], + kind: 'const' + }, + specifiers: [], + source: null + } + ], + sourceType: 'module' + } + } + }, + {type: 'paragraph', children: [{type: 'text', value: 'd'}]} + ] +} +``` + +```markdown +import a from 'b' +export const c = '' + +d +``` + +## API + +This package exports the identifiers +[`mdxjsEsmFromMarkdown`][api-mdxjs-esm-from-markdown] and +[`mdxjsEsmToMarkdown`][api-mdxjs-esm-to-markdown]. +There is no default export. + +### `mdxjsEsmFromMarkdown()` + +Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown] +to enable MDX.js ESM in markdown. + +When using the [micromark syntax extension][extension] with `addResult`, nodes +will have a `data.estree` field set to an ESTree [`Program`][program] node. + +###### Returns + +Extension for `mdast-util-from-markdown` to enable MDX.js ESM +([`FromMarkdownExtension`][from-markdown-extension]). + +### `mdxjsEsmToMarkdown()` + +Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] +to enable MDX.js ESM in markdown. + +###### Returns + +Extension for `mdast-util-to-markdown` to enable MDX.js ESM +([`ToMarkdownExtension`][to-markdown-extension]). + +### `MdxjsEsm` + +MDX ESM (import/export) node (TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'mdast' + +interface MdxjsEsm extends Literal { + type: 'mdxjsEsm' + data?: MdxjsEsmData | undefined +} + +export interface MdxjsEsmData extends Data { + estree?: Program | null | undefined +} +``` + +### `MdxjsEsmHast` + +Same as [`MdxjsEsm`][api-mdxjs-esm], but registered with `@types/hast` +(TypeScript type). + +###### Type + +```ts +import type {Program} from 'estree-jsx' +import type {Data, Literal} from 'hast' + +interface MdxjsEsmHast extends Literal { + type: 'mdxjsEsm' + data?: MdxjsEsmHastData | undefined +} + +export interface MdxjsEsmHastData extends Data { + estree?: Program | null | undefined +} +``` + +## HTML + +MDX ESM has no representation in HTML. +Though, when you are dealing with MDX, you will likely go *through* hast. +You can enable passing MDX ESM through to hast by configuring +[`mdast-util-to-hast`][mdast-util-to-hast] with `passThrough: ['mdxjsEsm']`. + +## Syntax + +See [Syntax in `micromark-extension-mdxjs-esm`][syntax]. + +## Syntax tree + +The following interfaces are added to **[mdast][]** by this utility. + +### Nodes + +#### `MdxjsEsm` + +```idl +interface MdxjsEsm <: Literal { + type: 'mdxjsEsm' +} +``` + +**MdxjsEsm** (**[Literal][dfn-literal]**) represents ESM import/exports +embedded in MDX. +It can be used where **[flow][dfn-flow-content]** content is expected. +Its content is represented by its `value` field. + +For example, the following Markdown: + +```markdown +import a from 'b' +``` + +Yields: + +```js +{ + type: 'mdxjsEsm', + value: 'import a from \'b\'' +} +``` + +### Content model + +#### `FlowContent` (MDX.js ESM) + +```idl +type FlowContentMdxjsEsm = MdxjsEsm | FlowContent +``` + +Note that when ESM is present, it can only exist as top-level content: if it has +a *[parent][dfn-parent]*, that parent must be **[Root][dfn-root]**. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`MdxjsEsm`][api-mdxjs-esm] and +[`MdxjsEsmHast`][api-mdxjs-esm-hast]. + +It also registers the node type with `@types/mdast` and `@types/hast`. +If you’re working with the syntax tree, make sure to import this utility +somewhere in your types, as that registers the new node types in the tree. + +```js +/** + * @typedef {import('mdast-util-mdxjs-esm')} + */ + +import {visit} from 'unist-util-visit' + +/** @type {import('mdast').Root} */ +const tree = getMdastNodeSomeHow() + +visit(tree, function (node) { + // `node` can now be an ESM node. +}) +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-mdxjs-esm@^2`, +compatible with Node.js 16. + +This utility works with `mdast-util-from-markdown` version 2+ and +`mdast-util-to-markdown` version 2+. + +## Related + +* [`remarkjs/remark-mdx`][remark-mdx] + — remark plugin to support MDX +* [`syntax-tree/mdast-util-mdx`][mdast-util-mdx] + — mdast utility to support MDX +* [`micromark/micromark-extension-mdxjs-esm`][extension] + — micromark extension to parse MDX.js ESM + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-mdxjs-esm/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-mdxjs-esm/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-mdxjs-esm.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-mdxjs-esm + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-mdxjs-esm.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-mdxjs-esm + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-mdxjs-esm + +[size]: https://bundlejs.com/?q=mdast-util-mdxjs-esm + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx + +[extension]: https://github.com/micromark/micromark-extension-mdxjs-esm + +[syntax]: https://github.com/micromark/micromark-extension-mdxjs-esm#syntax + +[program]: https://github.com/estree/estree/blob/master/es2015.md#programs + +[dfn-literal]: https://github.com/syntax-tree/mdast#literal + +[dfn-parent]: https://github.com/syntax-tree/unist#parent-1 + +[dfn-root]: https://github.com/syntax-tree/mdast#root + +[remark-mdx]: https://mdxjs.com/packages/remark-mdx/ + +[mdx]: https://mdxjs.com + +[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension + +[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options + +[dfn-flow-content]: #flowcontent-mdxjs-esm + +[api-mdxjs-esm-from-markdown]: #mdxjsesmfrommarkdown + +[api-mdxjs-esm-to-markdown]: #mdxjsesmtomarkdown + +[api-mdxjs-esm]: #mdxjsesm + +[api-mdxjs-esm-hast]: #mdxjsesmhast diff --git a/node_modules/mdast-util-phrasing/index.d.ts b/node_modules/mdast-util-phrasing/index.d.ts new file mode 100644 index 00000000..b90dfa7c --- /dev/null +++ b/node_modules/mdast-util-phrasing/index.d.ts @@ -0,0 +1 @@ +export { phrasing } from "./lib/index.js"; diff --git a/node_modules/mdast-util-phrasing/index.js b/node_modules/mdast-util-phrasing/index.js new file mode 100644 index 00000000..2627f17a --- /dev/null +++ b/node_modules/mdast-util-phrasing/index.js @@ -0,0 +1 @@ +export {phrasing} from './lib/index.js' diff --git a/node_modules/mdast-util-phrasing/license b/node_modules/mdast-util-phrasing/license new file mode 100644 index 00000000..6883cb51 --- /dev/null +++ b/node_modules/mdast-util-phrasing/license @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2017 Titus Wormer +Copyright (c) 2017 Victor Felder + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-phrasing/package.json b/node_modules/mdast-util-phrasing/package.json new file mode 100644 index 00000000..2af70323 --- /dev/null +++ b/node_modules/mdast-util-phrasing/package.json @@ -0,0 +1,78 @@ +{ + "name": "mdast-util-phrasing", + "version": "4.1.0", + "description": "mdast utility to check if a node is phrasing content", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast=util", + "util", + "utility", + "markdown", + "phrasing" + ], + "repository": "syntax-tree/mdast-util-phrasing", + "bugs": "https://github.com/syntax-tree/mdast-util-phrasing/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Victor Felder (https://draft.li)", + "contributors": [ + "Victor Felder (https://draft.li)", + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^9.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.56.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/mdast-util-phrasing/readme.md b/node_modules/mdast-util-phrasing/readme.md new file mode 100644 index 00000000..a797fef2 --- /dev/null +++ b/node_modules/mdast-util-phrasing/readme.md @@ -0,0 +1,200 @@ +# mdast-util-phrasing + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] utility to check if a node is phrasing content. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`phrasing(value)`](#phrasingvalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a tiny utility to check that a given [node][] is [phrasing +content][phrasing]. + +## When should I use this? + +This utility is typically useful if you’re making other utilities. +It uses [`unist-util-is`][unist-util-is], which you can use for your own checks. + +A different utility, [`hast-util-phrasing`][hast-util-phrasing], does the same +but on [hast][]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-phrasing +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {phrasing} from 'https://esm.sh/mdast-util-phrasing@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {phrasing} from 'mdast-util-phrasing' + +phrasing({type: 'paragraph', children: [{type: 'text', value: 'Alpha'}]}) +// => false + +phrasing({type: 'strong', children: [{type: 'text', value: 'Delta'}]}) +// => true +``` + +## API + +This package exports the identifier [`phrasing`][api-phrasing]. +There is no default export. + +### `phrasing(value)` + +Check if the given value is *[phrasing content][phrasing]*. + +> 👉 **Note**: Excludes `html`, which can be both phrasing or flow. + +###### Parameters + +* `value` (`unknown`) + — thing to check, typically [`Node`][node] + +###### Returns + +Whether `value` is phrasing content (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It does not export extra types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-phrasing@^4`, +compatible with Node.js 16. + +## Security + +Use of `mdast-util-phrasing` does not involve **[hast][]**, user content, or +change the tree, so there are no openings for [cross-site scripting (XSS)][xss] +attacks. + +## Related + +* [`hast-util-phrasing`](https://github.com/syntax-tree/hast-util-phrasing) + — check if a hast node is phrasing content +* [`unist-util-is`](https://github.com/syntax-tree/unist-util-is) + — check if a node passes a test + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Victor Felder][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-phrasing/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-phrasing/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-phrasing.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-phrasing + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-phrasing.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-phrasing + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-phrasing + +[size]: https://bundlejs.com/?q=mdast-util-phrasing + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://draft.li + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[phrasing]: https://github.com/syntax-tree/mdast#phrasingcontent + +[unist-util-is]: https://github.com/syntax-tree/unist-util-is + +[hast-util-phrasing]: https://github.com/syntax-tree/hast-util-phrasing + +[api-phrasing]: #phrasingvalue diff --git a/node_modules/mdast-util-to-hast/index.d.ts b/node_modules/mdast-util-to-hast/index.d.ts new file mode 100644 index 00000000..1c5c9128 --- /dev/null +++ b/node_modules/mdast-util-to-hast/index.d.ts @@ -0,0 +1,94 @@ +import type {Data, ElementContent, Literal, Properties} from 'hast' + +// Expose types. +export type { + FootnoteBackContentTemplate, + FootnoteBackLabelTemplate +} from './lib/footer.js' +export type {Handler, Handlers, Options, State} from './lib/state.js' + +// Expose JS API. +export {handlers as defaultHandlers} from './lib/handlers/index.js' +export { + defaultFootnoteBackContent, + defaultFootnoteBackLabel +} from './lib/footer.js' +export {toHast} from './lib/index.js' + +/** + * Raw string of HTML embedded into HTML AST. + */ +export interface Raw extends Literal { + /** + * Node type of raw. + */ + type: 'raw' + + /** + * Data associated with the hast raw. + */ + data?: RawData | undefined +} + +/** + * Info associated with hast raw nodes by the ecosystem. + */ +export interface RawData extends Data {} + +// Register nodes in content. +declare module 'hast' { + interface ElementData { + /** + * Custom info relating to the node, if `` in `
`.
+     *
+     * Defined by `mdast-util-to-hast` (`remark-rehype`).
+     */
+    meta?: string | null | undefined
+  }
+
+  interface ElementContentMap {
+    /**
+     * Raw string of HTML embedded into HTML AST.
+     */
+    raw: Raw
+  }
+
+  interface RootContentMap {
+    /**
+     * Raw string of HTML embedded into HTML AST.
+     */
+    raw: Raw
+  }
+}
+
+// Register data on mdast.
+declare module 'mdast' {
+  interface Data {
+    /**
+     * Field supported by `mdast-util-to-hast` to signal that a node should
+     * result in something with these children.
+     *
+     * When this is defined, when a parent is created, these children will
+     * be used.
+     */
+    hChildren?: ElementContent[] | undefined
+
+    /**
+     * Field supported by `mdast-util-to-hast` to signal that a node should
+     * result in a particular element, instead of its default behavior.
+     *
+     * When this is defined, an element with the given tag name is created.
+     * For example, when setting `hName` to `'b'`, a `` element is created.
+     */
+    hName?: string | undefined
+
+    /**
+     * Field supported by `mdast-util-to-hast` to signal that a node should
+     * result in an element with these properties.
+     *
+     * When this is defined, when an element is created, these properties will
+     * be used.
+     */
+    hProperties?: Properties | undefined
+  }
+}
diff --git a/node_modules/mdast-util-to-hast/index.js b/node_modules/mdast-util-to-hast/index.js
new file mode 100644
index 00000000..5e88898b
--- /dev/null
+++ b/node_modules/mdast-util-to-hast/index.js
@@ -0,0 +1,7 @@
+// Note: types exposed from `index.d.ts`.
+export {handlers as defaultHandlers} from './lib/handlers/index.js'
+export {toHast} from './lib/index.js'
+export {
+  defaultFootnoteBackContent,
+  defaultFootnoteBackLabel
+} from './lib/footer.js'
diff --git a/node_modules/mdast-util-to-hast/license b/node_modules/mdast-util-to-hast/license
new file mode 100644
index 00000000..8d8660d3
--- /dev/null
+++ b/node_modules/mdast-util-to-hast/license
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2016 Titus Wormer 
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/mdast-util-to-hast/package.json b/node_modules/mdast-util-to-hast/package.json
new file mode 100644
index 00000000..99166bc4
--- /dev/null
+++ b/node_modules/mdast-util-to-hast/package.json
@@ -0,0 +1,119 @@
+{
+  "name": "mdast-util-to-hast",
+  "version": "13.2.1",
+  "description": "mdast utility to transform to hast",
+  "license": "MIT",
+  "keywords": [
+    "unist",
+    "mdast",
+    "mdast-util",
+    "hast",
+    "hast-util",
+    "util",
+    "utility",
+    "markdown",
+    "html"
+  ],
+  "repository": "syntax-tree/mdast-util-to-hast",
+  "bugs": "https://github.com/syntax-tree/mdast-util-to-hast/issues",
+  "funding": {
+    "type": "opencollective",
+    "url": "https://opencollective.com/unified"
+  },
+  "author": "Titus Wormer  (https://wooorm.com)",
+  "contributors": [
+    "Titus Wormer  (https://wooorm.com)"
+  ],
+  "sideEffects": false,
+  "type": "module",
+  "exports": "./index.js",
+  "files": [
+    "lib/",
+    "index.d.ts.map",
+    "index.d.ts",
+    "index.js"
+  ],
+  "dependencies": {
+    "@types/hast": "^3.0.0",
+    "@types/mdast": "^4.0.0",
+    "@ungap/structured-clone": "^1.0.0",
+    "devlop": "^1.0.0",
+    "micromark-util-sanitize-uri": "^2.0.0",
+    "trim-lines": "^3.0.0",
+    "unist-util-position": "^5.0.0",
+    "unist-util-visit": "^5.0.0",
+    "vfile": "^6.0.0"
+  },
+  "devDependencies": {
+    "@types/node": "^20.0.0",
+    "@types/ungap__structured-clone": "^1.0.0",
+    "c8": "^9.0.0",
+    "hast-util-to-html": "^9.0.0",
+    "hastscript": "^9.0.0",
+    "mdast-util-from-markdown": "^2.0.0",
+    "mdast-util-gfm": "^3.0.0",
+    "micromark-extension-gfm": "^3.0.0",
+    "prettier": "^3.0.0",
+    "remark-cli": "^12.0.0",
+    "remark-preset-wooorm": "^10.0.0",
+    "type-coverage": "^2.0.0",
+    "typescript": "^5.5.1-rc",
+    "xo": "^0.58.0"
+  },
+  "scripts": {
+    "prepack": "npm run build && npm run format",
+    "build": "tsc --build --clean && tsc --build && type-coverage",
+    "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
+    "test-api": "node --conditions development test/index.js",
+    "test-coverage": "c8 --100 --reporter lcov npm run test-api",
+    "test": "npm run build && npm run format && npm run test-coverage"
+  },
+  "prettier": {
+    "bracketSpacing": false,
+    "semi": false,
+    "singleQuote": true,
+    "tabWidth": 2,
+    "trailingComma": "none",
+    "useTabs": false
+  },
+  "remarkConfig": {
+    "plugins": [
+      "remark-preset-wooorm",
+      [
+        "remark-lint-no-html",
+        false
+      ]
+    ]
+  },
+  "typeCoverage": {
+    "atLeast": 100,
+    "detail": true,
+    "ignoreCatch": true,
+    "#": "needed `any`s",
+    "ignoreFiles": [
+      "lib/state.d.ts"
+    ],
+    "strict": true
+  },
+  "xo": {
+    "overrides": [
+      {
+        "files": [
+          "**/*.ts"
+        ],
+        "rules": {
+          "@typescript-eslint/ban-types": "off",
+          "@typescript-eslint/consistent-type-definitions": "off"
+        }
+      }
+    ],
+    "prettier": true,
+    "rules": {
+      "import/no-cycle": "error",
+      "max-depth": "off",
+      "unicorn/prefer-at": "off",
+      "unicorn/prefer-code-point": "off",
+      "unicorn/prefer-string-replace-all": "off"
+    }
+  }
+}
diff --git a/node_modules/mdast-util-to-hast/readme.md b/node_modules/mdast-util-to-hast/readme.md
new file mode 100644
index 00000000..6e40d91b
--- /dev/null
+++ b/node_modules/mdast-util-to-hast/readme.md
@@ -0,0 +1,1725 @@
+# mdast-util-to-hast
+
+[![Build][build-badge]][build]
+[![Coverage][coverage-badge]][coverage]
+[![Downloads][downloads-badge]][downloads]
+[![Size][size-badge]][size]
+[![Sponsors][sponsors-badge]][collective]
+[![Backers][backers-badge]][collective]
+[![Chat][chat-badge]][chat]
+
+[mdast][] utility to transform to [hast][].
+
+## Contents
+
+* [What is this?](#what-is-this)
+* [When should I use this?](#when-should-i-use-this)
+* [Install](#install)
+* [Use](#use)
+* [API](#api)
+  * [`defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`](#defaultfootnotebackcontentreferenceindex-rereferenceindex)
+  * [`defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`](#defaultfootnotebacklabelreferenceindex-rereferenceindex)
+  * [`defaultHandlers`](#defaulthandlers)
+  * [`toHast(tree[, options])`](#tohasttree-options)
+  * [`FootnoteBackContentTemplate`](#footnotebackcontenttemplate)
+  * [`FootnoteBackLabelTemplate`](#footnotebacklabeltemplate)
+  * [`Handler`](#handler)
+  * [`Handlers`](#handlers)
+  * [`Options`](#options)
+  * [`Raw`](#raw)
+  * [`State`](#state)
+* [Examples](#examples)
+  * [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely)
+  * [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly)
+  * [Example: footnotes in languages other than English](#example-footnotes-in-languages-other-than-english)
+  * [Example: supporting custom nodes](#example-supporting-custom-nodes)
+* [Algorithm](#algorithm)
+  * [Default handling](#default-handling)
+  * [Fields on nodes](#fields-on-nodes)
+* [CSS](#css)
+* [Syntax tree](#syntax-tree)
+  * [Nodes](#nodes)
+* [Types](#types)
+* [Compatibility](#compatibility)
+* [Security](#security)
+* [Related](#related)
+* [Contribute](#contribute)
+* [License](#license)
+
+## What is this?
+
+This package is a utility that takes an [mdast][] (markdown) syntax tree as
+input and turns it into a [hast][] (HTML) syntax tree.
+
+## When should I use this?
+
+This project is useful when you want to deal with ASTs and turn markdown to
+HTML.
+
+The hast utility [`hast-util-to-mdast`][hast-util-to-mdast] does the inverse of
+this utility.
+It turns HTML into markdown.
+
+The remark plugin [`remark-rehype`][remark-rehype] wraps this utility to also
+turn markdown to HTML at a higher-level (easier) abstraction.
+
+## Install
+
+This package is [ESM only][esm].
+In Node.js (version 16+), install with [npm][]:
+
+```sh
+npm install mdast-util-to-hast
+```
+
+In Deno with [`esm.sh`][esmsh]:
+
+```js
+import {toHast} from 'https://esm.sh/mdast-util-to-hast@13'
+```
+
+In browsers with [`esm.sh`][esmsh]:
+
+```html
+
+```
+
+## Use
+
+Say we have the following `example.md`:
+
+```markdown
+## Hello **World**!
+```
+
+…and next to it a module `example.js`:
+
+```js
+import {fs} from 'node:fs/promises'
+import {toHtml} from 'hast-util-to-html'
+import {fromMarkdown} from 'mdast-util-from-markdown'
+import {toHast} from 'mdast-util-to-hast'
+
+const markdown = String(await fs.readFile('example.md'))
+const mdast = fromMarkdown(markdown)
+const hast = toHast(mdast)
+const html = toHtml(hast)
+
+console.log(html)
+```
+
+…now running `node example.js` yields:
+
+```html
+

Hello World!

+``` + +## API + +This package exports the identifiers +[`defaultFootnoteBackContent`][api-default-footnote-back-content], +[`defaultFootnoteBackLabel`][api-default-footnote-back-label], +[`defaultHandlers`][api-default-handlers], and +[`toHast`][api-to-hast]. +There is no default export. + +### `defaultFootnoteBackContent(referenceIndex, rereferenceIndex)` + +Generate the default content that GitHub uses on backreferences. + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Content (`Array`). + +### `defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)` + +Generate the default label that GitHub uses on backreferences. + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Label (`string`). + +### `defaultHandlers` + +Default handlers for nodes ([`Handlers`][api-handlers]). + +### `toHast(tree[, options])` + +Transform mdast to hast. + +###### Parameters + +* `tree` ([`MdastNode`][mdast-node]) + — mdast tree +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +hast tree ([`HastNode`][hast-node]). + +##### Notes + +###### HTML + +Raw HTML is available in mdast as [`html`][mdast-html] nodes and can be embedded +in hast as semistandard `raw` nodes. +Most utilities ignore `raw` nodes but two notable ones don’t: + +* [`hast-util-to-html`][hast-util-to-html] also has an option + `allowDangerousHtml` which will output the raw HTML. + This is typically discouraged as noted by the option name but is useful if + you completely trust authors +* [`hast-util-raw`][hast-util-raw] can handle the raw embedded HTML strings by + parsing them into standard hast nodes (`element`, `text`, etc). + This is a heavy task as it needs a full HTML parser, but it is the only way + to support untrusted content + +###### Footnotes + +Many options supported here relate to footnotes. +Footnotes are not specified by CommonMark, which we follow by default. +They are supported by GitHub, so footnotes can be enabled in markdown with +[`mdast-util-gfm`][mdast-util-gfm]. + +The options `footnoteBackLabel` and `footnoteLabel` define natural language +that explains footnotes, which is hidden for sighted users but shown to +assistive technology. +When your page is not in English, you must define translated values. + +Back references use ARIA attributes, but the section label itself uses a +heading that is hidden with an `sr-only` class. +To show it to sighted users, define different attributes in +`footnoteLabelProperties`. + +###### Clobbering + +Footnotes introduces a problem, as it links footnote calls to footnote +definitions on the page through `id` attributes generated from user content, +which results in DOM clobbering. + +DOM clobbering is this: + +```html +

+ +``` + +Elements by their ID are made available by browsers on the `window` object, +which is a security risk. +Using a prefix solves this problem. + +More information on how to handle clobbering and the prefix is explained in +[Example: headings (DOM clobbering) in `rehype-sanitize`][clobber-example]. + +###### Unknown nodes + +Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`. +The default behavior for unknown nodes is: + +* when the node has a `value` (and doesn’t have `data.hName`, + `data.hProperties`, or `data.hChildren`, see later), create a hast `text` + node +* otherwise, create a `
` element (which could be changed with + `data.hName`), with its children mapped from mdast to hast as well + +This behavior can be changed by passing an `unknownHandler`. + +### `FootnoteBackContentTemplate` + +Generate content for the backreference dynamically. + +For the following markdown: + +```markdown +Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + +[^remark]: things about remark +[^micromark]: things about micromark +``` + +This function will be called with: + +* `0` and `0` for the backreference from `things about micromark` to + `alpha`, as it is the first used definition, and the first call to it +* `0` and `1` for the backreference from `things about micromark` to + `bravo`, as it is the first used definition, and the second call to it +* `1` and `0` for the backreference from `things about remark` to + `charlie`, as it is the second used definition + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Content for the backreference when linking back from definitions to their +reference (`Array`, `ElementContent`, or `string`). + +### `FootnoteBackLabelTemplate` + +Generate a back label dynamically. + +For the following markdown: + +```markdown +Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + +[^remark]: things about remark +[^micromark]: things about micromark +``` + +This function will be called with: + +* `0` and `0` for the backreference from `things about micromark` to + `alpha`, as it is the first used definition, and the first call to it +* `0` and `1` for the backreference from `things about micromark` to + `bravo`, as it is the first used definition, and the second call to it +* `1` and `0` for the backreference from `things about remark` to + `charlie`, as it is the second used definition + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Back label to use when linking back from definitions to their reference +(`string`). + +### `Handler` + +Handle a node (TypeScript type). + +###### Parameters + +* `state` ([`State`][api-state]) + — info passed around +* `node` ([`MdastNode`][mdast-node]) + — node to handle +* `parent` ([`MdastNode | undefined`][mdast-node]) + — parent of `node` + +###### Returns + +Result ([`Array | HastNode | undefined`][hast-node]). + +### `Handlers` + +Handle nodes (TypeScript type). + +###### Type + +```ts +type Handlers = Partial> +``` + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `allowDangerousHtml` (`boolean`, default: `false`) + — whether to persist raw HTML in markdown in the hast tree +* `clobberPrefix` (`string`, default: `'user-content-'`) + — prefix to use before the `id` property on footnotes to prevent them from + *clobbering* +* `file` ([`VFile`][vfile], optional) + — corresponding virtual file representing the input document +* `footnoteBackContent` + ([`FootnoteBackContentTemplate`][api-footnote-back-content-template] + or `string`, default: + [`defaultFootnoteBackContent`][api-default-footnote-back-content]) + — content of the backreference back to references +* `footnoteBackLabel` + ([`FootnoteBackLabelTemplate`][api-footnote-back-label-template] + or `string`, default: + [`defaultFootnoteBackLabel`][api-default-footnote-back-label]) + — label to describe the backreference back to references +* `footnoteLabel` (`string`, default: `'Footnotes'`) + — label to use for the footnotes section (affects screen readers) +* `footnoteLabelProperties` + ([`Properties`][properties], default: `{className: ['sr-only']}`) + — properties to use on the footnote label + (note that `id: 'footnote-label'` is always added as footnote calls use it + with `aria-describedby` to provide an accessible label) +* `footnoteLabelTagName` (`string`, default: `h2`) + — tag name to use for the footnote label +* `handlers` ([`Handlers`][api-handlers], optional) + — extra handlers for nodes +* `passThrough` (`Array`, optional) + — list of custom mdast node types to pass through (keep) in hast (note that + the node itself is passed, but eventual children are transformed) +* `unknownHandler` ([`Handler`][api-handler], optional) + — handle all unknown nodes + +### `Raw` + +Raw string of HTML embedded into HTML AST (TypeScript type). + +###### Type + +```ts +import type {Data, Literal} from 'hast' + +interface Raw extends Literal { + type: 'raw' + data?: RawData | undefined +} + +interface RawData extends Data {} +``` + +### `State` + +Info passed around about the current state (TypeScript type). + +###### Fields + +* `all` (`(node: MdastNode) => Array`) + — transform the children of an mdast parent to hast +* `applyData` (`(from: MdastNode, to: Type) => Type | HastElement`) + — honor the `data` of `from` and maybe generate an element instead of `to` +* `definitionById` (`Map`) + — definitions by their uppercased identifier +* `footnoteById` (`Map`) + — footnote definitions by their uppercased identifier +* `footnoteCounts` (`Map`) + — counts for how often the same footnote was called +* `footnoteOrder` (`Array`) + — identifiers of order when footnote calls first appear in tree order +* `handlers` ([`Handlers`][api-handlers]) + — applied node handlers +* `one` (`(node: MdastNode, parent: MdastNode | undefined) => HastNode | Array | undefined`) + — transform an mdast node to hast +* `options` ([`Options`][api-options]) + — configuration +* `patch` (`(from: MdastNode, to: HastNode) => undefined`) +* `wrap` (`(nodes: Array, loose?: boolean) => Array`) + — wrap `nodes` with line endings between each node, adds initial/final line + endings when `loose` + +## Examples + +### Example: supporting HTML in markdown naïvely + +If you completely trust authors (or plugins) and want to allow them to HTML *in* +markdown, and the last utility has an `allowDangerousHtml` option as well (such +as `hast-util-to-html`) you can pass `allowDangerousHtml` to this utility +(`mdast-util-to-hast`): + +```js +import {fromMarkdown} from 'mdast-util-from-markdown' +import {toHast} from 'mdast-util-to-hast' +import {toHtml} from 'hast-util-to-html' + +const markdown = 'It works! ' +const mdast = fromMarkdown(markdown) +const hast = toHast(mdast, {allowDangerousHtml: true}) +const html = toHtml(hast, {allowDangerousHtml: true}) + +console.log(html) +``` + +…now running `node example.js` yields: + +```html +

It works!

+``` + +> ⚠️ **Danger**: observe that the XSS attack through the `onerror` attribute +> is still present. + +### Example: supporting HTML in markdown properly + +If you do not trust the authors of the input markdown, or if you want to make +sure that further utilities can see HTML embedded in markdown, use +[`hast-util-raw`][hast-util-raw]. +The following example passes `allowDangerousHtml` to this utility +(`mdast-util-to-hast`), then turns the raw embedded HTML into proper HTML nodes +(`hast-util-raw`), and finally sanitizes the HTML by only allowing safe things +(`hast-util-sanitize`): + +```js +import {raw} from 'hast-util-raw' +import {sanitize} from 'hast-util-sanitize' +import {toHtml} from 'hast-util-to-html' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {toHast} from 'mdast-util-to-hast' + +const markdown = 'It works! ' +const mdast = fromMarkdown(markdown) +const hast = raw(toHast(mdast, {allowDangerousHtml: true})) +const safeHast = sanitize(hast) +const html = toHtml(safeHast) + +console.log(html) +``` + +…now running `node example.js` yields: + +```html +

It works!

+``` + +> 👉 **Note**: observe that the XSS attack through the `onerror` attribute +> is no longer present. + +### Example: footnotes in languages other than English + +If you know that the markdown is authored in a language other than English, +and you’re using `micromark-extension-gfm` and `mdast-util-gfm` to match how +GitHub renders markdown, and you know that footnotes are (or can?) be used, you +should translate the labels associated with them. + +Let’s first set the stage: + +```js +import {toHtml} from 'hast-util-to-html' +import {gfm} from 'micromark-extension-gfm' +import {fromMarkdown} from 'mdast-util-from-markdown' +import {gfmFromMarkdown} from 'mdast-util-gfm' +import {toHast} from 'mdast-util-to-hast' + +const markdown = 'Bonjour[^1]\n\n[^1]: Monde!' +const mdast = fromMarkdown(markdown, { + extensions: [gfm()], + mdastExtensions: [gfmFromMarkdown()] +}) +const hast = toHast(mdast) +const html = toHtml(hast) + +console.log(html) +``` + +…now running `node example.js` yields: + +```html +

Bonjour1

+

Footnotes

+
    +
  1. +

    Monde!

    +
  2. +
+
+``` + +This is a mix of English and French that screen readers can’t handle nicely. +Let’s say our program does know that the markdown is in French. +In that case, it’s important to translate and define the labels relating to +footnotes so that screen reader users can properly pronounce the page: + +```diff +@@ -9,7 +9,16 @@ const mdast = fromMarkdown(markdown, { + extensions: [gfm()], + mdastExtensions: [gfmFromMarkdown()] + }) +-const hast = toHast(mdast) ++const hast = toHast(mdast, { ++ footnoteLabel: 'Notes de bas de page', ++ footnoteBackLabel(referenceIndex, rereferenceIndex) { ++ return ( ++ 'Retour à la référence ' + ++ (referenceIndex + 1) + ++ (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') ++ ) ++ } ++}) + const html = toHtml(hast) + + console.log(html) +``` + +…now running `node example.js` with the above patch applied yields: + +```diff +@@ -1,8 +1,8 @@ +

Bonjour1

+-

Footnotes

++

Notes de bas de page

+
    +
  1. +-

    Monde!

    ++

    Monde!

    +
  2. +
+
+``` + +### Example: supporting custom nodes + +This project supports CommonMark and the GFM constructs (footnotes, +strikethrough, tables) and the frontmatter constructs YAML and TOML. +Support can be extended to other constructs in two ways: a) with handlers, b) +through fields on nodes. + +For example, when we represent a mark element in markdown and want to turn it +into a `` element in HTML, we can use a handler: + +```js +import {toHtml} from 'hast-util-to-html' +import {toHast} from 'mdast-util-to-hast' + +const mdast = { + type: 'paragraph', + children: [{type: 'mark', children: [{type: 'text', value: 'x'}]}] +} + +const hast = toHast(mdast, { + handlers: { + mark(state, node) { + return { + type: 'element', + tagName: 'mark', + properties: {}, + children: state.all(node) + } + } + } +}) + +console.log(toHtml(hast)) +``` + +We can do the same through certain fields on nodes: + +```js +import {toHtml} from 'hast-util-to-html' +import {toHast} from 'mdast-util-to-hast' + +const mdast = { + type: 'paragraph', + children: [ + { + type: 'mark', + children: [{type: 'text', value: 'x'}], + data: {hName: 'mark'} + } + ] +} + +console.log(toHtml(toHast(mdast))) +``` + +## Algorithm + +This project by default handles CommonMark, GFM (footnotes, strikethrough, +tables) and common frontmatter (YAML, TOML). + +Existing handlers can be overwritten and handlers for more nodes can be added. +It’s also possible to define how mdast is turned into hast through fields on +nodes. + +### Default handling + +The following table gives insight into what input turns into what output: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mdast nodemarkdown examplehast nodehtml example
+ +[`blockquote`](https://github.com/syntax-tree/mdast#blockquote) + + + +```markdown +> A greater than… +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`blockquote`) + + + +```html +
+

A greater than…

+
+``` + +
+ +[`break`](https://github.com/syntax-tree/mdast#break) + + + +```markdown +A backslash\ +before a line break… +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`br`) + + + +```html +

A backslash
+before a line break…

+``` + +
+ +[`code`](https://github.com/syntax-tree/mdast#code) + + + +````markdown +```js +backtick.fences('for blocks') +``` +```` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`pre` and `code`) + + + +```html +
backtick.fences('for blocks')
+
+``` + +
+ +[`delete`](https://github.com/syntax-tree/mdast#delete) (GFM) + + + +```markdown +Two ~~tildes~~ for delete. +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`del`) + + + +```html +

Two tildes for delete.

+``` + +
+ +[`emphasis`](https://github.com/syntax-tree/mdast#emphasis) + + + +```markdown +Some *asterisks* for emphasis. +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`em`) + + + +```html +

Some asterisks for emphasis.

+``` + +
+ +[`footnoteReference`](https://github.com/syntax-tree/mdast#footnotereference), +[`footnoteDefinition`](https://github.com/syntax-tree/mdast#footnotedefinition) +(GFM) + + + +```markdown +With a [^caret]. + +[^caret]: Stuff +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`section`, `sup`, `a`) + + + +```html +

With a 1.

… +``` + +
+ +[`heading`](https://github.com/syntax-tree/mdast#heading) + + + +```markdown +# One number sign… +###### Six number signs… +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`h1`…`h6`) + + + +```html +

One number sign…

+
Six number signs…
+``` + +
+ +[`html`](https://github.com/syntax-tree/mdast#html) + + + +```html +CMD+S +``` + + + +Nothing (default), `raw` (when `allowDangerousHtml: true`) + + + +n/a + +
+ +[`image`](https://github.com/syntax-tree/mdast#image) + + + +```markdown +![Alt text](/logo.png "title") +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`img`) + + + +```html +

Alt text

+``` + +
+ +[`imageReference`](https://github.com/syntax-tree/mdast#imagereference), +[`definition`](https://github.com/syntax-tree/mdast#definition) + + + +```markdown +![Alt text][logo] + +[logo]: /logo.png "title" +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`img`) + + + +```html +

Alt text

+``` + +
+ +[`inlineCode`](https://github.com/syntax-tree/mdast#inlinecode) + + + +```markdown +Some `backticks` for inline code. +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`code`) + + + +```html +

Some backticks for inline code.

+``` + +
+ +[`link`](https://github.com/syntax-tree/mdast#link) + + + +```markdown +[Example](https://example.com "title") +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`a`) + + + +```html +

Example

+``` + +
+ +[`linkReference`](https://github.com/syntax-tree/mdast#linkreference), +[`definition`](https://github.com/syntax-tree/mdast#definition) + + + +```markdown +[Example][] + +[example]: https://example.com "title" +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`a`) + + + +```html +

Example

+``` + +
+ +[`list`](https://github.com/syntax-tree/mdast#list), +[`listItem`](https://github.com/syntax-tree/mdast#listitem) + + + +```markdown +* asterisks for unordered items + +1. decimals and a dot for ordered items +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`li` and `ol` or `ul`) + + + +```html +
    +
  • asterisks for unordered items
  • +
+
    +
  1. decimals and a dot for ordered items
  2. +
+``` + +
+ +[`paragraph`](https://github.com/syntax-tree/mdast#paragraph) + + + +```markdown +Just some text… +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`p`) + + + +```html +

Just some text…

+``` + +
+ +[`root`](https://github.com/syntax-tree/mdast#root) + + + +```markdown +Anything! +``` + + + +[`root`](https://github.com/syntax-tree/hast#root) + + + +```html +

Anything!

+``` + +
+ +[`strong`](https://github.com/syntax-tree/mdast#strong) + + + +```markdown +Two **asterisks** for strong. +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`strong`) + + + +```html +

Two asterisks for strong.

+``` + +
+ +[`text`](https://github.com/syntax-tree/mdast#text) + + + +```markdown +Anything! +``` + + + +[`text`](https://github.com/syntax-tree/hast#text) + + + +```html +

Anything!

+``` + +
+ +[`table`](https://github.com/syntax-tree/mdast#table), +[`tableRow`](https://github.com/syntax-tree/mdast#tablerow), +[`tableCell`](https://github.com/syntax-tree/mdast#tablecell) + + + +```markdown +| Pipes | +| ----- | +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`table`, `thead`, +`tbody`, `tr`, `td`, `th`) + + + +```html + + + + + + +
Pipes
+``` + +
+ +[`thematicBreak`](https://github.com/syntax-tree/mdast#thematicbreak) + + + +```markdown +Three asterisks for a thematic break: + +*** +``` + + + +[`element`](https://github.com/syntax-tree/hast#element) (`hr`) + + + +```html +

Three asterisks for a thematic break:

+
+``` + +
+ +`toml` (frontmatter) + + + +```markdown ++++ +fenced = true ++++ +``` + + + +Nothing + + + +n/a + +
+ +[`yaml`](https://github.com/syntax-tree/mdast#yaml) (frontmatter) + + + +```markdown +--- +fenced: yes +--- +``` + + + +Nothing + + + +n/a + +
+ +> 👉 **Note**: GFM prescribes that the obsolete `align` attribute on `td` and +> `th` elements is used. +> To use `style` attributes instead of obsolete features, combine this utility +> with [`@mapbox/hast-util-table-cell-style`][hast-util-table-cell-style]. + +> 🧑‍🏫 **Info**: this project is concerned with turning one syntax tree into +> another. +> It does not deal with markdown syntax or HTML syntax. +> The preceding examples are illustrative rather than authoritative or +> exhaustive. + +### Fields on nodes + +A frequent problem arises when having to turn one syntax tree into another. +As the original tree (in this case, mdast for markdown) is in some cases +limited compared to the destination (in this case, hast for HTML) tree, +is it possible to provide more info in the original to define what the +result will be in the destination? +This is possible by defining data on mdast nodes, which this utility will read +as instructions on what hast nodes to create. + +An example is math, which is a nonstandard markdown extension, that this utility +doesn’t understand. +To solve this, `mdast-util-math` defines instructions on mdast nodes that this +plugin does understand because they define a certain hast structure. + +The following fields can be used: + +* `node.data.hName` — define the element’s tag name +* `node.data.hProperties` — define extra properties to use +* `node.data.hChildren` — define hast children to use + +###### `hName` + +`node.data.hName` sets the tag name of an element. +The following [mdast][]: + +```js +{ + type: 'strong', + data: {hName: 'b'}, + children: [{type: 'text', value: 'Alpha'}] +} +``` + +…yields ([hast][]): + +```js +{ + type: 'element', + tagName: 'b', + properties: {}, + children: [{type: 'text', value: 'Alpha'}] +} +``` + +###### `hProperties` + +`node.data.hProperties` sets the properties of an element. +The following [mdast][]: + +```js +{ + type: 'image', + src: 'circle.svg', + alt: 'Big red circle on a black background', + data: {hProperties: {className: ['responsive']}} +} +``` + +…yields ([hast][]): + +```js +{ + type: 'element', + tagName: 'img', + properties: { + src: 'circle.svg', + alt: 'Big red circle on a black background', + className: ['responsive'] + }, + children: [] +} +``` + +###### `hChildren` + +`node.data.hChildren` sets the children of an element. +The following [mdast][]: + +```js +{ + type: 'code', + lang: 'js', + data: { + hChildren: [ + { + type: 'element', + tagName: 'span', + properties: {className: ['hljs-meta']}, + children: [{type: 'text', value: '"use strict"'}] + }, + {type: 'text', value: ';'} + ] + }, + value: '"use strict";' +} +``` + +…yields ([hast][]): + +```js +{ + type: 'element', + tagName: 'pre', + properties: {}, + children: [{ + type: 'element', + tagName: 'code', + properties: {className: ['language-js']}, + children: [ + { + type: 'element', + tagName: 'span', + properties: {className: ['hljs-meta']}, + children: [{type: 'text', value: '"use strict"'}] + }, + {type: 'text', value: ';'} + ] + }] +} +``` + +> 👉 **Note**: the `pre` and `language-js` class are normal `mdast-util-to-hast` +> functionality. + +## CSS + +Assuming you know how to use (semantic) HTML and CSS, then it should generally +be straightforward to style the HTML produced by this plugin. +With CSS, you can get creative and style the results as you please. + +Some semistandard features, notably GFMs tasklists and footnotes, generate HTML +that be unintuitive, as it matches exactly what GitHub produces for their +website. +There is a project, [`sindresorhus/github-markdown-css`][github-markdown-css], +that exposes the stylesheet that GitHub uses for rendered markdown, which might +either be inspirational for more complex features, or can be used as-is to +exactly match how GitHub styles rendered markdown. + +The following CSS is needed to make footnotes look a bit like GitHub: + +```css +/* Style the footnotes section. */ +.footnotes { + font-size: smaller; + color: #8b949e; + border-top: 1px solid #30363d; +} + +/* Hide the section label for visual users. */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + word-wrap: normal; + border: 0; +} + +/* Place `[` and `]` around footnote calls. */ +[data-footnote-ref]::before { + content: '['; +} + +[data-footnote-ref]::after { + content: ']'; +} +``` + +## Syntax tree + +The following interfaces are added to **[hast][]** by this utility. + +### Nodes + +#### `Raw` + +```idl +interface Raw <: Literal { + type: 'raw' +} +``` + +**Raw** (**[Literal][dfn-literal]**) represents a string if raw HTML inside +hast. +Raw nodes are typically ignored but are handled by +[`hast-util-to-html`][hast-util-to-html] and [`hast-util-raw`][hast-util-raw]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the +[`FootnoteBackContentTemplate`][api-footnote-back-content-template], +[`FootnoteBackLabelTemplate`][api-footnote-back-label-template], +[`Handler`][api-handler], +[`Handlers`][api-handlers], +[`Options`][api-options], +[`Raw`][api-raw], and +[`State`][api-state] types. + +It also registers the `Raw` node type with `@types/hast`. +If you’re working with the syntax tree (and you pass +`allowDangerousHtml: true`), make sure to import this utility somewhere in your +types, as that registers the new node type in the tree. + +```js +/** + * @import {Root} from 'hast' + * @import {} from 'mdast-util-to-hast' + */ + +import {visit} from 'unist-util-visit' + +/** @type {Root} */ +const tree = { /* … */ } + +visit(tree, function (node) { + // `node` can now be `raw`. +}) +``` + +Finally, it also registers the `hChildren`, `hName`, and `hProperties` fields +on `Data` of `@types/mdast`. +If you’re working with the syntax tree, make sure to import this utility +somewhere in your types, as that registers the data fields in the tree. + +```js +/** + * @import {Root} from 'hast' + * @import {} from 'mdast-util-to-hast' + */ + +import {visit} from 'unist-util-visit' + +/** @type {Root} */ +const tree = { /* … */ } + +console.log(tree.data?.hName) // Types as `string | undefined`. +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-to-hast@^13`, +compatible with Node.js 16. + +## Security + +Use of `mdast-util-to-hast` can open you up to a +[cross-site scripting (XSS)][xss] attack. +Embedded hast properties (`hName`, `hProperties`, `hChildren`), custom handlers, +and the `allowDangerousHtml` option all provide openings. + +The following example shows how a script is injected where a benign code block +is expected with embedded hast properties: + +```js +const code = {type: 'code', value: 'alert(1)'} + +code.data = {hName: 'script'} +``` + +Yields: + +```html + +``` + +The following example shows how an image is changed to fail loading and +therefore run code in a browser. + +```js +const image = {type: 'image', url: 'existing.png'} + +image.data = {hProperties: {src: 'missing', onError: 'alert(2)'}} +``` + +Yields: + +```html + +``` + +The following example shows the default handling of embedded HTML: + +```markdown +# Hello + + +``` + +Yields: + +```html +

Hello

+``` + +Passing `allowDangerousHtml: true` to `mdast-util-to-hast` is typically still +not enough to run unsafe code: + +```html +

Hello

+<script>alert(3)</script> +``` + +If `allowDangerousHtml: true` is also given to `hast-util-to-html` (or +`rehype-stringify`), the unsafe code runs: + +```html +

Hello

+ +``` + +Use [`hast-util-sanitize`][hast-util-sanitize] to make the hast tree safe. + +## Related + +* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast) + — transform hast to mdast +* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast) + — transform hast to xast +* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize) + — sanitize hast nodes + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-to-hast/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-to-hast/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-hast.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-hast + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-hast.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-to-hast + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-to-hast + +[size]: https://bundlejs.com/?q=mdast-util-to-hast + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-node]: https://github.com/syntax-tree/mdast#nodes + +[mdast-html]: https://github.com/syntax-tree/mdast#html + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[hast]: https://github.com/syntax-tree/hast + +[hast-node]: https://github.com/syntax-tree/hast#nodes + +[properties]: https://github.com/syntax-tree/hast#properties + +[hast-util-table-cell-style]: https://github.com/mapbox/hast-util-table-cell-style + +[hast-util-to-mdast]: https://github.com/syntax-tree/hast-util-to-mdast + +[hast-util-to-html]: https://github.com/syntax-tree/hast-util-to-html + +[hast-util-raw]: https://github.com/syntax-tree/hast-util-raw + +[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[remark-rehype]: https://github.com/remarkjs/remark-rehype + +[vfile]: https://github.com/vfile/vfile + +[clobber-example]: https://github.com/rehypejs/rehype-sanitize#example-headings-dom-clobbering + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[dfn-literal]: https://github.com/syntax-tree/hast#literal + +[api-default-footnote-back-content]: #defaultfootnotebackcontentreferenceindex-rereferenceindex + +[api-default-footnote-back-label]: #defaultfootnotebacklabelreferenceindex-rereferenceindex + +[api-default-handlers]: #defaulthandlers + +[api-footnote-back-content-template]: #footnotebackcontenttemplate + +[api-footnote-back-label-template]: #footnotebacklabeltemplate + +[api-handler]: #handler + +[api-handlers]: #handlers + +[api-options]: #options + +[api-raw]: #raw + +[api-state]: #state + +[api-to-hast]: #tohasttree-options diff --git a/node_modules/mdast-util-to-markdown/index.d.ts b/node_modules/mdast-util-to-markdown/index.d.ts new file mode 100644 index 00000000..5a07a517 --- /dev/null +++ b/node_modules/mdast-util-to-markdown/index.d.ts @@ -0,0 +1,16 @@ +export type { + ConstructNameMap, + ConstructName, + Handle, + Handlers, + Info, + Join, + Map, + Options, + SafeConfig, + State, + Tracker, + Unsafe +} from './lib/types.js' +export {toMarkdown} from './lib/index.js' +export {handle as defaultHandlers} from './lib/handle/index.js' diff --git a/node_modules/mdast-util-to-markdown/index.js b/node_modules/mdast-util-to-markdown/index.js new file mode 100644 index 00000000..24a6ef3c --- /dev/null +++ b/node_modules/mdast-util-to-markdown/index.js @@ -0,0 +1,3 @@ +// Note: extra types exposed from `index.d.ts`. +export {toMarkdown} from './lib/index.js' +export {handle as defaultHandlers} from './lib/handle/index.js' diff --git a/node_modules/mdast-util-to-markdown/license b/node_modules/mdast-util-to-markdown/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/mdast-util-to-markdown/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-to-markdown/package.json b/node_modules/mdast-util-to-markdown/package.json new file mode 100644 index 00000000..e6036c90 --- /dev/null +++ b/node_modules/mdast-util-to-markdown/package.json @@ -0,0 +1,132 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/syntax-tree/mdast-util-to-markdown/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "description": "mdast utility to serialize markdown", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "mdast-util-from-markdown": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-util-remove-position": "^5.0.0", + "xo": "^0.59.0" + }, + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "ast", + "compile", + "markdown", + "markup", + "mdast-util", + "mdast", + "serialize", + "stringify", + "syntax", + "tree", + "unist", + "utility", + "util" + ], + "license": "MIT", + "name": "mdast-util-to-markdown", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "syntax-tree/mdast-util-to-markdown", + "version": "2.1.2", + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test/index.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "ignoreFiles": [ + "lib/types.d.ts" + ], + "strict": true + }, + "type": "module", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "max-depth": "off", + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "complexity": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/mdast-util-to-markdown/readme.md b/node_modules/mdast-util-to-markdown/readme.md new file mode 100644 index 00000000..822dcbf5 --- /dev/null +++ b/node_modules/mdast-util-to-markdown/readme.md @@ -0,0 +1,750 @@ +# mdast-util-to-markdown + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**[mdast][]** utility that turns a syntax tree into markdown. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`toMarkdown(tree[, options])`](#tomarkdowntree-options) + * [`defaultHandlers`](#defaulthandlers) + * [`ConstructName`](#constructname) + * [`ConstructNameMap`](#constructnamemap) + * [`Handle`](#handle) + * [`Handlers`](#handlers) + * [`Info`](#info) + * [`Join`](#join) + * [`Map`](#map) + * [`Options`](#options) + * [`SafeConfig`](#safeconfig) + * [`State`](#state) + * [`Tracker`](#tracker) + * [`Unsafe`](#unsafe) +* [List of extensions](#list-of-extensions) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that takes an [mdast][] syntax tree as input and turns +it into serialized markdown. + +This utility is a low level project. +It’s used in [`remark-stringify`][remark-stringify], which focusses on making it +easier to transform content by abstracting these internals away. + +## When should I use this? + +If you want to handle syntax trees manually, use this. +For an easier time processing content, use the **[remark][]** ecosystem instead. + +You can combine this utility with other utilities to add syntax extensions. +Notable examples that deeply integrate with it are +[`mdast-util-gfm`][mdast-util-gfm], +[`mdast-util-mdx`][mdast-util-mdx], +[`mdast-util-frontmatter`][mdast-util-frontmatter], +[`mdast-util-math`][mdast-util-math], and +[`mdast-util-directive`][mdast-util-directive]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-to-markdown +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our module `example.js` looks as follows: + +```js +/** + * @import {Root} from 'mdast' + */ + +import {toMarkdown} from 'mdast-util-to-markdown' + +/** @type {Root} */ +const tree = { + type: 'root', + children: [ + { + type: 'blockquote', + children: [ + {type: 'thematicBreak'}, + { + type: 'paragraph', + children: [ + {type: 'text', value: '- a\nb !'}, + { + type: 'link', + url: 'example.com', + children: [{type: 'text', value: 'd'}] + } + ] + } + ] + } + ] +} + +console.log(toMarkdown(tree)) +``` + +…now running `node example.js` yields: + +```markdown +> *** +> +> \- a +> b \![d](example.com) +``` + +> 👉 **Note**: observe the properly escaped characters which would otherwise +> turn into a list and image respectively. + +## API + +This package exports the identifiers [`defaultHandlers`][api-default-handlers] +and [`toMarkdown`][api-to-markdown]. +There is no default export. + +### `toMarkdown(tree[, options])` + +Turn an **[mdast][]** syntax tree into markdown. + +###### Parameters + +* `tree` ([`Node`][node]) + — tree to serialize +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Serialized markdown representing `tree` (`string`). + +### `defaultHandlers` + +Default (CommonMark) handlers ([`Handlers`][api-handlers]). + +### `ConstructName` + +Construct names for things generated by `mdast-util-to-markdown` (TypeScript +type). + +This is an enum of strings, each being a semantic label, useful to know when +serializing whether we’re for example in a double (`"`) or single (`'`) quoted +title. + +###### Type + +```ts +type ConstructName = ConstructNameMap[keyof ConstructNameMap] +``` + +### `ConstructNameMap` + +Interface of registered constructs (TypeScript type). + +###### Type + +```ts +interface ConstructNameMap { /* see code */ } +``` + +When working on extensions that use new constructs, extend the corresponding +interface to register its name: + +```ts +declare module 'mdast-util-to-markdown' { + interface ConstructNameMap { + // Register a new construct name (value is used, key should match it). + gfmStrikethrough: 'gfmStrikethrough' + } +} +``` + +### `Handle` + +Handle a particular node (TypeScript type). + +###### Parameters + +* `node` (`any`) + — expected mdast node +* `parent` ([`Node`][node], optional) + — parent of `node` +* `state` ([`State`][api-state]) + — info passed around about the current state +* `info` ([`Info`][api-info]) + — info on the surrounding of the node that is serialized + +###### Returns + +Serialized markdown representing `node` (`string`). + +### `Handlers` + +Handle particular nodes (TypeScript type). + +Each key is a node type (`Node['type']`), each value its corresponding handler +([`Handle`][api-handle]). + +###### Type + +```ts +type Handlers = Record +``` + +### `Info` + +Info on the surrounding of the node that is serialized (TypeScript type). + +###### Fields + +* `now` ([`Point`][point]) + — current point +* `lineShift` (`number`) + — number of columns each line will be shifted by wrapping nodes +* `before` (`string`) + — characters before this (guaranteed to be one, can be more) +* `after` (`string`) + — characters after this (guaranteed to be one, can be more) + +### `Join` + +How to join two blocks (TypeScript type). + +“Blocks” are typically joined by one blank line. +Sometimes it’s nicer to have them flush next to each other, yet other times +they cannot occur together at all. + +Join functions receive two adjacent siblings and their parent and what they +return defines how many blank lines to use between them. + +###### Parameters + +* `left` ([`Node`][node]) + — first of two adjacent siblings +* `right` ([`Node`][node]) + — second of two adjacent siblings +* `parent` ([`Node`][node]) + — parent of the two siblings +* `state` ([`State`][api-state]) + — info passed around about the current state + +###### Returns + +How many blank lines to use between the siblings (`boolean`, `number`, +optional). + +Where `true` is as passing `1` and `false` means the nodes cannot be +joined by a blank line, such as two adjacent block quotes or indented code +after a list, in which case a comment will be injected to break them up: + +```markdown +> Quote 1 + + + +> Quote 2 +``` + +> 👉 **Note**: abusing this feature will break markdown. +> One such example is when returning `0` for two paragraphs, which will result +> in the text running together, and in the future to be seen as one paragraph. + +### `Map` + +Map function to pad a single line (TypeScript type). + +###### Parameters + +* `value` (`string`) + — a single line of serialized markdown +* `line` (`number`) + — line number relative to the fragment +* `blank` (`boolean`) + — whether the line is considered blank in markdown + +###### Returns + +Padded line (`string`). + +### `Options` + +Configuration (TypeScript type). + +##### Fields + +The following fields influence how markdown is serialized. + +###### `options.bullet` + +Marker to use for bullets of items in unordered lists (`'*'`, `'+'`, or `'-'`, +default: `'*'`). + +There are three cases where the primary bullet cannot be used: + +* when three or more list items are on their own, the last one is empty, and + `bullet` is also a valid `rule`: `* - +`; this would turn into a thematic + break if serialized with three primary bullets; `bulletOther` is used for + the last item +* when a thematic break is the first child of a list item and `bullet` is the + same character as `rule`: `- ***`; this would turn into a single thematic + break if serialized with primary bullets; `bulletOther` is used for the + item +* when two unordered lists appear next to each other: `* a\n- b`; + `bulletOther` is used for such lists + +###### `options.bulletOther` + +Marker to use in certain cases where the primary bullet doesn’t work (`'*'`, +`'+'`, or `'-'`, default: `'-'` when `bullet` is `'*'`, `'*'` otherwise). + +Cannot be equal to `bullet`. + +###### `options.bulletOrdered` + +Marker to use for bullets of items in ordered lists (`'.'` or `')'`, default: +`'.'`). + +There is one case where the primary bullet for ordered items cannot be used: + +* when two ordered lists appear next to each other: `1. a\n2) b`; to solve + that, `'.'` will be used when `bulletOrdered` is `')'`, and `'.'` otherwise + +###### `options.closeAtx` + +Whether to add the same number of number signs (`#`) at the end of an ATX +heading as the opening sequence (`boolean`, default: `false`). + +###### `options.emphasis` + +Marker to use for emphasis (`'*'` or `'_'`, default: `'*'`). + +###### `options.fence` + +Marker to use for fenced code (``'`'`` or `'~'`, default: ``'`'``). + +###### `options.fences` + +Whether to use fenced code always (`boolean`, default: `true`). +The default is to use fenced code if there is a language defined, if the code is +empty, or if it starts or ends in blank lines. + +###### `options.incrementListMarker` + +Whether to increment the counter of ordered lists items (`boolean`, default: +`true`). + +###### `options.listItemIndent` + +How to indent the content of list items (`'mixed'`, `'one'`, or `'tab'`, +default: `'one'`). +Either with the size of the bullet plus one space (when `'one'`), a tab stop +(`'tab'`), or depending on the item and its parent list (`'mixed'`, uses `'one'` +if the item and list are tight and `'tab'` otherwise). + +###### `options.quote` + +Marker to use for titles (`'"'` or `"'"`, default: `'"'`). + +###### `options.resourceLink` + +Whether to always use resource links (`boolean`, default: `false`). +The default is to use autolinks (``) when possible +and resource links (`[text](url)`) otherwise. + +###### `options.rule` + +Marker to use for thematic breaks (`'*'`, `'-'`, or `'_'`, default: `'*'`). + +###### `options.ruleRepetition` + +Number of markers to use for thematic breaks (`number`, default: `3`, min: `3`). + +###### `options.ruleSpaces` + +Whether to add spaces between markers in thematic breaks (`boolean`, default: +`false`). + +###### `options.setext` + +Whether to use setext headings when possible (`boolean`, default: `false`). +The default is to always use ATX headings (`# heading`) instead of setext +headings (`heading\n=======`). +Setext headings cannot be used for empty headings or headings with a rank of +three or more. + +###### `options.strong` + +Marker to use for strong (`'*'` or `'_'`, default: `'*'`). + +###### `options.tightDefinitions` + +Whether to join definitions without a blank line (`boolean`, default: `false`). + +The default is to add blank lines between any flow (“block”) construct. +Turning this option on is a shortcut for a [`Join`][api-join] function like so: + +```js +function joinTightDefinitions(left, right) { + if (left.type === 'definition' && right.type === 'definition') { + return 0 + } +} +``` + +###### `options.handlers` + +Handle particular nodes ([`Handlers`][api-handlers], optional). + +###### `options.join` + +How to join blocks ([`Array`][api-join], optional). + +###### `options.unsafe` + +Schemas that define when characters cannot occur +([`Array`][api-unsafe], optional). + +###### `options.extensions` + +List of extensions (`Array`, default: `[]`). +Each extension is an object with the same interface as `Options` itself. + +### `SafeConfig` + +Configuration passed to `state.safe` (TypeScript type). + +###### Fields + +* `before` (`string`) + — characters before this (guaranteed to be one, can be more) +* `after` (`string`) + — characters after this (guaranteed to be one, can be more) +* `encode` (`Array`, optional) + — extra characters that *must* be encoded (as character references) instead + of escaped (character escapes). + Only ASCII punctuation will use character escapes, so you never need to + pass non-ASCII-punctuation here + +### `State` + +Info passed around about the current state (TypeScript type). + +###### Fields + +* `stack` ([`Array`][api-construct-name]) + — stack of constructs we’re in +* `indexStack` (`Array`) + — positions of child nodes in their parents +* `associationId` (`(node: Association) => string`) + — get an identifier from an association to match it to others (see + [`Association`][association]) +* `enter` (`(construct: ConstructName) => () => undefined`) + — enter a construct (returns a corresponding exit function) + (see [`ConstructName`][api-construct-name]) +* `indentLines` (`(value: string, map: Map) => string`) + — pad serialized markdown (see [`Map`][api-map]) +* `compilePattern` (`(pattern: Unsafe) => RegExp`) + — compile an unsafe pattern to a regex (see [`Unsafe`][api-unsafe]) +* `containerFlow` (`(parent: Node, info: Info) => string`) + — serialize flow children (see [`Info`][api-info]) +* `containerPhrasing` (`(parent: Node, info: Info) => string`) + — serialize phrasing children (see [`Info`][api-info]) +* `createTracker` (`(info: Info) => Tracker`) + — track positional info in the output (see [`Info`][api-info], + [`Tracker`][api-tracker]) +* `safe` (`(value: string, config: SafeConfig) => string`) + — make a string safe for embedding (see [`SafeConfig`][api-safe-config]) +* `options` ([`Options`][api-options]) + — applied user configuration +* `unsafe` ([`Array`][api-unsafe]) + — applied unsafe patterns +* `join` ([`Array`][api-join]) + — applied join handlers +* `handle` ([`Handle`][api-handle]) + — call the configured handler for the given node +* `handlers` ([`Handlers`][api-handlers]) + — applied handlers +* `bulletCurrent` (`string` or `undefined`) + — list marker currently in use +* `bulletLastUsed` (`string` or `undefined`) + — list marker previously in use + +### `Tracker` + +Track positional info in the output (TypeScript type). + +This info isn’t used yet but such functionality will allow line wrapping, +source maps, etc. + +###### Fields + +* `current` (`() => Info`) + — get current tracked info +* `shift` (`(value: number) => undefined`) + — define a relative increased line shift (the typical indent for lines) +* `move` (`(value: string) => string`) + — move past some generated markdown + +### `Unsafe` + +Schema that defines when a character cannot occur (TypeScript type). + +###### Fields + +* `character` (`string`) + — single unsafe character +* `inConstruct` ([`Array`][api-construct-name], + `ConstructName`, optional) + — constructs where this is bad +* `notInConstruct` ([`Array`][api-construct-name], + `ConstructName`, optional) + — constructs where this is fine again +* `before` (`string`, optional) + — `character` is bad when this is before it (cannot be used together with + `atBreak`) +* `after` (`string`, optional) + — `character` is bad when this is after it +* `atBreak` (`boolean`, optional) + — `character` is bad at a break (cannot be used together with `before`) + +## List of extensions + +* [`syntax-tree/mdast-util-directive`](https://github.com/syntax-tree/mdast-util-directive) + — directives +* [`syntax-tree/mdast-util-frontmatter`](https://github.com/syntax-tree/mdast-util-frontmatter) + — frontmatter (YAML, TOML, more) +* [`syntax-tree/mdast-util-gfm`](https://github.com/syntax-tree/mdast-util-gfm) + — GFM +* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal) + — GFM autolink literals +* [`syntax-tree/mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote) + — GFM footnotes +* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough) + — GFM strikethrough +* [`syntax-tree/mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table) + — GFM tables +* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item) + — GFM task list items +* [`syntax-tree/mdast-util-math`](https://github.com/syntax-tree/mdast-util-math) + — math +* [`syntax-tree/mdast-util-mdx`](https://github.com/syntax-tree/mdast-util-mdx) + — MDX +* [`syntax-tree/mdast-util-mdx-expression`](https://github.com/syntax-tree/mdast-util-mdx-expression) + — MDX expressions +* [`syntax-tree/mdast-util-mdx-jsx`](https://github.com/syntax-tree/mdast-util-mdx-jsx) + — MDX JSX +* [`syntax-tree/mdast-util-mdxjs-esm`](https://github.com/syntax-tree/mdast-util-mdxjs-esm) + — MDX ESM + +## Syntax + +Markdown is serialized according to CommonMark but care is taken to format in +such a way that the resulting markdown should work with most markdown parsers. +Extensions can add support for custom syntax. + +## Syntax tree + +The syntax tree is [mdast][]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types +[`ConstructName`][api-construct-name], +[`ConstructNameMap`][api-construct-name-map], +[`Handle`][api-handle], +[`Handlers`][api-handlers], +[`Info`][api-info], +[`Join`][api-join], +[`Map`][api-map], +[`Options`][api-options], +[`SafeConfig`][api-safe-config], +[`State`][api-State], and +[`Unsafe`][api-Unsafe]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-to-markdown@^2`, +compatible with Node.js 16. + +## Security + +`mdast-util-to-markdown` will do its best to serialize markdown to match the +syntax tree, but there are several cases where that is impossible. +It’ll do its best, but complete roundtripping is impossible given that any value +could be injected into the tree. + +As markdown is sometimes used for HTML, and improper use of HTML can open you up +to a [cross-site scripting (XSS)][xss] attack, use of `mdast-util-to-markdown` +and parsing it again later could potentially be unsafe. +When parsing markdown afterwards and then going to HTML, use something like +[`hast-util-sanitize`][hast-util-sanitize] to make the tree safe. + +## Related + +* [`syntax-tree/mdast-util-from-markdown`](https://github.com/syntax-tree/mdast-util-from-markdown) + — parse markdown to mdast +* [`micromark/micromark`](https://github.com/micromark/micromark) + — parse markdown +* [`remarkjs/remark`](https://github.com/remarkjs/remark) + — process markdown + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-to-markdown/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-markdown + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-markdown.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-to-markdown + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-to-markdown + +[size]: https://bundlejs.com/?q=mdast-util-to-markdown + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[point]: https://github.com/syntax-tree/unist#point + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[association]: https://github.com/syntax-tree/mdast#association + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx + +[mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter + +[mdast-util-math]: https://github.com/syntax-tree/mdast-util-math + +[mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive + +[remark]: https://github.com/remarkjs/remark + +[remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify + +[api-construct-name]: #constructname + +[api-construct-name-map]: #constructnamemap + +[api-default-handlers]: #defaulthandlers + +[api-handle]: #handle + +[api-handlers]: #handlers + +[api-info]: #info + +[api-join]: #join + +[api-map]: #map + +[api-options]: #options + +[api-safe-config]: #safeconfig + +[api-state]: #state + +[api-to-markdown]: #tomarkdowntree-options + +[api-tracker]: #tracker + +[api-unsafe]: #unsafe diff --git a/node_modules/mdast-util-to-string/index.d.ts b/node_modules/mdast-util-to-string/index.d.ts new file mode 100644 index 00000000..d4a39692 --- /dev/null +++ b/node_modules/mdast-util-to-string/index.d.ts @@ -0,0 +1,2 @@ +export {toString} from './lib/index.js' +export type Options = import('./lib/index.js').Options diff --git a/node_modules/mdast-util-to-string/index.js b/node_modules/mdast-util-to-string/index.js new file mode 100644 index 00000000..8674f309 --- /dev/null +++ b/node_modules/mdast-util-to-string/index.js @@ -0,0 +1,5 @@ +/** + * @typedef {import('./lib/index.js').Options} Options + */ + +export {toString} from './lib/index.js' diff --git a/node_modules/mdast-util-to-string/license b/node_modules/mdast-util-to-string/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/mdast-util-to-string/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mdast-util-to-string/package.json b/node_modules/mdast-util-to-string/package.json new file mode 100644 index 00000000..a2a88d48 --- /dev/null +++ b/node_modules/mdast-util-to-string/package.json @@ -0,0 +1,78 @@ +{ + "name": "mdast-util-to-string", + "version": "4.0.0", + "description": "mdast utility to get the plain text content of a node", + "license": "MIT", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "node", + "string", + "serialize" + ], + "repository": "syntax-tree/mdast-util-to-string", + "bugs": "https://github.com/syntax-tree/mdast-util-to-string/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/mdast-util-to-string/readme.md b/node_modules/mdast-util-to-string/readme.md new file mode 100644 index 00000000..4d901234 --- /dev/null +++ b/node_modules/mdast-util-to-string/readme.md @@ -0,0 +1,218 @@ +# mdast-util-to-string + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[mdast][] utility to get the text content of a node. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`toString(value[, options])`](#tostringvalue-options) + * [`Options`](#options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a tiny utility that gets the textual content of a node. + +## When should I use this? + +This utility is useful when you have a node, say a heading, and want to get the +text inside it. + +This package does not serialize markdown, that’s what +[`mdast-util-to-markdown`][mdast-util-to-markdown] does. + +Similar packages, [`hast-util-to-string`][hast-util-to-string] and +[`hast-util-to-text`][hast-util-to-text], do the same but on [hast][]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install mdast-util-to-string +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {toString} from 'https://esm.sh/mdast-util-to-string@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {fromMarkdown} from 'mdast-util-from-markdown' +import {toString} from 'mdast-util-to-string' + +const tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.') + +console.log(toString(tree)) // => 'Some emphasis, importance, and code.' +``` + +## API + +This package exports the identifier [`toString`][api-to-string]. +There is no default export. + +### `toString(value[, options])` + +Get the text content of a node or list of nodes. + +Prefers the node’s plain-text fields, otherwise serializes its children, +and if the given value is an array, serialize the nodes in it. + +###### Parameters + +* `value` (`unknown`) + — thing to serialize, typically [`Node`][node] +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Serialized `value` (`string`). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `includeImageAlt` (`boolean`, default: `true`) + — whether to use `alt` for `image`s +* `includeHtml` (`boolean`, default: `true`) + — whether to use `value` of HTML + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `mdast-util-to-string@^4`, +compatible with Node.js 16. + +## Security + +Use of `mdast-util-to-string` does not involve **[hast][]**, user content, or +change the tree, so there are no openings for [cross-site scripting (XSS)][xss] +attacks. + +## Related + +* [`hast-util-to-string`](https://github.com/wooorm/rehype-minify/tree/main/packages/hast-util-to-string) + — get text content in hast +* [`hast-util-to-text`](https://github.com/syntax-tree/hast-util-to-text) + — get text content in hast according to the `innerText` algorithm + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/syntax-tree/mdast-util-to-string/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/mdast-util-to-string/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-string.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-string + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-string.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-to-string + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-to-string + +[size]: https://bundlejs.com/?q=mdast-util-to-string + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[hast]: https://github.com/syntax-tree/hast + +[hast-util-to-string]: https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-to-string + +[hast-util-to-text]: https://github.com/syntax-tree/hast-util-to-text + +[node]: https://github.com/syntax-tree/mdast#nodes + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[api-to-string]: #tostringvalue-options + +[api-options]: #options diff --git a/node_modules/micromark-core-commonmark/dev/index.d.ts b/node_modules/micromark-core-commonmark/dev/index.d.ts new file mode 100644 index 00000000..bd832f66 --- /dev/null +++ b/node_modules/micromark-core-commonmark/dev/index.d.ts @@ -0,0 +1,23 @@ +export { attention } from "./lib/attention.js"; +export { autolink } from "./lib/autolink.js"; +export { blankLine } from "./lib/blank-line.js"; +export { blockQuote } from "./lib/block-quote.js"; +export { characterEscape } from "./lib/character-escape.js"; +export { characterReference } from "./lib/character-reference.js"; +export { codeFenced } from "./lib/code-fenced.js"; +export { codeIndented } from "./lib/code-indented.js"; +export { codeText } from "./lib/code-text.js"; +export { content } from "./lib/content.js"; +export { definition } from "./lib/definition.js"; +export { hardBreakEscape } from "./lib/hard-break-escape.js"; +export { headingAtx } from "./lib/heading-atx.js"; +export { htmlFlow } from "./lib/html-flow.js"; +export { htmlText } from "./lib/html-text.js"; +export { labelEnd } from "./lib/label-end.js"; +export { labelStartImage } from "./lib/label-start-image.js"; +export { labelStartLink } from "./lib/label-start-link.js"; +export { lineEnding } from "./lib/line-ending.js"; +export { list } from "./lib/list.js"; +export { setextUnderline } from "./lib/setext-underline.js"; +export { thematicBreak } from "./lib/thematic-break.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-core-commonmark/dev/index.d.ts.map b/node_modules/micromark-core-commonmark/dev/index.d.ts.map new file mode 100644 index 00000000..ca7a93a9 --- /dev/null +++ b/node_modules/micromark-core-commonmark/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/micromark-core-commonmark/dev/index.js b/node_modules/micromark-core-commonmark/dev/index.js new file mode 100644 index 00000000..f9143e09 --- /dev/null +++ b/node_modules/micromark-core-commonmark/dev/index.js @@ -0,0 +1,22 @@ +export {attention} from './lib/attention.js' +export {autolink} from './lib/autolink.js' +export {blankLine} from './lib/blank-line.js' +export {blockQuote} from './lib/block-quote.js' +export {characterEscape} from './lib/character-escape.js' +export {characterReference} from './lib/character-reference.js' +export {codeFenced} from './lib/code-fenced.js' +export {codeIndented} from './lib/code-indented.js' +export {codeText} from './lib/code-text.js' +export {content} from './lib/content.js' +export {definition} from './lib/definition.js' +export {hardBreakEscape} from './lib/hard-break-escape.js' +export {headingAtx} from './lib/heading-atx.js' +export {htmlFlow} from './lib/html-flow.js' +export {htmlText} from './lib/html-text.js' +export {labelEnd} from './lib/label-end.js' +export {labelStartImage} from './lib/label-start-image.js' +export {labelStartLink} from './lib/label-start-link.js' +export {lineEnding} from './lib/line-ending.js' +export {list} from './lib/list.js' +export {setextUnderline} from './lib/setext-underline.js' +export {thematicBreak} from './lib/thematic-break.js' diff --git a/node_modules/micromark-core-commonmark/index.d.ts b/node_modules/micromark-core-commonmark/index.d.ts new file mode 100644 index 00000000..bd832f66 --- /dev/null +++ b/node_modules/micromark-core-commonmark/index.d.ts @@ -0,0 +1,23 @@ +export { attention } from "./lib/attention.js"; +export { autolink } from "./lib/autolink.js"; +export { blankLine } from "./lib/blank-line.js"; +export { blockQuote } from "./lib/block-quote.js"; +export { characterEscape } from "./lib/character-escape.js"; +export { characterReference } from "./lib/character-reference.js"; +export { codeFenced } from "./lib/code-fenced.js"; +export { codeIndented } from "./lib/code-indented.js"; +export { codeText } from "./lib/code-text.js"; +export { content } from "./lib/content.js"; +export { definition } from "./lib/definition.js"; +export { hardBreakEscape } from "./lib/hard-break-escape.js"; +export { headingAtx } from "./lib/heading-atx.js"; +export { htmlFlow } from "./lib/html-flow.js"; +export { htmlText } from "./lib/html-text.js"; +export { labelEnd } from "./lib/label-end.js"; +export { labelStartImage } from "./lib/label-start-image.js"; +export { labelStartLink } from "./lib/label-start-link.js"; +export { lineEnding } from "./lib/line-ending.js"; +export { list } from "./lib/list.js"; +export { setextUnderline } from "./lib/setext-underline.js"; +export { thematicBreak } from "./lib/thematic-break.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-core-commonmark/index.d.ts.map b/node_modules/micromark-core-commonmark/index.d.ts.map new file mode 100644 index 00000000..ca7a93a9 --- /dev/null +++ b/node_modules/micromark-core-commonmark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/micromark-core-commonmark/index.js b/node_modules/micromark-core-commonmark/index.js new file mode 100644 index 00000000..969b1cdf --- /dev/null +++ b/node_modules/micromark-core-commonmark/index.js @@ -0,0 +1,22 @@ +export { attention } from './lib/attention.js'; +export { autolink } from './lib/autolink.js'; +export { blankLine } from './lib/blank-line.js'; +export { blockQuote } from './lib/block-quote.js'; +export { characterEscape } from './lib/character-escape.js'; +export { characterReference } from './lib/character-reference.js'; +export { codeFenced } from './lib/code-fenced.js'; +export { codeIndented } from './lib/code-indented.js'; +export { codeText } from './lib/code-text.js'; +export { content } from './lib/content.js'; +export { definition } from './lib/definition.js'; +export { hardBreakEscape } from './lib/hard-break-escape.js'; +export { headingAtx } from './lib/heading-atx.js'; +export { htmlFlow } from './lib/html-flow.js'; +export { htmlText } from './lib/html-text.js'; +export { labelEnd } from './lib/label-end.js'; +export { labelStartImage } from './lib/label-start-image.js'; +export { labelStartLink } from './lib/label-start-link.js'; +export { lineEnding } from './lib/line-ending.js'; +export { list } from './lib/list.js'; +export { setextUnderline } from './lib/setext-underline.js'; +export { thematicBreak } from './lib/thematic-break.js'; \ No newline at end of file diff --git a/node_modules/micromark-core-commonmark/license b/node_modules/micromark-core-commonmark/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-core-commonmark/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-core-commonmark/package.json b/node_modules/micromark-core-commonmark/package.json new file mode 100644 index 00000000..3798a68e --- /dev/null +++ b/node_modules/micromark-core-commonmark/package.json @@ -0,0 +1,74 @@ +{ + "name": "micromark-core-commonmark", + "version": "2.0.3", + "description": "The CommonMark markdown constructs", + "license": "MIT", + "keywords": [ + "micromark", + "core", + "commonmark" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-core-commonmark", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-core-commonmark/readme.md b/node_modules/micromark-core-commonmark/readme.md new file mode 100644 index 00000000..5cc8b7ca --- /dev/null +++ b/node_modules/micromark-core-commonmark/readme.md @@ -0,0 +1,171 @@ +# micromark-core-commonmark + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] constructs that make up the core of CommonMark. +Some of these can be [turned off][disable], but they are often essential to +markdown and weird things might happen. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes the default constructs. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-core-commonmark +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as core from 'https://esm.sh/micromark-core-commonmark@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {autolink} from 'micromark-core-commonmark' + +console.log(autolink) // Do things with `autolink`. +``` + +## API + +This module exports the following identifiers: `attention`, `autolink`, +`blankLine`, `blockQuote`, `characterEscape`, `characterReference`, +`codeFenced`, `codeIndented`, `codeText`, `content`, `definition`, +`hardBreakEscape`, `headingAtx`, `htmlFlow`, `htmlText`, `labelEnd`, +`labelStartImage`, `labelStartLink`, `lineEnding`, `list`, `setextUnderline`, +`thematicBreak`. +There is no default export. + +Each identifier refers to a [construct][]. + +See the code for more on the exported constructs. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-core-commonmark@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-core-commonmark + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-core-commonmark + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[construct]: https://github.com/micromark/micromark#constructs + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[disable]: https://github.com/micromark/micromark#case-turn-off-constructs + +[downloads]: https://www.npmjs.com/package/micromark-core-commonmark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-core-commonmark.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts b/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts new file mode 100644 index 00000000..36f53b55 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts @@ -0,0 +1,24 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Augment token with a field to improve performance. + */ + interface Token { + _gfmAutolinkLiteralWalkedInto?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + literalAutolink: 'literalAutolink' + literalAutolinkEmail: 'literalAutolinkEmail' + literalAutolinkHttp: 'literalAutolinkHttp' + literalAutolinkWww: 'literalAutolinkWww' + } +} diff --git a/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js b/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js new file mode 100644 index 00000000..928d4456 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js @@ -0,0 +1,2 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' diff --git a/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts b/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts new file mode 100644 index 00000000..36f53b55 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts @@ -0,0 +1,24 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Augment token with a field to improve performance. + */ + interface Token { + _gfmAutolinkLiteralWalkedInto?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + literalAutolink: 'literalAutolink' + literalAutolinkEmail: 'literalAutolinkEmail' + literalAutolinkHttp: 'literalAutolinkHttp' + literalAutolinkWww: 'literalAutolinkWww' + } +} diff --git a/node_modules/micromark-extension-gfm-autolink-literal/index.js b/node_modules/micromark-extension-gfm-autolink-literal/index.js new file mode 100644 index 00000000..5194682a --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/index.js @@ -0,0 +1,2 @@ +export { gfmAutolinkLiteral } from './lib/syntax.js'; +export { gfmAutolinkLiteralHtml } from './lib/html.js'; \ No newline at end of file diff --git a/node_modules/micromark-extension-gfm-autolink-literal/license b/node_modules/micromark-extension-gfm-autolink-literal/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-autolink-literal/package.json b/node_modules/micromark-extension-gfm-autolink-literal/package.json new file mode 100644 index 00000000..2b1b6bd4 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/package.json @@ -0,0 +1,116 @@ +{ + "name": "micromark-extension-gfm-autolink-literal", + "version": "2.1.0", + "description": "micromark extension to support GFM autolink literals", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "literal", + "url", + "autolink", + "auto", + "link", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-autolink-literal", + "bugs": "https://github.com/micromark/micromark-extension-gfm-autolink-literal/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "rehype": "^13.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "complexity": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": 0 + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/node_modules/micromark-extension-gfm-autolink-literal/readme.md b/node_modules/micromark-extension-gfm-autolink-literal/readme.md new file mode 100644 index 00000000..61651de0 --- /dev/null +++ b/node_modules/micromark-extension-gfm-autolink-literal/readme.md @@ -0,0 +1,422 @@ +# micromark-extension-gfm-autolink-literal + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [literal autolinks][spec]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmAutolinkLiteral()`](#gfmautolinkliteral) + * [`gfmAutolinkLiteralHtml()`](#gfmautolinkliteralhtml) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for the extra autolink syntax +enabled by GFM to [`micromark`][micromark]. + +GitHub employs different algorithms to autolink: one at parse time and one at +transform time (similar to how @mentions are done at transform time). +This difference can be observed because character references and escapes are +handled differently. +But also because issues/PRs/comments omit (perhaps by accident?) the second +algorithm for `www.`, `http://`, and `https://` links (but not for email links). + +As this is a syntax extension, it focuses on the first algorithm. +The second algorithm is performed by +[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal]. +The `html` part of this micromark extension does not operate on an AST and hence +can’t perform the second algorithm. + +The implementation of autolink literal on github.com is currently buggy. +The bugs have been reported on [`cmark-gfm`][cmark-gfm]. +This micromark extension matches github.com except for its bugs. + +## When to use this + +This project is useful when you want to support autolink literals in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-autolink-literal +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmAutolinkLiteral, gfmAutolinkLiteralHtml} from 'https://esm.sh/micromark-extension-gfm-autolink-literal@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmAutolinkLiteral, + gfmAutolinkLiteralHtml +} from 'micromark-extension-gfm-autolink-literal' + +const output = micromark('Just a URL: www.example.com.', { + extensions: [gfmAutolinkLiteral()], + htmlExtensions: [gfmAutolinkLiteralHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

Just a URL: www.example.com.

+``` + +## API + +This package exports the identifiers +[`gfmAutolinkLiteral`][api-gfm-autolink-literal] and +[`gfmAutolinkLiteralHtml`][api-gfm-autolink-literal-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmAutolinkLiteral()` + +Create an extension for `micromark` to support GitHub autolink literal +syntax. + +###### Parameters + +Extension for `micromark` that can be passed in `extensions` to enable GFM +autolink literal syntax ([`Extension`][micromark-extension]). + +### `gfmAutolinkLiteralHtml()` + +Create an HTML extension for `micromark` to support GitHub autolink literal +when serializing to HTML. + +###### Parameters + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GitHub autolink literal when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Bugs + +GitHub’s own algorithm to parse autolink literals contains three bugs. +A smaller bug is left unfixed in this project for consistency. +Two main bugs are not present in this project. +The issues relating to autolink literals are: + +* [GFM autolink extension (`www.`, `https?://` parts): links don’t work when + after bracket](https://github.com/github/cmark-gfm/issues/278)\ + fixed here ✅ +* [GFM autolink extension (`www.` part): uppercase does not match on + issues/PRs/comments](https://github.com/github/cmark-gfm/issues/280)\ + fixed here ✅ +* [GFM autolink extension (`www.` part): the word `www` + matches](https://github.com/github/cmark-gfm/issues/279)\ + present here for consistency + +## Authoring + +It is recommended to use labels, either with a resource or a definition, +instead of autolink literals, as those allow relative URLs and descriptive +text to explain the URL in prose. + +## HTML + +GFM autolink literals relate to the `` element in HTML. +See [*§ 4.5.1 The `a` element*][html-a] in the HTML spec for more info. +When an email autolink is used, the string `mailto:` is prepended when +generating the `href` attribute of the hyperlink. +When a www autolink is used, the string `http://` is prepended. + +## CSS + +As hyperlinks are the fundamental thing that makes the web, you will most +definitely have CSS for `a` elements already. +The same CSS can be used for autolink literals, too. + +GitHub itself does not apply interesting CSS to autolink literals. +For any link, it currently (June 2022) [uses][css]: + +```css +a { + background-color: transparent; + color: #58a6ff; + text-decoration: none; +} + +a:active, +a:hover { + outline-width: 0; +} + +a:hover { + text-decoration: underline; +} + +a:not([href]) { + color: inherit; + text-decoration: none; +} +``` + +## Syntax + +Autolink literals form with, roughly, the following BNF: + +```bnf +gfm_autolink_literal ::= gfm_protocol_autolink | gfm_www_autolink | gfm_email_autolink + +; Restriction: the code before must be `www_autolink_before`. +; Restriction: the code after `.` must not be eof. +www_autolink ::= 3('w' | 'W') '.' [domain [path]] +www_autolink_before ::= eof | eol | space_or_tab | '(' | '*' | '_' | '[' | ']' | '~' + +; Restriction: the code before must be `http_autolink_before`. +; Restriction: the code after the protocol must be `http_autolink_protocol_after`. +http_autolink ::= ('h' | 'H') 2('t' | 'T') ('p' | 'P') ['s' | 'S'] ':' 2'/' domain [path] +http_autolink_before ::= byte - ascii_alpha +http_autolink_protocol_after ::= byte - eof - eol - ascii_control - unicode_whitespace - ode_punctuation + +; Restriction: the code before must be `email_autolink_before`. +; Restriction: `ascii_digit` may not occur in the last label part of the label. +email_autolink ::= 1*('+' | '-' | '.' | '_' | ascii_alphanumeric) '@' 1*(1*label_segment l_dot_cont) 1*label_segment +email_autolink_before ::= byte - ascii_alpha - '/' + +; Restriction: `_` may not occur in the last two domain parts. +domain ::= 1*(url_ampt_cont | domain_punct_cont | '-' | byte - eof - ascii_control - ode_whitespace - unicode_punctuation) +; Restriction: must not be followed by `punct`. +domain_punct_cont ::= '.' | '_' +; Restriction: must not be followed by `char-ref`. +url_ampt_cont ::= '&' + +; Restriction: a counter `balance = 0` is increased for every `(`, and decreased for every `)`. +; Restriction: `)` must not be `paren_at_end`. +path ::= 1*(url_ampt_cont | path_punctuation_cont | '(' | ')' | byte - eof - eol - space_or_tab) +; Restriction: must not be followed by `punct`. +path_punctuation_cont ::= trailing_punctuation - '<' +; Restriction: must be followed by `punct` and `balance` must be less than `0`. +paren_at_end ::= ')' + +label_segment ::= label_dash_underscore_cont | ascii_alpha | ascii_digit +; Restriction: if followed by `punct`, the whole email autolink is invalid. +label_dash_underscore_cont ::= '-' | '_' +; Restriction: must not be followed by `punct`. +label_dot_cont ::= '.' + +punct ::= *trailing_punctuation ( byte - eof - eol - space_or_tab - '<' ) +char_ref ::= *ascii_alpha ';' path_end +trailing_punctuation ::= '!' | '"' | '\'' | ')' | '*' | ',' | '.' | ':' | ';' | '<' | '?' | '_' | '~' +``` + +The grammar for GFM autolink literal is very relaxed: basically anything +except for whitespace is allowed after a prefix. +To use whitespace characters and otherwise impossible characters, in URLs, +you can use percent encoding: + +```markdown +https://example.com/alpha%20bravo +``` + +Yields: + +```html +

https://example.com/alpha%20bravo

+``` + +There are several cases where incorrect encoding of URLs would, in other +languages, result in a parse error. +In markdown, there are no errors, and URLs are normalized. +In addition, many characters are percent encoded +([`sanitizeUri`][micromark-util-sanitize-uri]). +For example: + +```markdown +www.a👍b% +``` + +Yields: + +```html +

www.a👍b%

+``` + +There is a big difference between how www and protocol literals work +compared to how email literals work. +The first two are done when parsing, and work like anything else in +markdown. +But email literals are handled afterwards: when everything is parsed, we +look back at the events to figure out if there were email addresses. +This particularly affects how they interleave with character escapes and +character references. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-autolink-literal@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Unlike other links in CommonMark, which allow arbitrary protocols, this +construct always produces safe links. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-autolink-literal/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-autolink-literal/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-autolink-literal.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-autolink-literal + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-autolink-literal.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-autolink-literal + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-autolink-literal + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-autolink-literal + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[micromark-util-sanitize-uri]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-sanitize-uri + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-gfm-autolink-literal]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[spec]: https://github.github.com/gfm/#autolinks-extension- + +[html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element + +[css]: https://github.com/sindresorhus/github-markdown-css + +[cmark-gfm]: https://github.com/github/cmark-gfm + +[api-gfm-autolink-literal]: #gfmautolinkliteral + +[api-gfm-autolink-literal-html]: #gfmautolinkliteralhtml diff --git a/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts b/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts new file mode 100644 index 00000000..1be28687 --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts @@ -0,0 +1,164 @@ +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' +export {gfmFootnote} from './lib/syntax.js' + +/** + * Generate a back label dynamically. + * + * For the following markdown: + * + * ```markdown + * Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + * + * [^remark]: things about remark + * [^micromark]: things about micromark + * ``` + * + * This function will be called with: + * + * * `0` and `0` for the backreference from `things about micromark` to + * `alpha`, as it is the first used definition, and the first call to it + * * `0` and `1` for the backreference from `things about micromark` to + * `bravo`, as it is the first used definition, and the second call to it + * * `1` and `0` for the backreference from `things about remark` to + * `charlie`, as it is the second used definition + * + * @param referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns + * Back label to use when linking back from definitions to their reference. + */ +export type BackLabelTemplate = ( + referenceIndex: number, + rereferenceIndex: number +) => string + +/** + * Configuration. + */ +export interface HtmlOptions { + /** + * Prefix to use before the `id` attribute on footnotes to prevent them from + * *clobbering* (default: `'user-content-'`). + * + * Pass `''` for trusted markdown and when you are careful with + * polyfilling. + * You could pass a different prefix. + * + * DOM clobbering is this: + * + * ```html + *

+ * + * ``` + * + * The above example shows that elements are made available by browsers, by + * their ID, on the `window` object. + * This is a security risk because you might be expecting some other variable + * at that place. + * It can also break polyfills. + * Using a prefix solves these problems. + */ + clobberPrefix?: string | null | undefined + /** + * Textual label to use for the footnotes section (default: `'Footnotes'`). + * + * Change it when the markdown is not in English. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + label?: string | null | undefined + /** + * Attributes to use on the footnote label (default: `'class="sr-only"'`). + * + * Change it to show the label and add other attributes. + * + * This label is typically hidden visually (assuming an `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass an empty string. + * You can also add different attributes. + * + * > 👉 **Note**: `id="footnote-label"` is always added, because footnote + * > calls use it with `aria-describedby` to provide an accessible label. + */ + labelAttributes?: string | null | undefined + /** + * HTML tag name to use for the footnote label element (default: `'h2'`). + * + * Change it to match your document structure. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + labelTagName?: string | null | undefined + /** + * Textual label to describe the backreference back to references (default: + * `defaultBackLabel`). + * + * The default value is: + * + * ```js + * function defaultBackLabel(referenceIndex, rereferenceIndex) { + * return ( + * 'Back to reference ' + + * (referenceIndex + 1) + + * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') + * ) + * } + * ``` + * + * Change it when the markdown is not in English. + * + * This label is used in the `aria-label` attribute on each backreference + * (the `↩` links). + * It affects users of assistive technology. + */ + backLabel?: BackLabelTemplate | string | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + gfmFootnoteDefinitions?: Record + gfmFootnoteDefinitionStack?: Array + gfmFootnoteCallCounts?: Record + gfmFootnoteCallOrder?: Array + } + + /** + * Parse context. + */ + interface ParseContext { + gfmFootnotes?: Array + } + + /** + * Token types. + */ + interface TokenTypeMap { + gfmFootnoteCall: 'gfmFootnoteCall' + gfmFootnoteCallLabelMarker: 'gfmFootnoteCallLabelMarker' + gfmFootnoteCallMarker: 'gfmFootnoteCallMarker' + gfmFootnoteCallString: 'gfmFootnoteCallString' + gfmFootnoteDefinition: 'gfmFootnoteDefinition' + gfmFootnoteDefinitionIndent: 'gfmFootnoteDefinitionIndent' + gfmFootnoteDefinitionLabel: 'gfmFootnoteDefinitionLabel' + gfmFootnoteDefinitionLabelMarker: 'gfmFootnoteDefinitionLabelMarker' + gfmFootnoteDefinitionLabelString: 'gfmFootnoteDefinitionLabelString' + gfmFootnoteDefinitionMarker: 'gfmFootnoteDefinitionMarker' + gfmFootnoteDefinitionWhitespace: 'gfmFootnoteDefinitionWhitespace' + } +} diff --git a/node_modules/micromark-extension-gfm-footnote/dev/index.js b/node_modules/micromark-extension-gfm-footnote/dev/index.js new file mode 100644 index 00000000..a399a81f --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/dev/index.js @@ -0,0 +1,3 @@ +// Note: types are exported from `dev/index.d.ts`. +export {gfmFootnote} from './lib/syntax.js' +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' diff --git a/node_modules/micromark-extension-gfm-footnote/index.d.ts b/node_modules/micromark-extension-gfm-footnote/index.d.ts new file mode 100644 index 00000000..1be28687 --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/index.d.ts @@ -0,0 +1,164 @@ +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' +export {gfmFootnote} from './lib/syntax.js' + +/** + * Generate a back label dynamically. + * + * For the following markdown: + * + * ```markdown + * Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + * + * [^remark]: things about remark + * [^micromark]: things about micromark + * ``` + * + * This function will be called with: + * + * * `0` and `0` for the backreference from `things about micromark` to + * `alpha`, as it is the first used definition, and the first call to it + * * `0` and `1` for the backreference from `things about micromark` to + * `bravo`, as it is the first used definition, and the second call to it + * * `1` and `0` for the backreference from `things about remark` to + * `charlie`, as it is the second used definition + * + * @param referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns + * Back label to use when linking back from definitions to their reference. + */ +export type BackLabelTemplate = ( + referenceIndex: number, + rereferenceIndex: number +) => string + +/** + * Configuration. + */ +export interface HtmlOptions { + /** + * Prefix to use before the `id` attribute on footnotes to prevent them from + * *clobbering* (default: `'user-content-'`). + * + * Pass `''` for trusted markdown and when you are careful with + * polyfilling. + * You could pass a different prefix. + * + * DOM clobbering is this: + * + * ```html + *

+ * + * ``` + * + * The above example shows that elements are made available by browsers, by + * their ID, on the `window` object. + * This is a security risk because you might be expecting some other variable + * at that place. + * It can also break polyfills. + * Using a prefix solves these problems. + */ + clobberPrefix?: string | null | undefined + /** + * Textual label to use for the footnotes section (default: `'Footnotes'`). + * + * Change it when the markdown is not in English. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + label?: string | null | undefined + /** + * Attributes to use on the footnote label (default: `'class="sr-only"'`). + * + * Change it to show the label and add other attributes. + * + * This label is typically hidden visually (assuming an `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass an empty string. + * You can also add different attributes. + * + * > 👉 **Note**: `id="footnote-label"` is always added, because footnote + * > calls use it with `aria-describedby` to provide an accessible label. + */ + labelAttributes?: string | null | undefined + /** + * HTML tag name to use for the footnote label element (default: `'h2'`). + * + * Change it to match your document structure. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + labelTagName?: string | null | undefined + /** + * Textual label to describe the backreference back to references (default: + * `defaultBackLabel`). + * + * The default value is: + * + * ```js + * function defaultBackLabel(referenceIndex, rereferenceIndex) { + * return ( + * 'Back to reference ' + + * (referenceIndex + 1) + + * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') + * ) + * } + * ``` + * + * Change it when the markdown is not in English. + * + * This label is used in the `aria-label` attribute on each backreference + * (the `↩` links). + * It affects users of assistive technology. + */ + backLabel?: BackLabelTemplate | string | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + gfmFootnoteDefinitions?: Record + gfmFootnoteDefinitionStack?: Array + gfmFootnoteCallCounts?: Record + gfmFootnoteCallOrder?: Array + } + + /** + * Parse context. + */ + interface ParseContext { + gfmFootnotes?: Array + } + + /** + * Token types. + */ + interface TokenTypeMap { + gfmFootnoteCall: 'gfmFootnoteCall' + gfmFootnoteCallLabelMarker: 'gfmFootnoteCallLabelMarker' + gfmFootnoteCallMarker: 'gfmFootnoteCallMarker' + gfmFootnoteCallString: 'gfmFootnoteCallString' + gfmFootnoteDefinition: 'gfmFootnoteDefinition' + gfmFootnoteDefinitionIndent: 'gfmFootnoteDefinitionIndent' + gfmFootnoteDefinitionLabel: 'gfmFootnoteDefinitionLabel' + gfmFootnoteDefinitionLabelMarker: 'gfmFootnoteDefinitionLabelMarker' + gfmFootnoteDefinitionLabelString: 'gfmFootnoteDefinitionLabelString' + gfmFootnoteDefinitionMarker: 'gfmFootnoteDefinitionMarker' + gfmFootnoteDefinitionWhitespace: 'gfmFootnoteDefinitionWhitespace' + } +} diff --git a/node_modules/micromark-extension-gfm-footnote/index.js b/node_modules/micromark-extension-gfm-footnote/index.js new file mode 100644 index 00000000..b210cb3d --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/index.js @@ -0,0 +1,3 @@ +// Note: types are exported from `dev/index.d.ts`. +export { gfmFootnote } from './lib/syntax.js'; +export { gfmFootnoteHtml, defaultBackLabel } from './lib/html.js'; \ No newline at end of file diff --git a/node_modules/micromark-extension-gfm-footnote/license b/node_modules/micromark-extension-gfm-footnote/license new file mode 100644 index 00000000..f4fb31fe --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2021 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-footnote/package.json b/node_modules/micromark-extension-gfm-footnote/package.json new file mode 100644 index 00000000..bcbf3e6c --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/package.json @@ -0,0 +1,132 @@ +{ + "name": "micromark-extension-gfm-footnote", + "version": "2.1.0", + "description": "micromark extension to support GFM footnotes", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "gfm", + "footnote", + "note", + "definition", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-footnote", + "bugs": "https://github.com/micromark/micromark-extension-gfm-footnote/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/node_modules/micromark-extension-gfm-footnote/readme.md b/node_modules/micromark-extension-gfm-footnote/readme.md new file mode 100644 index 00000000..4c446ae2 --- /dev/null +++ b/node_modules/micromark-extension-gfm-footnote/readme.md @@ -0,0 +1,656 @@ +# micromark-extension-gfm-footnote + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [footnotes][post]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`defaultBackLabel(referenceIndex, rereferenceIndex)`](#defaultbacklabelreferenceindex-rereferenceindex) + * [`gfmFootnote()`](#gfmfootnote) + * [`gfmFootnoteHtml(options?)`](#gfmfootnotehtmloptions) + * [`BackLabelTemplate`](#backlabeltemplate) + * [`HtmlOptions`](#htmloptions) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for footnotes as enabled by +GFM to [`micromark`][micromark]. + +GitHub announced footnotes [on September 30, 2021][post] but did not specify +them in their GFM spec. +As they are implemented in their parser and supported in all places where +other GFM features work, they can be considered part of GFM. +GitHub employs several other features (such as mentions or frontmatter) that +are either not in their parser, or not in all places where GFM features work, +which should not be considered GFM. + +The implementation of footnotes on github.com is currently buggy. +The bugs have been reported on [`cmark-gfm`][cmark-gfm]. +This micromark extension matches github.com except for its bugs. + +## When to use this + +This project is useful when you want to support footnotes in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-footnote`][mdast-util-gfm-footnote]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-footnote +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +````markdown +Using footnotes is fun![^1] They let you reference relevant information without disrupting the flow of what you’re trying to say.[^bignote] + +[^1]: This is the first footnote. +[^bignote]: Here’s one with multiple paragraphs and code. + + Indent paragraphs to include them in the footnote. + + ``` + my code + ``` + + Add as many paragraphs as you like. + +Text here and here and here. +[Learn more about markdown and footnotes in markdown](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes) +```` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {micromark} from 'micromark' +import {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote' + +const output = micromark(await fs.readFile('example.md'), { + extensions: [gfmFootnote()], + htmlExtensions: [gfmFootnoteHtml()] +}) + +console.log(output) +``` + +…now running `node example.js` yields: + +```html +

Using footnotes is fun!1 They let you reference relevant information without disrupting the flow of what you’re trying to say.2

+

Text here and here and here. +Learn more about markdown and footnotes in markdown

+

Footnotes

+
    +
  1. +

    This is the first footnote.

    +
  2. +
  3. +

    Here’s one with multiple paragraphs and code.

    +

    Indent paragraphs to include them in the footnote.

    +
    my code
    +
    +

    Add as many paragraphs as you like.

    +
  4. +
+
+``` + +## API + +This package exports the identifiers +[`defaultBackLabel`][api-default-back-label], +[`gfmFootnote`][api-gfm-footnote], and +[`gfmFootnoteHtml`][api-gfm-footnote-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `defaultBackLabel(referenceIndex, rereferenceIndex)` + +Generate the default label that GitHub uses on backreferences +([`BackLabelTemplate`][api-back-label-template]). + +### `gfmFootnote()` + +Create an extension for `micromark` to enable GFM footnote syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +footnote syntax ([`Extension`][micromark-extension]). + +### `gfmFootnoteHtml(options?)` + +Create an extension for `micromark` to support GFM footnotes when serializing +to HTML. + +###### Parameters + +* `options` ([`HtmlOptions`][api-html-options], optional) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +footnotes when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +### `BackLabelTemplate` + +Generate a back label dynamically (TypeScript type). + +For the following markdown: + +```markdown +Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + +[^remark]: things about remark +[^micromark]: things about micromark +``` + +This function will be called with: + +* `0` and `0` for the backreference from `things about micromark` to + `alpha`, as it is the first used definition, and the first call to it +* `0` and `1` for the backreference from `things about micromark` to + `bravo`, as it is the first used definition, and the second call to it +* `1` and `0` for the backreference from `things about remark` to + `charlie`, as it is the second used definition + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Back label to use when linking back from definitions to their reference +(`string`). + +### `HtmlOptions` + +Configuration (TypeScript type). + +##### Fields + +###### `clobberPrefix` + +Prefix to use before the `id` attribute on footnotes to prevent them from +*clobbering* (`string`, default: `'user-content-'`). + +Pass `''` for trusted markdown and when you are careful with polyfilling. +You could pass a different prefix. + +DOM clobbering is this: + +```html +

+ +``` + +The above example shows that elements are made available by browsers, by their +ID, on the `window` object. +This is a security risk because you might be expecting some other variable at +that place. +It can also break polyfills. +Using a prefix solves these problems. + +###### `label` + +Textual label to use for the footnotes section (`string`, default: +`'Footnotes'`). + +Change it when the markdown is not in English. + +This label is typically hidden visually (assuming a `sr-only` CSS class +is defined that does that) and so affects screen readers only. + +###### `labelAttributes` + +Attributes to use on the footnote label (`string`, default: +`'class="sr-only"'`). + +Change it to show the label and add other attributes. + +This label is typically hidden visually (assuming an `sr-only` CSS class +is defined that does that) and so affects screen readers only. +If you do have such a class, but want to show this section to everyone, +pass an empty string. +You can also add different attributes. + +> 👉 **Note**: `id="footnote-label"` is always added, because footnote +> calls use it with `aria-describedby` to provide an accessible label. + +###### `labelTagName` + +HTML tag name to use for the footnote label element (`string`, default: +`'h2'`). + +Change it to match your document structure. + +This label is typically hidden visually (assuming a `sr-only` CSS class +is defined that does that) and so affects screen readers only. + +###### `backLabel` + +Textual label to describe the backreference back to footnote calls +([`BackLabelTemplate`][api-back-label-template] or `string`, +default: [`defaultBackLabel`][api-default-back-label]). + +Change it when the markdown is not in English. + +This label is used in the [`aria-label`][aria-label] attribute on each +backreference (the `↩` links). +It affects users of assistive technology. + +## Bugs + +GitHub’s own algorithm to parse footnote definitions contains several bugs. +These are not present in this project. +The issues relating to footnote definitions are: + +* [Footnote reference call identifiers are trimmed, but definition + identifiers aren’t](https://github.com/github/cmark-gfm/issues/237)\ + — initial and final whitespace in labels causes them not to match +* [Footnotes are matched case-insensitive, but links keep their casing, + breaking them](https://github.com/github/cmark-gfm/issues/239)\ + — using uppercase (or any character that will be percent encoded) in + identifiers breaks links +* [Colons in footnotes generate links w/o + `href`](https://github.com/github/cmark-gfm/issues/250)\ + — colons in identifiers generate broken links +* [Character escape of `]` does not work in footnote + identifiers](https://github.com/github/cmark-gfm/issues/240)\ + — some character escapes don’t work +* [Footnotes in links are + broken](https://github.com/github/cmark-gfm/issues/249)\ + — while `CommonMark` prevents links in links, GitHub does not prevent + footnotes (which turn into links) in links +* [Footnote-like brackets around image, break that + image](https://github.com/github/cmark-gfm/issues/275)\ + — images can’t be used in what looks like a footnote call +* [GFM footnotes: line ending in footnote definition label causes text to + disappear](https://github.com/github/cmark-gfm/issues/282)\ + — line endings in footnote definitions cause text to disappear + +## Authoring + +When authoring markdown with footnotes it’s recommended to use words instead +of numbers (or letters or anything with an order) as identifiers. +That makes it easier to reuse and reorder footnotes. + +It’s recommended to place footnotes definitions at the bottom of the document. + +## HTML + +GFM footnotes do not, on their own, relate to anything in HTML. +When a footnote reference matches with a definition, they each relate to several +elements in HTML. + +The reference relates to `` and `` elements in HTML: + +```html +1

+``` + +…where `x` is the identifier used in the markdown source and `1` the number of +corresponding, listed, definition. + +See [*§ 4.5.19 The `sub` and `sup` elements*][html-sup], +[*§ 4.5.1 The `a` element*][html-a], and +[*§ 3.2.6.6 Embedding custom non-visible data with the `data-*` +attributes*][html-data] +in the HTML spec, and +[*§ 6.8 `aria-describedby` property*][aria-describedby] +in WAI-ARIA, for more info. + +When one or more definitions are referenced, a footnote section is generated at +the end of the document, using `
`, `

`, and `
    ` elements: + +```html +

    Footnotes

    +
    +
    +``` + +Each definition is generated as a `
  1. ` in the `
      ` in the order they were +first referenced: + +```html +
    1. +``` + +Backreferences are injected at the end of the first paragraph, or, when there +is no paragraph, at the end of the definition. +When a definition is referenced multiple times, multiple backreferences are +generated. +Further backreferences use an extra counter in the `href` attribute and +visually in a `` after `↩`. + +```html + 2 +``` + +See +[*§ 4.5.1 The `a` element*][html-a], +[*§ 4.3.6 The `h1`, `h2`, `h3`, `h4`, `h5`, and `h6` elements*][html-h], +[*§ 4.4.8 The `li` element*][html-li], +[*§ 4.4.5 The `ol` element*][html-ol], +[*§ 4.4.1 The `p` element*][html-p], +[*§ 4.3.3 The `section` element*][html-section], and +[*§ 4.5.19 The `sub` and `sup` elements*][html-sup] +in the HTML spec, and +[*§ 6.8 `aria-label` property*][aria-label] +in WAI-ARIA, for more info. + +## CSS + +The following CSS is needed to make footnotes look a bit like GitHub (and fixes +a bug). +For the complete actual CSS see +[`sindresorhus/github-markdown-css`](https://github.com/sindresorhus/github-markdown-css). + +```css +/* Style the footnotes section. */ +.footnotes { + font-size: smaller; + color: #8b949e; + border-top: 1px solid #30363d; +} + +/* Hide the section label for visual users. */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + word-wrap: normal; + border: 0; +} + +/* Place `[` and `]` around footnote references. */ +[data-footnote-ref]::before { + content: '['; +} + +[data-footnote-ref]::after { + content: ']'; +} +``` + +## Syntax + +Footnotes form with, roughly, the following BNF: + +```bnf +gfm_footnote_reference ::= gfm_footnote_label + +gfm_footnote_definition_start ::= gfm_footnote_label ':' *space_or_tab +; Restriction: blank line allowed. +gfm_footnote_definition_cont ::= 4(space_or_tab) + +; Restriction: maximum `999` codes between `^` and `]`. +gfm_footnote_label ::= '[' '^' 1*(gfm_footnote_label_byte | gfm_footnote_label_escape) ']' +gfm_footnote_label_byte ::= text - '[' - '\\' - ']' +gfm_footnote_label_escape ::= '\\' ['[' | '\\' | ']'] + +; Any byte (u8) +byte ::= 0x00..=0xFFFF +space_or_tab ::= '\t' | ' ' +eol ::= '\n' | '\r' | '\r\n' +line ::= byte - eol +text ::= line - space_or_tab +``` + +Further lines after `gfm_footnote_definition_start` that are not prefixed with +`gfm_footnote_definition_cont` cause the footnote definition to be exited, +except when those lines are lazy continuation or blank. +Like so many things in markdown, footnote definition too are complex. +See [*§ Phase 1: block structure* in `CommonMark`][commonmark-block] for more +on parsing details. + +The identifiers in the `label` parts are interpreted as the +[string][micromark-content-types] content type. +That means that character escapes and character references are allowed. + +Definitions match to references through identifiers. +To match, both labels must be equal after normalizing with +[`normalizeIdentifier`][micromark-normalize-identifier]. +One definition can match to multiple calls. +Multiple definitions with the same, normalized, identifier are ignored: the +first definition is preferred. +To illustrate, the definition with the content of `x` wins: + +```markdown +[^a]: x +[^a]: y + +[^a] +``` + +Importantly, while labels *can* include [string][micromark-content-types] +content (character escapes and character references), these are not considered +when matching. +To illustrate, neither definition matches the reference: + +```markdown +[^a&b]: x +[^a\&b]: y + +[^a&b] +``` + +Because footnote definitions are containers (like block quotes and list items), +they can contain more footnote definitions. +They can even include references to themselves. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`BackLabelTemplate`][api-back-label-template] +and [`HtmlOptions`][api-html-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-footnote@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Setting `clobberPrefix = ''` is dangerous, it opens you up to DOM clobbering. +The `labelTagName` and `labelAttributes` options are unsafe when used with user +content, they allow defining arbitrary HTML. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-footnote`][mdast-util-gfm-footnote] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-footnote/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-footnote/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-footnote.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-footnote + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-footnote.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-footnote + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-footnote + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-footnote + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-content-types]: https://github.com/micromark/micromark#content-types + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-normalize-identifier]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-normalize-identifier + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-footnote]: https://github.com/syntax-tree/mdast-util-gfm-footnote + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[post]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/ + +[cmark-gfm]: https://github.com/github/cmark-gfm + +[commonmark-block]: https://spec.commonmark.org/0.30/#phase-1-block-structure + +[html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element + +[html-data]: https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes + +[html-h]: https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements + +[html-li]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element + +[html-ol]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element + +[html-p]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element + +[html-section]: https://html.spec.whatwg.org/multipage/sections.html#the-section-element + +[html-sup]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-sub-and-sup-elements + +[aria-describedby]: https://w3c.github.io/aria/#aria-describedby + +[aria-label]: https://w3c.github.io/aria/#aria-label + +[api-gfm-footnote]: #gfmfootnote + +[api-gfm-footnote-html]: #gfmfootnotehtmloptions + +[api-html-options]: #htmloptions + +[api-default-back-label]: #defaultbacklabelreferenceindex-rereferenceindex + +[api-back-label-template]: #backlabeltemplate diff --git a/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts b/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts new file mode 100644 index 00000000..037dac3c --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts @@ -0,0 +1,30 @@ +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' + +/** + * Configuration (optional). + */ +export interface Options { + /** + * Whether to support strikethrough with a single tilde (default: `true`). + * + * Single tildes work on github.com, but are technically prohibited by the + * GFM spec. + */ + singleTilde?: boolean | null | undefined +} + +/** + * Augment. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + strikethroughSequence: 'strikethroughSequence' + strikethroughSequenceTemporary: 'strikethroughSequenceTemporary' + strikethrough: 'strikethrough' + strikethroughText: 'strikethroughText' + } +} diff --git a/node_modules/micromark-extension-gfm-strikethrough/dev/index.js b/node_modules/micromark-extension-gfm-strikethrough/dev/index.js new file mode 100644 index 00000000..127b7830 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/dev/index.js @@ -0,0 +1,3 @@ +// Note: more types exposed from `index.d.ts`. +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' diff --git a/node_modules/micromark-extension-gfm-strikethrough/index.d.ts b/node_modules/micromark-extension-gfm-strikethrough/index.d.ts new file mode 100644 index 00000000..50a0b7e5 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/index.d.ts @@ -0,0 +1,24 @@ +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' + +/** + * Configuration (optional). + */ +export interface Options { + /** + * Whether to support strikethrough with a single tilde (default: `true`). + * + * Single tildes work on github.com, but are technically prohibited by the + * GFM spec. + */ + singleTilde?: boolean | null | undefined +} + +declare module 'micromark-util-types' { + interface TokenTypeMap { + strikethroughSequence: 'strikethroughSequence' + strikethroughSequenceTemporary: 'strikethroughSequenceTemporary' + strikethrough: 'strikethrough' + strikethroughText: 'strikethroughText' + } +} diff --git a/node_modules/micromark-extension-gfm-strikethrough/index.js b/node_modules/micromark-extension-gfm-strikethrough/index.js new file mode 100644 index 00000000..da7cbe22 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/index.js @@ -0,0 +1,3 @@ +// Note: more types exposed from `index.d.ts`. +export { gfmStrikethroughHtml } from './lib/html.js'; +export { gfmStrikethrough } from './lib/syntax.js'; \ No newline at end of file diff --git a/node_modules/micromark-extension-gfm-strikethrough/license b/node_modules/micromark-extension-gfm-strikethrough/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-strikethrough/package.json b/node_modules/micromark-extension-gfm-strikethrough/package.json new file mode 100644 index 00000000..31b7cd83 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/package.json @@ -0,0 +1,129 @@ +{ + "name": "micromark-extension-gfm-strikethrough", + "version": "2.1.0", + "description": "micromark extension to support GFM strikethrough", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "strikethrough", + "strike", + "through", + "del", + "delete", + "deletion", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-strikethrough", + "bugs": "https://github.com/micromark/micromark-extension-gfm-strikethrough/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/prefer-at": "off" + }, + "overrides": [ + { + "files": "**/*.ts", + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": "test/**/*.js", + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/node_modules/micromark-extension-gfm-strikethrough/readme.md b/node_modules/micromark-extension-gfm-strikethrough/readme.md new file mode 100644 index 00000000..e2c18d38 --- /dev/null +++ b/node_modules/micromark-extension-gfm-strikethrough/readme.md @@ -0,0 +1,304 @@ +# micromark-extension-gfm-strikethrough + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [strikethrough][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmStrikethrough(options?)`](#gfmstrikethroughoptions) + * [`gfmStrikethroughHtml()`](#gfmstrikethroughhtml) + * [`Options`](#options) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for strikethrough as enabled +by GFM to [`micromark`][micromark]. + +## When to use this + +This project is useful when you want to support strikethrough in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm]. + +When you need a syntax tree, you can combine this package with +[`mdast-util-gfm-strikethrough`][mdast-util-gfm-strikethrough]. + +All these packages are used [`remark-gfm`][remark-gfm], which focusses on making +it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-strikethrough +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmStrikethrough, + gfmStrikethroughHtml +} from 'micromark-extension-gfm-strikethrough' + +const output = micromark('Some ~strikethrough~.', { + extensions: [gfmStrikethrough()], + htmlExtensions: [gfmStrikethroughHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

      Some strikethrough

      . +``` + +## API + +This package exports the identifiers +[`gfmStrikethrough`][api-gfm-strikethrough] and +[`gfmStrikethroughHtml`][api-gfm-strikethrough-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmStrikethrough(options?)` + +Create an extension for `micromark` to enable GFM strikethrough syntax. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `extensions`, to +enable GFM strikethrough syntax ([`Extension`][micromark-extension]). + +### `gfmStrikethroughHtml()` + +Create an HTML extension for `micromark` to support GFM strikethrough when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions`, to support +GFM strikethrough when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `singleTilde` (`boolean`, default: `true`) + — whether to support strikethrough with a single tilde. + Single tildes work on github.com, but are technically prohibited by the GFM + spec + +## Authoring + +When authoring markdown with strikethrough, it is recommended to use two +markers. +While `github.com` allows single tildes too, it technically prohibits it in +their spec. + +## HTML + +When tilde sequences match, they together relate to the `` element in +HTML. +See [*§ 4.7.2 The `del` element*][html-del] in the HTML spec for more info. + +## CSS + +GitHub itself does not apply interesting CSS to `del` elements. +It currently (July 2022) does change `code` in `del`. + +```css +del code { + text-decoration: inherit; +} +``` + +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css]. + +## Syntax + +Strikethrough sequences form with the following BNF: + +```bnf +gfm_attention_sequence ::= 1*'~' +``` + +Sequences are matched together to form strikethrough based on which character +they contain, how long they are, and what character occurs before and after +each sequence. +Otherwise they are turned into data. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-strikethrough@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-strikethrough`][mdast-util-gfm-strikethrough] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-strikethrough/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-strikethrough/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-strikethrough.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-strikethrough + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-strikethrough.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-strikethrough + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-strikethrough + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-strikethrough + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-strikethrough]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[strikethrough]: https://github.github.com/gfm/#strikethrough-extension- + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[html-del]: https://html.spec.whatwg.org/multipage/edits.html#the-del-element + +[api-gfm-strikethrough]: #gfmstrikethroughoptions + +[api-gfm-strikethrough-html]: #gfmstrikethroughhtml + +[api-options]: #options diff --git a/node_modules/micromark-extension-gfm-table/dev/index.d.ts b/node_modules/micromark-extension-gfm-table/dev/index.d.ts new file mode 100644 index 00000000..be1a117c --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/dev/index.d.ts @@ -0,0 +1,55 @@ +import type {Align} from './lib/infer.js' + +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * State tracked to compile events as HTML, + * extended by `micromark-extension-gfm-table`. + */ + interface CompileData { + /** + * Alignment of current table. + */ + tableAlign?: Array | undefined + /** + * Current table column. + */ + tableColumn?: number | undefined + } + + /** + * Augment token; + * `align` is patched on `table` tokens by + * `micromark-extension-gfm-table`. + */ + interface Token { + /** + * Alignment of current table. + */ + _align?: Array | undefined + } + + /** + * Map of allowed token types, + * extended by `micromark-extension-gfm-table`. + */ + interface TokenTypeMap { + tableBody: 'tableBody' + tableCellDivider: 'tableCellDivider' + tableContent: 'tableContent' + tableData: 'tableData' + tableDelimiterFiller: 'tableDelimiterFiller' + tableDelimiterMarker: 'tableDelimiterMarker' + tableDelimiterRow: 'tableDelimiterRow' + tableDelimiter: 'tableDelimiter' + tableHeader: 'tableHeader' + tableHead: 'tableHead' + tableRow: 'tableRow' + table: 'table' + } +} diff --git a/node_modules/micromark-extension-gfm-table/dev/index.js b/node_modules/micromark-extension-gfm-table/dev/index.js new file mode 100644 index 00000000..dcb55608 --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/dev/index.js @@ -0,0 +1,2 @@ +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' diff --git a/node_modules/micromark-extension-gfm-table/index.d.ts b/node_modules/micromark-extension-gfm-table/index.d.ts new file mode 100644 index 00000000..be1a117c --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/index.d.ts @@ -0,0 +1,55 @@ +import type {Align} from './lib/infer.js' + +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * State tracked to compile events as HTML, + * extended by `micromark-extension-gfm-table`. + */ + interface CompileData { + /** + * Alignment of current table. + */ + tableAlign?: Array | undefined + /** + * Current table column. + */ + tableColumn?: number | undefined + } + + /** + * Augment token; + * `align` is patched on `table` tokens by + * `micromark-extension-gfm-table`. + */ + interface Token { + /** + * Alignment of current table. + */ + _align?: Array | undefined + } + + /** + * Map of allowed token types, + * extended by `micromark-extension-gfm-table`. + */ + interface TokenTypeMap { + tableBody: 'tableBody' + tableCellDivider: 'tableCellDivider' + tableContent: 'tableContent' + tableData: 'tableData' + tableDelimiterFiller: 'tableDelimiterFiller' + tableDelimiterMarker: 'tableDelimiterMarker' + tableDelimiterRow: 'tableDelimiterRow' + tableDelimiter: 'tableDelimiter' + tableHeader: 'tableHeader' + tableHead: 'tableHead' + tableRow: 'tableRow' + table: 'table' + } +} diff --git a/node_modules/micromark-extension-gfm-table/index.js b/node_modules/micromark-extension-gfm-table/index.js new file mode 100644 index 00000000..8f9afc67 --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/index.js @@ -0,0 +1,2 @@ +export { gfmTableHtml } from './lib/html.js'; +export { gfmTable } from './lib/syntax.js'; \ No newline at end of file diff --git a/node_modules/micromark-extension-gfm-table/license b/node_modules/micromark-extension-gfm-table/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-table/package.json b/node_modules/micromark-extension-gfm-table/package.json new file mode 100644 index 00000000..89261b93 --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/package.json @@ -0,0 +1,128 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/micromark/micromark-extension-gfm-table/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "description": "micromark extension to support GFM tables", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^2.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "files": [ + "dev/", + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "cell", + "column", + "gfm", + "markdown", + "micromark-extension", + "micromark", + "row", + "table", + "tabular", + "unified" + ], + "license": "MIT", + "name": "micromark-extension-gfm-table", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "micromark/micromark-extension-gfm-table", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark --frail --quiet --output -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api-dev": "node --conditions development test/index.js", + "test-api-prod": "node --conditions production test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "2.1.1", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "complexity": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/micromark-extension-gfm-table/readme.md b/node_modules/micromark-extension-gfm-table/readme.md new file mode 100644 index 00000000..2f437ab5 --- /dev/null +++ b/node_modules/micromark-extension-gfm-table/readme.md @@ -0,0 +1,515 @@ +# micromark-extension-gfm-table + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [tables][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTable()`](#gfmtable) + * [`gfmTableHtml()`](#gfmtablehtml) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for the table syntax enabled +by GFM to [`micromark`][micromark]. +These extensions match github.com. + +## When to use this + +This project is useful when you want to support tables in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-table`][mdast-util-gfm-table]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-table +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTable, gfmTableHtml} from 'https://esm.sh/micromark-extension-gfm-table@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table' + +const output = micromark('| a |\n| - |', { + extensions: [gfmTable()], + htmlExtensions: [gfmTableHtml()] +}) + +console.log(output) +``` + +Yields: + +```html + + + + + + +
      a
      +``` + +## API + +This package exports the identifiers [`gfmTable`][api-gfm-table] and +[`gfmTableHtml`][api-gfm-table-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmTable()` + +Create an HTML extension for `micromark` to support GitHub tables syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +table syntax ([`Extension`][micromark-extension]). + +### `gfmTableHtml()` + +Create an HTML extension for `micromark` to support GitHub tables when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GFM tables when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Bugs + +GitHub’s own algorithm to parse tables contains a bug. +This bug is not present in this project. +The issue relating to tables is: + +* [GFM tables: escaped escapes are incorrectly treated as + escapes](https://github.com/github/cmark-gfm/issues/277) + +## Authoring + +When authoring markdown with GFM tables, it’s recommended to *always* put +pipes around cells. +Without them, it can be hard to infer whether the table will work, how many +columns there are, and which column you are currently editing. + +It is recommended to not use many columns, as it results in very long lines, +making it hard to infer which column you are currently editing. + +For larger tables, particularly when cells vary in size, it is recommended +*not* to manually “pad” cell text. +While it can look better, it results in a lot of time spent realigning +everything when a new, longer cell is added or the longest cell removed, as +every row then must be changed. +Other than costing time, it also causes large diffs in Git. + +To illustrate, when authoring large tables, it is discouraged to pad cells +like this: + +```markdown +| Alpha bravo charlie | delta | +| ------------------- | -----------------: | +| Echo | Foxtrot golf hotel | +``` + +Instead, use single spaces (and single filler dashes): + +```markdown +| Alpha bravo charlie | delta | +| - | -: | +| Echo | Foxtrot golf hotel | +``` + +## HTML + +GFM tables relate to several HTML elements: ``, ``, ``, and ``. +See +[*§ 4.9.1 The `table` element*][html-table], +[*§ 4.9.5 The `tbody` element*][html-tbody], +[*§ 4.9.9 The `td` element*][html-td], +[*§ 4.9.10 The `th` element*][html-th], +[*§ 4.9.6 The `thead` element*][html-thead], and +[*§ 4.9.8 The `tr` element*][html-tr] +in the HTML spec for more info. + +If the alignment of a column is left, right, or center, a deprecated +`align` attribute is added to each `
      `, +``, `
      ` and `` element belonging to +that column. +That attribute is interpreted by browsers as if a CSS `text-align` property +was included, with its value set to that same keyword. + +## CSS + +The following CSS is needed to make tables look a bit like GitHub. +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css] + +```css +/* Light theme. */ +:root { + --color-canvas-default: #ffffff; + --color-canvas-subtle: #f6f8fa; + --color-border-default: #d0d7de; + --color-border-muted: hsla(210, 18%, 87%, 1); +} + +/* Dark theme. */ +@media (prefers-color-scheme: dark) { + :root { + --color-canvas-default: #0d1117; + --color-canvas-subtle: #161b22; + --color-border-default: #30363d; + --color-border-muted: #21262d; + } +} + +table { + border-spacing: 0; + border-collapse: collapse; + display: block; + margin-top: 0; + margin-bottom: 16px; + width: max-content; + max-width: 100%; + overflow: auto; +} + +tr { + background-color: var(--color-canvas-default); + border-top: 1px solid var(--color-border-muted); +} + +tr:nth-child(2n) { + background-color: var(--color-canvas-subtle); +} + +td, +th { + padding: 6px 13px; + border: 1px solid var(--color-border-default); +} + +th { + font-weight: 600; +} + +table img { + background-color: transparent; +} +``` + +## Syntax + +Tables form with the following BNF: + +```abnf +gfmTable ::= gfmTableHead 0*(eol gfmTableBodyRow) + +; Restriction: both rows must have the same number of cells. +gfmTableHead ::= gfmTableRow eol gfmTableDelimiterRow + +gfmTableRow ::= ["|"] gfmTableCell 0*("|" gfmTableCell) ["|"] *spaceOrTab +gfmTableCell ::= *spaceOrTab gfmTableText *spaceOrTab +gfmTableText ::= 0*(line - "\\" - "|" / "\\" ["\\" / "|"]) + +gfmTableDelimiterRow ::= ["|"] gfmTableDelimiterCell 0*("|" gfmTableDelimiterCell) ["|"] *spaceOrTab +gfmTableDelimiterCell ::= *spaceOrTab gfmTableDelimiterValue *spaceOrTab +gfmTableDelimiterValue ::= [":"] 1*"-" [":"] +``` + +As this construct occurs in flow, like all flow constructs, it must be +followed by an eol (line ending) or eof (end of file). + +The above grammar shows that basically anything can be a cell or a row. +The main thing that makes something a row, is that it occurs directly before +or after a delimiter row, or after another row. + +It is not required for a table to have a body: it can end right after the +delimiter row. + +Each column can be marked with an alignment. +The alignment marker is a colon (`:`) used before and/or after delimiter row +filler. +To illustrate: + +```markdown +| none | left | right | center | +| ---- | :--- | ----: | :----: | +``` + +The number of cells in the delimiter row, is the number of columns of the +table. +Only the head row is required to have the same number of cells. +Body rows are not required to have a certain number of cells. +For body rows that have less cells than the number of columns of the table, +empty cells are injected. +When a row has more cells than the number of columns of the table, the +superfluous cells are dropped. +To illustrate: + +```markdown +| a | b | +| - | - | +| c | +| d | e | f | +``` + +Yields: + +```html + + + + + + + + + + + + + + + + + +
      ab
      c
      de
      +``` + +Each cell’s text is interpreted as the [text][micromark-content-type] content +type. +That means that it can include constructs such as attention (emphasis, strong). + +The grammar for cells prohibits the use of `|` in them. +To use pipes in cells, encode them as a character reference or character +escape: `|` (or `|`, `|`, `|`, `|`) or +`\|`. + +Escapes will typically work, but they are not supported in +code (text) (and the math (text) extension). +To work around this, GitHub came up with a rather weird “trick”. +When inside a table cell *and* inside code, escaped pipes *are* decoded. +To illustrate: + +```markdown +| Name | Character | +| - | - | +| Left curly brace | `{` | +| Pipe | `\|` | +| Right curly brace | `}` | +``` + +Yields: + +```html + + + + + + + + + + + + + + + + + + + + + +
      NameCharacter
      Left curly brace{
      Pipe|
      Right curly brace}
      +``` + +> 👉 **Note**: no other character can be escaped like this. +> Escaping pipes in code does not work when not inside a table, either. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-table@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-table`][mdast-util-gfm-table] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-table/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-table/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-table.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-table + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-table.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-table + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-table + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-table + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-content-type]: https://github.com/micromark/micromark#content-types + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-gfm-table]: https://github.com/syntax-tree/mdast-util-gfm-table + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[tables]: https://github.github.com/gfm/#tables-extension- + +[html-table]: https://html.spec.whatwg.org/multipage/tables.html#the-table-element + +[html-tbody]: https://html.spec.whatwg.org/multipage/tables.html#the-tbody-element + +[html-thead]: https://html.spec.whatwg.org/multipage/tables.html#the-thead-element + +[html-tr]: https://html.spec.whatwg.org/multipage/tables.html#the-tr-element + +[html-td]: https://html.spec.whatwg.org/multipage/tables.html#the-td-element + +[html-th]: https://html.spec.whatwg.org/multipage/tables.html#the-th-element + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[api-gfm-table]: #gfmtable + +[api-gfm-table-html]: #gfmtablehtml diff --git a/node_modules/micromark-extension-gfm-tagfilter/index.d.ts b/node_modules/micromark-extension-gfm-tagfilter/index.d.ts new file mode 100644 index 00000000..a00c9377 --- /dev/null +++ b/node_modules/micromark-extension-gfm-tagfilter/index.d.ts @@ -0,0 +1 @@ +export {gfmTagfilterHtml} from './lib/index.js' diff --git a/node_modules/micromark-extension-gfm-tagfilter/index.js b/node_modules/micromark-extension-gfm-tagfilter/index.js new file mode 100644 index 00000000..a00c9377 --- /dev/null +++ b/node_modules/micromark-extension-gfm-tagfilter/index.js @@ -0,0 +1 @@ +export {gfmTagfilterHtml} from './lib/index.js' diff --git a/node_modules/micromark-extension-gfm-tagfilter/license b/node_modules/micromark-extension-gfm-tagfilter/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/micromark-extension-gfm-tagfilter/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-tagfilter/package.json b/node_modules/micromark-extension-gfm-tagfilter/package.json new file mode 100644 index 00000000..179a1058 --- /dev/null +++ b/node_modules/micromark-extension-gfm-tagfilter/package.json @@ -0,0 +1,82 @@ +{ + "name": "micromark-extension-gfm-tagfilter", + "version": "2.0.0", + "description": "micromark extension to support GFM tagfilter", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "tagfilter", + "tag", + "filter", + "dangerous", + "html", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-tagfilter", + "bugs": "https://github.com/micromark/micromark-extension-gfm-tagfilter/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "micromark": "^4.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/micromark-extension-gfm-tagfilter/readme.md b/node_modules/micromark-extension-gfm-tagfilter/readme.md new file mode 100644 index 00000000..f97b2e73 --- /dev/null +++ b/node_modules/micromark-extension-gfm-tagfilter/readme.md @@ -0,0 +1,237 @@ +# micromark-extension-gfm-tagfilter + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extension to support GFM [tag filter][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTagfilterHtml()`](#gfmtagfilterhtml) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains an extension that adds support for the tagfilter enabled +by GFM to [`micromark`][micromark]. +The tagfilter is kinda weird and kinda useless. +This package exists for completeness. +The tag filter is a naïve attempt at XSS protection. +You should use a proper HTML sanitizing algorithm. + +## When to use this + +This project is useful when you want to match how GitHub works. +You can use this extension when you are working with [`micromark`][micromark] +already. +When you do, you can instead use +[`micromark-extension-gfm`][micromark-extension-gfm], which includes this +extension, to support all GFM features. + +When you want to deal with syntax trees, you should instead use +[`hast-util-sanitize`][hast-util-sanitize]. + +When you use remark and rehype, you should use +[`rehype-sanitize`][rehype-sanitize]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-tagfilter +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTagfilterHtml} from 'https://esm.sh/micromark-extension-gfm-tagfilter@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter' + +const output = micromark('XSS! ', { + allowDangerousHtml: true, + htmlExtensions: [gfmTagfilterHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

      XSS! <script>alert(1)</script>

      +``` + +## API + +This package exports the identifier +[`gfmTagfilterHtml`][api-gfm-tagfilter-html]. +There is no default export. + +### `gfmTagfilterHtml()` + +Create an HTML extension for `micromark` to support GitHubs weird and +useless tagfilter when serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GitHubs weird and useless tagfilter when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Authoring + +This package relates to malicious authors, not decent authors. + +## HTML + +GFM tagfilter removes certain dangerous HTML tags: `iframe`, `noembed`, +`noframes`, `plaintext`, `script`, `style`, `title`, `textarea`, and `xmp`. + +## CSS + +This package does not relate to CSS. + +## Syntax + +This package does not change how markdown is parsed. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-tagfilter@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +While micromark is safe by default, this extension only does something when +`allowDangerousHtml: true` is passed, which is an unsafe option. +This package is **not safe**. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`hast-util-sanitize`][hast-util-sanitize] + — hast utility to make trees safe +* [`rehype-sanitize`][rehype-sanitize] + — rehype plugin to sanitize HTML + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-tagfilter/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-tagfilter/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-tagfilter.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-tagfilter + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-tagfilter.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-tagfilter + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-tagfilter + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-tagfilter + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[tag filter]: https://github.github.com/gfm/#disallowed-raw-html-extension- + +[api-gfm-tagfilter-html]: #gfmtagfilterhtml diff --git a/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts b/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts new file mode 100644 index 00000000..3c0d959e --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts @@ -0,0 +1,17 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + taskListCheck: 'taskListCheck' + taskListCheckMarker: 'taskListCheckMarker' + taskListCheckValueChecked: 'taskListCheckValueChecked' + taskListCheckValueUnchecked: 'taskListCheckValueUnchecked' + } +} diff --git a/node_modules/micromark-extension-gfm-task-list-item/dev/index.js b/node_modules/micromark-extension-gfm-task-list-item/dev/index.js new file mode 100644 index 00000000..2e18f6c1 --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/dev/index.js @@ -0,0 +1,2 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' diff --git a/node_modules/micromark-extension-gfm-task-list-item/index.d.ts b/node_modules/micromark-extension-gfm-task-list-item/index.d.ts new file mode 100644 index 00000000..3c0d959e --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/index.d.ts @@ -0,0 +1,17 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + taskListCheck: 'taskListCheck' + taskListCheckMarker: 'taskListCheckMarker' + taskListCheckValueChecked: 'taskListCheckValueChecked' + taskListCheckValueUnchecked: 'taskListCheckValueUnchecked' + } +} diff --git a/node_modules/micromark-extension-gfm-task-list-item/index.js b/node_modules/micromark-extension-gfm-task-list-item/index.js new file mode 100644 index 00000000..b7d19c14 --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/index.js @@ -0,0 +1,2 @@ +export { gfmTaskListItemHtml } from './lib/html.js'; +export { gfmTaskListItem } from './lib/syntax.js'; \ No newline at end of file diff --git a/node_modules/micromark-extension-gfm-task-list-item/license b/node_modules/micromark-extension-gfm-task-list-item/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm-task-list-item/package.json b/node_modules/micromark-extension-gfm-task-list-item/package.json new file mode 100644 index 00000000..bfc8bd51 --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/package.json @@ -0,0 +1,131 @@ +{ + "name": "micromark-extension-gfm-task-list-item", + "version": "2.1.0", + "description": "micromark extension to support GFM task list items", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "task", + "list", + "item", + "check", + "checkbox", + "todo", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-task-list-item", + "bugs": "https://github.com/micromark/micromark-extension-gfm-task-list-item/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "control-pictures": "^2.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "unicorn/no-this-assignment": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ] + } +} diff --git a/node_modules/micromark-extension-gfm-task-list-item/readme.md b/node_modules/micromark-extension-gfm-task-list-item/readme.md new file mode 100644 index 00000000..fd8ba964 --- /dev/null +++ b/node_modules/micromark-extension-gfm-task-list-item/readme.md @@ -0,0 +1,305 @@ +# micromark-extension-gfm-task-list-item + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [task list items][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTaskListItem()`](#gfmtasklistitem) + * [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for task lists as enabled by +GFM to [`micromark`][micromark]. +It matches how task list items work on `github.com`. + +## When to use this + +This project is useful when you want to support task lists in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm]. + +When you need a syntax tree, you can combine this package with +[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item]. + +All these packages are used [`remark-gfm`][remark-gfm], which focusses on making +it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-task-list-item +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmTaskListItem, + gfmTaskListItemHtml +} from 'micromark-extension-gfm-task-list-item' + +const output = micromark('* [x] a\n* [ ] b', { + extensions: [gfmTaskListItem()], + htmlExtensions: [gfmTaskListItemHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +
        +
      • a
      • +
      • b
      • +
      +``` + +## API + +This package exports the identifiers [`gfmTaskListItem`][api-gfm-task-list-item] +and [`gfmTaskListItemHtml`][api-gfm-task-list-item-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmTaskListItem()` + +Create an HTML extension for `micromark` to support GFM task list items +syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions`, to enable GFM +task list items syntax ([`Extension`][micromark-extension]). + +### `gfmTaskListItemHtml()` + +Create an HTML extension for `micromark` to support GFM task list items when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +task list items when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Authoring + +It is recommended to use lowercase `x` (instead of uppercase `X`), because in +markdown, it is more common to use lowercase in places where casing does not +matter. +It is also recommended to use a space (instead of a tab), as there is no benefit +of using tabs in this case. + +## HTML + +Checks relate to the `` element, in the checkbox state (`type=checkbox`), +in HTML. +See [*§ 4.10.5.1.15 Checkbox state (`type=checkbox`)*][html-input-checkbox] +in the HTML spec for more info. + +```html + +
    2. foo
    3. +
    4. bar
    5. + +``` + +## CSS + +GitHub itself uses slightly different markup for task list items than they +define in their spec. +When following the spec, as this extension does, only inputs are added. +They can be styled with the following CSS: + +```css +input[type="checkbox"] { + margin: 0 .2em .25em -1.6em; + vertical-align: middle; +} + +input[type="checkbox"]:dir(rtl) { + margin: 0 -1.6em .25em .2em; +} +``` + +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css]. + +## Syntax + +Checks form with the following BNF: + +```bnf +gfm_task_list_item_check ::= '[' (0x09 | ' ' | 'X' | 'x') ']' +``` + +The check is only allowed at the start of the first paragraph, optionally +following zero or more definitions or a blank line, in a list item. +The check must be followed by whitespace (`[\t\n\r ]*`), which is in turn +followed by non-whitespace. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-task-list-item@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-task-list-item/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-task-list-item/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-task-list-item.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-task-list-item + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-task-list-item.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-task-list-item + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-task-list-item + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-task-list-item + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-task-list-item]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[task list items]: https://github.github.com/gfm/#task-list-items-extension- + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[html-input-checkbox]: https://html.spec.whatwg.org/multipage/input.html#checkbox-state-\(type=checkbox\) + +[api-gfm-task-list-item]: #gfmtasklistitem + +[api-gfm-task-list-item-html]: #gfmtasklistitemhtml diff --git a/node_modules/micromark-extension-gfm/index.d.ts b/node_modules/micromark-extension-gfm/index.d.ts new file mode 100644 index 00000000..8fdf1967 --- /dev/null +++ b/node_modules/micromark-extension-gfm/index.d.ts @@ -0,0 +1,28 @@ +/** + * Create an extension for `micromark` to enable GFM syntax. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-strikethrough`. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * syntax. + */ +export function gfm(options?: Options | null | undefined): Extension +/** + * Create an extension for `micromark` to support GFM when serializing to HTML. + * + * @param {HtmlOptions | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-footnote`. + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM when serializing to HTML. + */ +export function gfmHtml(options?: HtmlOptions | null | undefined): HtmlExtension +export type HtmlOptions = import('micromark-extension-gfm-footnote').HtmlOptions +export type Options = import('micromark-extension-gfm-strikethrough').Options +export type Extension = import('micromark-util-types').Extension +export type HtmlExtension = import('micromark-util-types').HtmlExtension diff --git a/node_modules/micromark-extension-gfm/index.js b/node_modules/micromark-extension-gfm/index.js new file mode 100644 index 00000000..839e7358 --- /dev/null +++ b/node_modules/micromark-extension-gfm/index.js @@ -0,0 +1,69 @@ +/** + * @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions + * @typedef {import('micromark-extension-gfm-strikethrough').Options} Options + * @typedef {import('micromark-util-types').Extension} Extension + * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension + */ + +import { + combineExtensions, + combineHtmlExtensions +} from 'micromark-util-combine-extensions' +import { + gfmAutolinkLiteral, + gfmAutolinkLiteralHtml +} from 'micromark-extension-gfm-autolink-literal' +import {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote' +import { + gfmStrikethrough, + gfmStrikethroughHtml +} from 'micromark-extension-gfm-strikethrough' +import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table' +import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter' +import { + gfmTaskListItem, + gfmTaskListItemHtml +} from 'micromark-extension-gfm-task-list-item' + +/** + * Create an extension for `micromark` to enable GFM syntax. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-strikethrough`. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * syntax. + */ +export function gfm(options) { + return combineExtensions([ + gfmAutolinkLiteral(), + gfmFootnote(), + gfmStrikethrough(options), + gfmTable(), + gfmTaskListItem() + ]) +} + +/** + * Create an extension for `micromark` to support GFM when serializing to HTML. + * + * @param {HtmlOptions | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-footnote`. + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM when serializing to HTML. + */ +export function gfmHtml(options) { + return combineHtmlExtensions([ + gfmAutolinkLiteralHtml(), + gfmFootnoteHtml(options), + gfmStrikethroughHtml(), + gfmTableHtml(), + gfmTagfilterHtml(), + gfmTaskListItemHtml() + ]) +} diff --git a/node_modules/micromark-extension-gfm/license b/node_modules/micromark-extension-gfm/license new file mode 100644 index 00000000..39372356 --- /dev/null +++ b/node_modules/micromark-extension-gfm/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-extension-gfm/package.json b/node_modules/micromark-extension-gfm/package.json new file mode 100644 index 00000000..11c014f8 --- /dev/null +++ b/node_modules/micromark-extension-gfm/package.json @@ -0,0 +1,107 @@ +{ + "name": "micromark-extension-gfm", + "version": "3.0.0", + "description": "micromark extension to support GFM (GitHub Flavored Markdown)", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "table", + "strikethrough", + "tasklist", + "autolink", + "footnote", + "tagfilter", + "github", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm", + "bugs": "https://github.com/micromark/micromark-extension-gfm/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js" + ], + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "create-gfm-fixtures": "^1.0.0", + "hast-util-from-html": "^1.0.0", + "hast-util-select": "^5.0.0", + "hast-util-to-text": "^3.0.0", + "micromark": "^4.0.0", + "prettier": "^2.0.0", + "rehype": "^12.0.0", + "rehype-sort-attributes": "^4.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "undici": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "overrides": [ + { + "files": [ + "{test,script}/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ] + } +} diff --git a/node_modules/micromark-extension-gfm/readme.md b/node_modules/micromark-extension-gfm/readme.md new file mode 100644 index 00000000..d569a19a --- /dev/null +++ b/node_modules/micromark-extension-gfm/readme.md @@ -0,0 +1,433 @@ +# micromark-extension-gfm + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support [GitHub flavored markdown][gfm] (GFM). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfm(options?)`](#gfmoptions) + * [`gfmHtml(options?)`](#gfmhtmloptions) + * [`Options`](#options) + * [`HtmlOptions`](#htmloptions) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for all features enabled by +GFM to [`micromark`][micromark]. +It supports autolink literals, footnotes, strikethrough, tables, tagfilter, and +tasklists. + +## When to use this + +This project is useful when you want to support GFM in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +Alternatively, you can also use the underlying features separately: + +* [`micromark-extension-gfm-autolink-literal`][gfm-autolink-literal] + — support GFM [autolink literals][] +* [`micromark-extension-gfm-footnote`][gfm-footnote] + — support GFM [footnotes][] +* [`micromark-extension-gfm-strikethrough`][gfm-strikethrough] + — support GFM [strikethrough][] +* [`micromark-extension-gfm-table`][gfm-table] + — support GFM [tables][] +* [`micromark-extension-gfm-tagfilter`][gfm-tagfilter] + — support GFM [tagfilter][] +* [`micromark-extension-gfm-task-list-item`][gfm-task-list-item] + — support GFM [tasklists][] + +When you need a syntax tree, combine this package with +[`mdast-util-gfm`][mdast-util-gfm]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfm, gfmHtml} from 'https://esm.sh/micromark-extension-gfm@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +# GFM + +## Autolink literals + +www.example.com, https://example.com, and contact@example.com. + +## Footnote + +A note[^1] + +[^1]: Big note. + +## Strikethrough + +~one~ or ~~two~~ tildes. + +## Table + +| a | b | c | d | +| - | :- | -: | :-: | + +## Tag filter + + + +## Tasklist + +* [ ] to do +* [x] done +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {micromark} from 'micromark' +import {gfm, gfmHtml} from 'micromark-extension-gfm' + +const output = micromark(await fs.readFile('example.md'), { + allowDangerousHtml: true, + extensions: [gfm()], + htmlExtensions: [gfmHtml()] +}) + +console.log(output) +``` + +…now running `node example.js` yields: + +```html +<h1>GFM</h1> +<h2>Autolink literals</h2> +<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:contact@example.com">contact@example.com</a>.</p> +<h2>Footnote</h2> +<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> +<h2>Strikethrough</h2> +<p><del>one</del> or <del>two</del> tildes.</p> +<h2>Table</h2> +<table> +<thead> +<tr> +<th>a</th> +<th align="left">b</th> +<th align="right">c</th> +<th align="center">d</th> +</tr> +</thead> +</table> +<h2>Tag filter</h2> +&lt;plaintext> +<h2>Tasklist</h2> +<ul> +<li><input type="checkbox" disabled="" /> to do</li> +<li><input type="checkbox" disabled="" checked="" /> done</li> +</ul> +<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> +<ol> +<li id="user-content-fn-1"> +<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩</a></p> +</li> +</ol> +</section> +``` + +## API + +This package exports the identifiers [`gfm`][api-gfm] and +[`gfmHtml`][api-gfm-html]. +There is no default export. + +The separate extensions support the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfm(options?)` + +Create an extension for `micromark` to enable GFM syntax. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration; passed to + [`micromark-extens-gfm-strikethrough`][gfm-strikethrough-options] + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +syntax ([`Extension`][micromark-extension]). + +### `gfmHtml(options?)` + +Create an extension for `micromark` to support GFM when serializing to HTML. + +###### Parameters + +* `options` ([`HtmlOptions`][api-html-options], optional) + — configuration; passed to + [`micromark-extens-gfm-footnote`][gfm-footnote-html-options] + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +when serializing to HTML ([`HtmlExtension`][micromark-html-extension]). + +### `Options` + +Configuration for syntax (TypeScript type). + +###### Type + +```ts +export type {Options} from 'micromark-extension-gfm-strikethrough' +``` + +[See `Options`][gfm-strikethrough-options]. + +### `HtmlOptions` + +Configuration for HTML (TypeScript type). + +###### Type + +```ts +export type {HtmlOptions} from 'micromark-extension-gfm-footnote' +``` + +[See `HtmlOptions`][gfm-footnote-html-options]. + +## Bugs + +For bugs present in GFM but not here, or other peculiarities that are +supported, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#bugs) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#bugs) +* strikethrough: n/a +* [table](https://github.com/micromark/micromark-extension-gfm-table#bugs) +* tagfilter: n/a +* tasklists: n/a + +## Authoring + +For recommendations on how to author GFM, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#authoring) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#authoring) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#authoring) +* [table](https://github.com/micromark/micromark-extension-gfm-table#authoring) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#authoring) + +## HTML + +For info on what HTML features GFM relates to, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#html) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#html) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#html) +* [table](https://github.com/micromark/micromark-extension-gfm-table#html) +* [tagfilter](https://github.com/micromark/micromark-extension-gfm-tagfilter#html) +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#html) + +## CSS + +For info on how GitHub styles these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#css) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#css) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#css) +* [table](https://github.com/micromark/micromark-extension-gfm-table#css) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#css) + +## Syntax + +For info on the syntax of these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#syntax) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax) +* [table](https://github.com/micromark/micromark-extension-gfm-table#syntax) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax) + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`HtmlOptions`][api-html-options] and +[`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm@^3`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Setting `clobberPrefix = ''` is dangerous, it opens you up to DOM clobbering. +The `labelTagName` and `labelAttributes` options are unsafe when used with user +content, they allow defining arbitrary HTML. + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark-extension-gfm/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm + +[size]: https://bundlejs.com/?q=micromark-extension-gfm + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[typescript]: https://www.typescriptlang.org + +[gfm]: https://github.github.com/gfm/ + +[strikethrough]: https://github.github.com/gfm/#strikethrough-extension- + +[tables]: https://github.github.com/gfm/#tables-extension- + +[tasklists]: https://github.github.com/gfm/#task-list-items-extension- + +[autolink literals]: https://github.github.com/gfm/#autolinks-extension- + +[tagfilter]: https://github.github.com/gfm/#disallowed-raw-html-extension- + +[footnotes]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/ + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[gfm-strikethrough]: https://github.com/micromark/micromark-extension-gfm-strikethrough + +[gfm-strikethrough-options]: https://github.com/micromark/micromark-extension-gfm-strikethrough#options + +[gfm-autolink-literal]: https://github.com/micromark/micromark-extension-gfm-autolink-literal + +[gfm-footnote]: https://github.com/micromark/micromark-extension-gfm-footnote + +[gfm-footnote-html-options]: https://github.com/micromark/micromark-extension-gfm-footnote#htmloptions + +[gfm-table]: https://github.com/micromark/micromark-extension-gfm-table + +[gfm-tagfilter]: https://github.com/micromark/micromark-extension-gfm-tagfilter + +[gfm-task-list-item]: https://github.com/micromark/micromark-extension-gfm-task-list-item + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[api-gfm]: #gfmoptions + +[api-gfm-html]: #gfmhtmloptions + +[api-options]: #options + +[api-html-options]: #htmloptions diff --git a/node_modules/micromark-factory-destination/dev/index.d.ts b/node_modules/micromark-factory-destination/dev/index.d.ts new file mode 100644 index 00000000..1d5e02a5 --- /dev/null +++ b/node_modules/micromark-factory-destination/dev/index.d.ts @@ -0,0 +1,42 @@ +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-destination/dev/index.d.ts.map b/node_modules/micromark-factory-destination/dev/index.d.ts.map new file mode 100644 index 00000000..84746ee2 --- /dev/null +++ b/node_modules/micromark-factory-destination/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-destination/dev/index.js b/node_modules/micromark-factory-destination/dev/index.js new file mode 100644 index 00000000..a4816fdc --- /dev/null +++ b/node_modules/micromark-factory-destination/dev/index.js @@ -0,0 +1,255 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { + asciiControl, + markdownLineEndingOrSpace, + markdownLineEnding +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + const limit = max || Number.POSITIVE_INFINITY + let balance = 0 + + return start + + /** + * Start of destination. + * + * ```markdown + * > | <aa> + * ^ + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === codes.lessThan) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return enclosedBefore + } + + // ASCII control, space, closing paren. + if ( + code === codes.eof || + code === codes.space || + code === codes.rightParenthesis || + asciiControl(code) + ) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return raw(code) + } + + /** + * After `<`, at an enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosedBefore(code) { + if (code === codes.greaterThan) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return enclosed(code) + } + + /** + * In enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosed(code) { + if (code === codes.greaterThan) { + effects.exit(types.chunkString) + effects.exit(stringType) + return enclosedBefore(code) + } + + if ( + code === codes.eof || + code === codes.lessThan || + markdownLineEnding(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash ? enclosedEscape : enclosed + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | <a\*a> + * ^ + * ``` + * + * @type {State} + */ + function enclosedEscape(code) { + if ( + code === codes.lessThan || + code === codes.greaterThan || + code === codes.backslash + ) { + effects.consume(code) + return enclosed + } + + return enclosed(code) + } + + /** + * In raw destination. + * + * ```markdown + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function raw(code) { + if ( + !balance && + (code === codes.eof || + code === codes.rightParenthesis || + markdownLineEndingOrSpace(code)) + ) { + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (balance < limit && code === codes.leftParenthesis) { + effects.consume(code) + balance++ + return raw + } + + if (code === codes.rightParenthesis) { + effects.consume(code) + balance-- + return raw + } + + // ASCII control (but *not* `\0`) and space and `(`. + // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it + // doesn’t. + if ( + code === codes.eof || + code === codes.space || + code === codes.leftParenthesis || + asciiControl(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash ? rawEscape : raw + } + + /** + * After `\`, at special character. + * + * ```markdown + * > | a\*a + * ^ + * ``` + * + * @type {State} + */ + function rawEscape(code) { + if ( + code === codes.leftParenthesis || + code === codes.rightParenthesis || + code === codes.backslash + ) { + effects.consume(code) + return raw + } + + return raw(code) + } +} diff --git a/node_modules/micromark-factory-destination/index.d.ts b/node_modules/micromark-factory-destination/index.d.ts new file mode 100644 index 00000000..1d5e02a5 --- /dev/null +++ b/node_modules/micromark-factory-destination/index.d.ts @@ -0,0 +1,42 @@ +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-destination/index.d.ts.map b/node_modules/micromark-factory-destination/index.d.ts.map new file mode 100644 index 00000000..84746ee2 --- /dev/null +++ b/node_modules/micromark-factory-destination/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-destination/index.js b/node_modules/micromark-factory-destination/index.js new file mode 100644 index 00000000..eeb60de6 --- /dev/null +++ b/node_modules/micromark-factory-destination/index.js @@ -0,0 +1,206 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { asciiControl, markdownLineEndingOrSpace, markdownLineEnding } from 'micromark-util-character'; +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) { + const limit = max || Number.POSITIVE_INFINITY; + let balance = 0; + return start; + + /** + * Start of destination. + * + * ```markdown + * > | <aa> + * ^ + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === 60) { + effects.enter(type); + effects.enter(literalType); + effects.enter(literalMarkerType); + effects.consume(code); + effects.exit(literalMarkerType); + return enclosedBefore; + } + + // ASCII control, space, closing paren. + if (code === null || code === 32 || code === 41 || asciiControl(code)) { + return nok(code); + } + effects.enter(type); + effects.enter(rawType); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return raw(code); + } + + /** + * After `<`, at an enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosedBefore(code) { + if (code === 62) { + effects.enter(literalMarkerType); + effects.consume(code); + effects.exit(literalMarkerType); + effects.exit(literalType); + effects.exit(type); + return ok; + } + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return enclosed(code); + } + + /** + * In enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosed(code) { + if (code === 62) { + effects.exit("chunkString"); + effects.exit(stringType); + return enclosedBefore(code); + } + if (code === null || code === 60 || markdownLineEnding(code)) { + return nok(code); + } + effects.consume(code); + return code === 92 ? enclosedEscape : enclosed; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | <a\*a> + * ^ + * ``` + * + * @type {State} + */ + function enclosedEscape(code) { + if (code === 60 || code === 62 || code === 92) { + effects.consume(code); + return enclosed; + } + return enclosed(code); + } + + /** + * In raw destination. + * + * ```markdown + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function raw(code) { + if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) { + effects.exit("chunkString"); + effects.exit(stringType); + effects.exit(rawType); + effects.exit(type); + return ok(code); + } + if (balance < limit && code === 40) { + effects.consume(code); + balance++; + return raw; + } + if (code === 41) { + effects.consume(code); + balance--; + return raw; + } + + // ASCII control (but *not* `\0`) and space and `(`. + // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it + // doesn’t. + if (code === null || code === 32 || code === 40 || asciiControl(code)) { + return nok(code); + } + effects.consume(code); + return code === 92 ? rawEscape : raw; + } + + /** + * After `\`, at special character. + * + * ```markdown + * > | a\*a + * ^ + * ``` + * + * @type {State} + */ + function rawEscape(code) { + if (code === 40 || code === 41 || code === 92) { + effects.consume(code); + return raw; + } + return raw(code); + } +} \ No newline at end of file diff --git a/node_modules/micromark-factory-destination/license b/node_modules/micromark-factory-destination/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-factory-destination/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-factory-destination/package.json b/node_modules/micromark-factory-destination/package.json new file mode 100644 index 00000000..0863cb69 --- /dev/null +++ b/node_modules/micromark-factory-destination/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-factory-destination", + "version": "2.0.1", + "description": "micromark factory to parse destinations (found in resources, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "destination" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-destination", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-params": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-factory-destination/readme.md b/node_modules/micromark-factory-destination/readme.md new file mode 100644 index 00000000..f4899d74 --- /dev/null +++ b/node_modules/micromark-factory-destination/readme.md @@ -0,0 +1,234 @@ +# micromark-factory-destination + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse destinations (found in resources, definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryDestination(…)`](#factorydestination) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse destinations. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-destination +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1?bundle' +</script> +``` + +## Use + +```js +import {factoryDestination} from 'micromark-factory-destination' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeResource(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function open(code) { + if (code === codes.rightParenthesis) { + return end(code) + } + + return factoryDestination( + effects, + destinationAfter, + nok, + types.resourceDestination, + types.resourceDestinationLiteral, + types.resourceDestinationLiteralMarker, + types.resourceDestinationRaw, + types.resourceDestinationString, + constants.linkResourceDestinationBalanceMax + )(code) + } + + // … +} +``` + +## API + +This module exports the identifier +[`factoryDestination`][api-factory-destination]. +There is no default export. + +### `factoryDestination(…)` + +Parse destinations. + +###### Examples + +```markdown +<a> +<a\>b> +<a b> +<a)> +a +a\)b +a(b)c +a(b) +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type for whole (`<a>` or `b`) +* `literalType` (`string`) + — type when enclosed (`<a>`) +* `literalMarkerType` (`string`) + — type for enclosing (`<` and `>`) +* `rawType` (`string`) + — type when not enclosed (`b`) +* `stringType` (`string`) + — type for the value (`a` or `b`) +* `max` (`number`, default: `Infinity`) + — depth of nested parens (inclusive) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-destination@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-destination.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-destination + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-destination + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-destination + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-destination]: #factorydestination diff --git a/node_modules/micromark-factory-label/dev/index.d.ts b/node_modules/micromark-factory-label/dev/index.d.ts new file mode 100644 index 00000000..99f5bdad --- /dev/null +++ b/node_modules/micromark-factory-label/dev/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-label/dev/index.d.ts.map b/node_modules/micromark-factory-label/dev/index.d.ts.map new file mode 100644 index 00000000..fe94eeea --- /dev/null +++ b/node_modules/micromark-factory-label/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-label/dev/index.js b/node_modules/micromark-factory-label/dev/index.js new file mode 100644 index 00000000..242f0ced --- /dev/null +++ b/node_modules/micromark-factory-label/dev/index.js @@ -0,0 +1,172 @@ +/** + * @import { + * Effects, + * State, + * TokenizeContext, + * TokenType + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(effects, ok, nok, type, markerType, stringType) { + const self = this + let size = 0 + /** @type {boolean} */ + let seen + + return start + + /** + * Start of label. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + /** + * In label, at something, before something else. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if ( + size > constants.linkReferenceSizeMax || + code === codes.eof || + code === codes.leftSquareBracket || + (code === codes.rightSquareBracket && !seen) || + // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + (code === codes.caret && + !size && + '_hiddenFootnoteSupport' in self.parser.constructs) + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + // To do: indent? Link chunks and EOLs together? + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return atBreak + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return labelInside(code) + } + + /** + * In label, in text. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + code === codes.rightSquareBracket || + markdownLineEnding(code) || + size++ > constants.linkReferenceSizeMax + ) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + if (!seen) seen = !markdownSpace(code) + return code === codes.backslash ? labelEscape : labelInside + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | [a\*a] + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return labelInside + } + + return labelInside(code) + } +} diff --git a/node_modules/micromark-factory-label/index.d.ts b/node_modules/micromark-factory-label/index.d.ts new file mode 100644 index 00000000..99f5bdad --- /dev/null +++ b/node_modules/micromark-factory-label/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-label/index.d.ts.map b/node_modules/micromark-factory-label/index.d.ts.map new file mode 100644 index 00000000..fe94eeea --- /dev/null +++ b/node_modules/micromark-factory-label/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-label/index.js b/node_modules/micromark-factory-label/index.js new file mode 100644 index 00000000..269340bb --- /dev/null +++ b/node_modules/micromark-factory-label/index.js @@ -0,0 +1,148 @@ +/** + * @import { + * Effects, + * State, + * TokenizeContext, + * TokenType + * } from 'micromark-util-types' + */ + +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(effects, ok, nok, type, markerType, stringType) { + const self = this; + let size = 0; + /** @type {boolean} */ + let seen; + return start; + + /** + * Start of label. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.enter(stringType); + return atBreak; + } + + /** + * In label, at something, before something else. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (size > 999 || code === null || code === 91 || code === 93 && !seen || + // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) { + return nok(code); + } + if (code === 93) { + effects.exit(stringType); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.exit(type); + return ok; + } + + // To do: indent? Link chunks and EOLs together? + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return atBreak; + } + effects.enter("chunkString", { + contentType: "string" + }); + return labelInside(code); + } + + /** + * In label, in text. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) { + effects.exit("chunkString"); + return atBreak(code); + } + effects.consume(code); + if (!seen) seen = !markdownSpace(code); + return code === 92 ? labelEscape : labelInside; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | [a\*a] + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code); + size++; + return labelInside; + } + return labelInside(code); + } +} \ No newline at end of file diff --git a/node_modules/micromark-factory-label/license b/node_modules/micromark-factory-label/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-factory-label/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-factory-label/package.json b/node_modules/micromark-factory-label/package.json new file mode 100644 index 00000000..db6dca26 --- /dev/null +++ b/node_modules/micromark-factory-label/package.json @@ -0,0 +1,60 @@ +{ + "name": "micromark-factory-label", + "version": "2.0.1", + "description": "micromark factory to parse labels (found in media, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "label" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-label", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-params": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-factory-label/readme.md b/node_modules/micromark-factory-label/readme.md new file mode 100644 index 00000000..f4b4eab8 --- /dev/null +++ b/node_modules/micromark-factory-label/readme.md @@ -0,0 +1,224 @@ +# micromark-factory-label + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse labels (found in media, definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryLabel(…)`](#factorylabel) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse labels. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-label +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1?bundle' +</script> +``` + +## Use + +```js +import {ok as assert} from 'devlop' +import {factoryLabel} from 'micromark-factory-label' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.definition) + return factoryLabel.call( + self, + effects, + labelAfter, + nok, + types.definitionLabel, + types.definitionLabelMarker, + types.definitionLabelString + )(code) + } + + // … +} +``` + +## API + +This module exports the identifier [`factoryLabel`][api-factory-label]. +There is no default export. + +### `factoryLabel(…)` + +Parse labels. + +> 👉 **Note**: labels in markdown are capped at 999 characters in the string. + +###### Examples + +```markdown +[a] +[a +b] +[a\]b] +``` + +###### Parameters + +* `this` (`TokenizeContext`) + — tokenize context +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type of the whole label (`[a]`) +* `markerType` (`string`) + — type for the markers (`[` and `]`) +* `stringType` (`string`) + — type for the identifier (`a`) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-label@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-label.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-label + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-label + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-label + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-label]: #factorylabel diff --git a/node_modules/micromark-factory-space/dev/index.d.ts b/node_modules/micromark-factory-space/dev/index.d.ts new file mode 100644 index 00000000..d9a30cab --- /dev/null +++ b/node_modules/micromark-factory-space/dev/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-space/dev/index.d.ts.map b/node_modules/micromark-factory-space/dev/index.d.ts.map new file mode 100644 index 00000000..42d12792 --- /dev/null +++ b/node_modules/micromark-factory-space/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-space/dev/index.js b/node_modules/micromark-factory-space/dev/index.js new file mode 100644 index 00000000..5cead758 --- /dev/null +++ b/node_modules/micromark-factory-space/dev/index.js @@ -0,0 +1,67 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import {markdownSpace} from 'micromark-util-character' + +// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`. + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects, ok, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY + let size = 0 + + return start + + /** @type {State} */ + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + /** @type {State} */ + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} diff --git a/node_modules/micromark-factory-space/index.d.ts b/node_modules/micromark-factory-space/index.d.ts new file mode 100644 index 00000000..d9a30cab --- /dev/null +++ b/node_modules/micromark-factory-space/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-space/index.d.ts.map b/node_modules/micromark-factory-space/index.d.ts.map new file mode 100644 index 00000000..42d12792 --- /dev/null +++ b/node_modules/micromark-factory-space/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-space/index.js b/node_modules/micromark-factory-space/index.js new file mode 100644 index 00000000..646117df --- /dev/null +++ b/node_modules/micromark-factory-space/index.js @@ -0,0 +1,64 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { markdownSpace } from 'micromark-util-character'; + +// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`. + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects, ok, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY; + let size = 0; + return start; + + /** @type {State} */ + function start(code) { + if (markdownSpace(code)) { + effects.enter(type); + return prefix(code); + } + return ok(code); + } + + /** @type {State} */ + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code); + return prefix; + } + effects.exit(type); + return ok(code); + } +} \ No newline at end of file diff --git a/node_modules/micromark-factory-space/license b/node_modules/micromark-factory-space/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-factory-space/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-factory-space/package.json b/node_modules/micromark-factory-space/package.json new file mode 100644 index 00000000..45828c49 --- /dev/null +++ b/node_modules/micromark-factory-space/package.json @@ -0,0 +1,55 @@ +{ + "name": "micromark-factory-space", + "version": "2.0.1", + "description": "micromark factory to parse markdown space (found in lots of places)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "space" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-factory-space/readme.md b/node_modules/micromark-factory-space/readme.md new file mode 100644 index 00000000..b9c01776 --- /dev/null +++ b/node_modules/micromark-factory-space/readme.md @@ -0,0 +1,225 @@ +# micromark-factory-space + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse [markdown space][markdown-space] (found in lots +of places). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factorySpace(…)`](#factoryspace) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse spaces and/or tabs. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-space +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factorySpace} from 'https://esm.sh/micromark-factory-space@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factorySpace} from 'https://esm.sh/micromark-factory-space@1?bundle' +</script> +``` + +## Use + +```js +import {factorySpace} from 'micromark-factory-space' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeFenced(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function info(code) { + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return factorySpace(effects, infoAfter, types.whitespace)(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return info + } + + // … +} +``` + +## API + +This module exports the identifier [`factorySpace`][api-factory-space]. +There is no default export. + +### `factorySpace(…)` + +Parse spaces and tabs. + +There is no `nok` parameter: + +* spaces in markdown are often optional, in which case this factory can be + used and `ok` will be switched to whether spaces were found or not +* one line ending or space can be detected with `markdownSpace(code)` right + before using `factorySpace` + +###### Examples + +Where `␉` represents a tab (plus how much it expands) and `␠` represents a +single space. + +```markdown +␉ +␠␠␠␠ +␉␠ +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `type` (`string`) + — type (`' \t'`) +* `max` (`number`, default: `Infinity`) + — max (exclusive) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-space@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-space + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-space + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-space]: #factoryspace diff --git a/node_modules/micromark-factory-title/dev/index.d.ts b/node_modules/micromark-factory-title/dev/index.d.ts new file mode 100644 index 00000000..6d4b4be2 --- /dev/null +++ b/node_modules/micromark-factory-title/dev/index.d.ts @@ -0,0 +1,36 @@ +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-title/dev/index.d.ts.map b/node_modules/micromark-factory-title/dev/index.d.ts.map new file mode 100644 index 00000000..0108e7c9 --- /dev/null +++ b/node_modules/micromark-factory-title/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-title/dev/index.js b/node_modules/micromark-factory-title/dev/index.js new file mode 100644 index 00000000..4774214c --- /dev/null +++ b/node_modules/micromark-factory-title/dev/index.js @@ -0,0 +1,169 @@ +/** + * @import { + * Code, + * Effects, + * State, + * TokenType + * } from 'micromark-util-types' + */ + +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects, ok, nok, type, markerType, stringType) { + /** @type {NonNullable<Code>} */ + let marker + + return start + + /** + * Start of title. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === codes.leftParenthesis ? codes.rightParenthesis : code + return begin + } + + return nok(code) + } + + /** + * After opening marker. + * + * This is also used at the closing marker. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function begin(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atBreak(code) + } + + /** + * At something, before something else. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.exit(stringType) + return begin(marker) + } + + if (code === codes.eof) { + return nok(code) + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + // To do: use `space_or_tab_eol_with_options`, connect. + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, atBreak, types.linePrefix) + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return inside(code) + } + + /** + * + * + * @type {State} + */ + function inside(code) { + if (code === marker || code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? escape : inside + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | "a\*b" + * ^ + * ``` + * + * @type {State} + */ + function escape(code) { + if (code === marker || code === codes.backslash) { + effects.consume(code) + return inside + } + + return inside(code) + } +} diff --git a/node_modules/micromark-factory-title/index.d.ts b/node_modules/micromark-factory-title/index.d.ts new file mode 100644 index 00000000..6d4b4be2 --- /dev/null +++ b/node_modules/micromark-factory-title/index.d.ts @@ -0,0 +1,36 @@ +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-title/index.d.ts.map b/node_modules/micromark-factory-title/index.d.ts.map new file mode 100644 index 00000000..0108e7c9 --- /dev/null +++ b/node_modules/micromark-factory-title/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-title/index.js b/node_modules/micromark-factory-title/index.js new file mode 100644 index 00000000..02c8026c --- /dev/null +++ b/node_modules/micromark-factory-title/index.js @@ -0,0 +1,158 @@ +/** + * @import { + * Code, + * Effects, + * State, + * TokenType + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects, ok, nok, type, markerType, stringType) { + /** @type {NonNullable<Code>} */ + let marker; + return start; + + /** + * Start of title. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === 34 || code === 39 || code === 40) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + marker = code === 40 ? 41 : code; + return begin; + } + return nok(code); + } + + /** + * After opening marker. + * + * This is also used at the closing marker. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function begin(code) { + if (code === marker) { + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.exit(type); + return ok; + } + effects.enter(stringType); + return atBreak(code); + } + + /** + * At something, before something else. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.exit(stringType); + return begin(marker); + } + if (code === null) { + return nok(code); + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + // To do: use `space_or_tab_eol_with_options`, connect. + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return factorySpace(effects, atBreak, "linePrefix"); + } + effects.enter("chunkString", { + contentType: "string" + }); + return inside(code); + } + + /** + * + * + * @type {State} + */ + function inside(code) { + if (code === marker || code === null || markdownLineEnding(code)) { + effects.exit("chunkString"); + return atBreak(code); + } + effects.consume(code); + return code === 92 ? escape : inside; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | "a\*b" + * ^ + * ``` + * + * @type {State} + */ + function escape(code) { + if (code === marker || code === 92) { + effects.consume(code); + return inside; + } + return inside(code); + } +} \ No newline at end of file diff --git a/node_modules/micromark-factory-title/license b/node_modules/micromark-factory-title/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-factory-title/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-factory-title/package.json b/node_modules/micromark-factory-title/package.json new file mode 100644 index 00000000..f643a5de --- /dev/null +++ b/node_modules/micromark-factory-title/package.json @@ -0,0 +1,58 @@ +{ + "name": "micromark-factory-title", + "version": "2.0.1", + "description": "micromark factory to parse markdown titles (found in resources, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "title" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-title", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-params": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-factory-title/readme.md b/node_modules/micromark-factory-title/readme.md new file mode 100644 index 00000000..ff51cbde --- /dev/null +++ b/node_modules/micromark-factory-title/readme.md @@ -0,0 +1,229 @@ +# micromark-factory-title + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse markdown titles (found in resources, +definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryTitle(…)`](#factorytitle) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse titles. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-title +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factorySpace} from 'https://esm.sh/micromark-factory-title@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factorySpace} from 'https://esm.sh/micromark-factory-title@1?bundle' +</script> +``` + +## Use + +```js +import {factoryTitle} from 'micromark-factory-title' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function before(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return factoryTitle( + effects, + factorySpace(effects, after, types.whitespace), + nok, + types.definitionTitle, + types.definitionTitleMarker, + types.definitionTitleString + )(code) + } + + return nok(code) + } + + // … +} +``` + +## API + +This module exports the identifier [`factoryTitle`][api-factory-title]. +There is no default export. + +### `factoryTitle(…)` + +Parse titles. + +###### Examples + +```markdown +"a" +'b' +(c) +"a +b" +'a + b' +(a\)b) +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type of the whole title (`"a"`, `'b'`, `(c)`) +* `markerType` (`string`) + — type for the markers (`"`, `'`, `(`, and `)`) +* `stringType` (`string`) + — type for the value (`a`) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-title@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-title.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-title + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-title + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-title + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-title]: #factorytitle diff --git a/node_modules/micromark-factory-whitespace/dev/index.d.ts b/node_modules/micromark-factory-whitespace/dev/index.d.ts new file mode 100644 index 00000000..52ca4b85 --- /dev/null +++ b/node_modules/micromark-factory-whitespace/dev/index.d.ts @@ -0,0 +1,22 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects: Effects, ok: State): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-whitespace/dev/index.d.ts.map b/node_modules/micromark-factory-whitespace/dev/index.d.ts.map new file mode 100644 index 00000000..5169dc46 --- /dev/null +++ b/node_modules/micromark-factory-whitespace/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-whitespace/dev/index.js b/node_modules/micromark-factory-whitespace/dev/index.js new file mode 100644 index 00000000..3aa9e37b --- /dev/null +++ b/node_modules/micromark-factory-whitespace/dev/index.js @@ -0,0 +1,53 @@ +/** + * @import {Effects, State} from 'micromark-util-types' + */ + +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {types} from 'micromark-util-symbol' + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects, ok) { + /** @type {boolean} */ + let seen + + return start + + /** @type {State} */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + seen = true + return start + } + + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? types.linePrefix : types.lineSuffix + )(code) + } + + return ok(code) + } +} diff --git a/node_modules/micromark-factory-whitespace/index.d.ts b/node_modules/micromark-factory-whitespace/index.d.ts new file mode 100644 index 00000000..52ca4b85 --- /dev/null +++ b/node_modules/micromark-factory-whitespace/index.d.ts @@ -0,0 +1,22 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects: Effects, ok: State): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-factory-whitespace/index.d.ts.map b/node_modules/micromark-factory-whitespace/index.d.ts.map new file mode 100644 index 00000000..5169dc46 --- /dev/null +++ b/node_modules/micromark-factory-whitespace/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-factory-whitespace/index.js b/node_modules/micromark-factory-whitespace/index.js new file mode 100644 index 00000000..02243add --- /dev/null +++ b/node_modules/micromark-factory-whitespace/index.js @@ -0,0 +1,44 @@ +/** + * @import {Effects, State} from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects, ok) { + /** @type {boolean} */ + let seen; + return start; + + /** @type {State} */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + seen = true; + return start; + } + if (markdownSpace(code)) { + return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code); + } + return ok(code); + } +} \ No newline at end of file diff --git a/node_modules/micromark-factory-whitespace/license b/node_modules/micromark-factory-whitespace/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-factory-whitespace/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-factory-whitespace/package.json b/node_modules/micromark-factory-whitespace/package.json new file mode 100644 index 00000000..ce733bd0 --- /dev/null +++ b/node_modules/micromark-factory-whitespace/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-factory-whitespace", + "version": "2.0.1", + "description": "micromark factory to parse markdown whitespace (found in lots of places)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "whitespace" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-whitespace", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-factory-whitespace/readme.md b/node_modules/micromark-factory-whitespace/readme.md new file mode 100644 index 00000000..a846406a --- /dev/null +++ b/node_modules/micromark-factory-whitespace/readme.md @@ -0,0 +1,205 @@ +# micromark-factory-whitespace + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse [markdown line endings or spaces][ws] (found in +lots of places). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryWhitespace(…)`](#factorywhitespace) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse whitespace. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-whitespace +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1?bundle' +</script> +``` + +## Use + +```js +import {factoryWhitespace} from 'micromark-factory-whitespace' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeTitle(effects, ok, nok) { + return start + + /** @type {State} */ + function start(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) + : nok(code) + } + + // … +} +``` + +## API + +This module exports the identifier +[`factoryWhitespace`][api-factory-whitespace]. +There is no default export. + +### `factoryWhitespace(…)` + +Parse spaces and tabs. + +There is no `nok` parameter: + +* line endings or spaces in markdown are often optional, in which case this + factory can be used and `ok` will be switched to whether spaces were found + or not +* one line ending or space can be detected with + [`markdownLineEndingOrSpace(code)`][ws] right before using + `factoryWhitespace` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-whitespace@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-whitespace.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-whitespace + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-whitespace + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-whitespace + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[ws]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownlineendingorspacecode + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-whitespace]: #factorywhitespace diff --git a/node_modules/micromark-util-character/dev/index.d.ts b/node_modules/micromark-util-character/dev/index.d.ts new file mode 100644 index 00000000..fe528957 --- /dev/null +++ b/node_modules/micromark-util-character/dev/index.d.ts @@ -0,0 +1,195 @@ +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code: Code): boolean; +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code: Code): boolean; +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit: (code: Code) => boolean; +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace: (code: Code) => boolean; +import type { Code } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-character/dev/index.d.ts.map b/node_modules/micromark-util-character/dev/index.d.ts.map new file mode 100644 index 00000000..8ded3c15 --- /dev/null +++ b/node_modules/micromark-util-character/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,mCALW,IAAI,GAEF,OAAO,CASnB;AAkDD;;;;;;;;;;;;;;GAcG;AACH,yCALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;GAQG;AACH,gDALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,oCALW,IAAI,GAEF,OAAO,CASnB;AAhLD;;;;;;;;;;;;;;;;GAgBG;AACH,gCAmNoB,IAAI,KAAK,OAAO,CAnNY;AAEhD;;;;;;;;;;;GAWG;AACH,uCAqMoB,IAAI,KAAK,OAAO,CArMqB;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCA8KoB,IAAI,KAAK,OAAO,CA9KuB;AAqB3D;;;;;;;;;;GAUG;AACH,gCA8IoB,IAAI,KAAK,OAAO,CA9IM;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,mCA0HoB,IAAI,KAAK,OAAO,CA1HiB;AAErD;;;;;;;;;;;;GAYG;AACH,sCA2GoB,IAAI,KAAK,OAAO,CA3GwB;AA2D5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCA6BoB,IAAI,KAAK,OAAO,CA7BwB;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAOoB,IAAI,KAAK,OAAO,CAPa;0BAlO1B,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-character/dev/index.js b/node_modules/micromark-util-character/dev/index.js new file mode 100644 index 00000000..123745e8 --- /dev/null +++ b/node_modules/micromark-util-character/dev/index.js @@ -0,0 +1,252 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import {codes} from 'micromark-util-symbol' + +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha = regexCheck(/[A-Za-z]/) + +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) + +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) + +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code !== null && (code < codes.space || code === codes.del) + ) +} + +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit = regexCheck(/\d/) + +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/) + +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) + +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code) { + return code !== null && code < codes.horizontalTab +} + +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code) { + return code !== null && (code < codes.nul || code === codes.space) +} + +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code) { + return ( + code === codes.horizontalTab || + code === codes.virtualSpace || + code === codes.space + ) +} + +// Size note: removing ASCII from the regex and using `asciiPunctuation` here +// In fact adds to the bundle size. +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u) + +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace = regexCheck(/\s/) + +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * Expression. + * @returns {(code: Code) => boolean} + * Check. + */ +function regexCheck(regex) { + return check + + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code + * Character code. + * @returns {boolean} + * Whether the character code matches the bound regex. + */ + function check(code) { + return code !== null && code > -1 && regex.test(String.fromCharCode(code)) + } +} diff --git a/node_modules/micromark-util-character/index.d.ts b/node_modules/micromark-util-character/index.d.ts new file mode 100644 index 00000000..fe528957 --- /dev/null +++ b/node_modules/micromark-util-character/index.d.ts @@ -0,0 +1,195 @@ +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code: Code): boolean; +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code: Code): boolean; +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit: (code: Code) => boolean; +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace: (code: Code) => boolean; +import type { Code } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-character/index.d.ts.map b/node_modules/micromark-util-character/index.d.ts.map new file mode 100644 index 00000000..8ded3c15 --- /dev/null +++ b/node_modules/micromark-util-character/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,mCALW,IAAI,GAEF,OAAO,CASnB;AAkDD;;;;;;;;;;;;;;GAcG;AACH,yCALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;GAQG;AACH,gDALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,oCALW,IAAI,GAEF,OAAO,CASnB;AAhLD;;;;;;;;;;;;;;;;GAgBG;AACH,gCAmNoB,IAAI,KAAK,OAAO,CAnNY;AAEhD;;;;;;;;;;;GAWG;AACH,uCAqMoB,IAAI,KAAK,OAAO,CArMqB;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCA8KoB,IAAI,KAAK,OAAO,CA9KuB;AAqB3D;;;;;;;;;;GAUG;AACH,gCA8IoB,IAAI,KAAK,OAAO,CA9IM;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,mCA0HoB,IAAI,KAAK,OAAO,CA1HiB;AAErD;;;;;;;;;;;;GAYG;AACH,sCA2GoB,IAAI,KAAK,OAAO,CA3GwB;AA2D5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCA6BoB,IAAI,KAAK,OAAO,CA7BwB;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAOoB,IAAI,KAAK,OAAO,CAPa;0BAlO1B,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-character/index.js b/node_modules/micromark-util-character/index.js new file mode 100644 index 00000000..13698f04 --- /dev/null +++ b/node_modules/micromark-util-character/index.js @@ -0,0 +1,246 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha = regexCheck(/[A-Za-z]/); + +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); + +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); + +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code !== null && (code < 32 || code === 127) + ); +} + +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit = regexCheck(/\d/); + +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/); + +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); + +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code) { + return code !== null && code < -2; +} + +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code) { + return code !== null && (code < 0 || code === 32); +} + +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code) { + return code === -2 || code === -1 || code === 32; +} + +// Size note: removing ASCII from the regex and using `asciiPunctuation` here +// In fact adds to the bundle size. +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u); + +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace = regexCheck(/\s/); + +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * Expression. + * @returns {(code: Code) => boolean} + * Check. + */ +function regexCheck(regex) { + return check; + + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code + * Character code. + * @returns {boolean} + * Whether the character code matches the bound regex. + */ + function check(code) { + return code !== null && code > -1 && regex.test(String.fromCharCode(code)); + } +} \ No newline at end of file diff --git a/node_modules/micromark-util-character/license b/node_modules/micromark-util-character/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-character/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-character/package.json b/node_modules/micromark-util-character/package.json new file mode 100644 index 00000000..8af57e39 --- /dev/null +++ b/node_modules/micromark-util-character/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-util-character", + "version": "2.1.1", + "description": "micromark utility to handle character codes", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "character" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-character", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-character/readme.md b/node_modules/micromark-util-character/readme.md new file mode 100644 index 00000000..2356e472 --- /dev/null +++ b/node_modules/micromark-util-character/readme.md @@ -0,0 +1,446 @@ +# micromark-util-character + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to handle [character codes][code]. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`asciiAlpha(code)`](#asciialphacode) + * [`asciiAlphanumeric(code)`](#asciialphanumericcode) + * [`asciiAtext(code)`](#asciiatextcode) + * [`asciiControl(code)`](#asciicontrolcode) + * [`asciiDigit(code)`](#asciidigitcode) + * [`asciiHexDigit(code)`](#asciihexdigitcode) + * [`asciiPunctuation(code)`](#asciipunctuationcode) + * [`markdownLineEnding(code)`](#markdownlineendingcode) + * [`markdownLineEndingOrSpace(code)`](#markdownlineendingorspacecode) + * [`markdownSpace(code)`](#markdownspacecode) + * [`unicodePunctuation(code)`](#unicodepunctuationcode) + * [`unicodeWhitespace(code)`](#unicodewhitespacecode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes algorithms to check whether characters match groups. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-character +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as character from 'https://esm.sh/micromark-util-character@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import * as character from 'https://esm.sh/micromark-util-character@1?bundle' +</script> +``` + +## Use + +```js +import {asciiAlpha} from 'micromark-util-character' + +console.log(asciiAlpha(64)) // false +console.log(asciiAlpha(65)) // true +``` + +## API + +This module exports the identifiers +[`asciiAlpha`][api-ascii-alpha], +[`asciiAlphanumeric`][api-ascii-alphanumeric], +[`asciiAtext`][api-ascii-atext], +[`asciiControl`][api-ascii-control], +[`asciiDigit`][api-ascii-digit], +[`asciiHexDigit`][api-ascii-hex-digit], +[`asciiPunctuation`][api-ascii-punctuation], +[`markdownLineEnding`][api-markdown-line-ending], +[`markdownLineEndingOrSpace`][api-markdown-line-ending-or-space], +[`markdownSpace`][api-markdown-space], +[`unicodePunctuation`][api-unicode-punctuation], +[`unicodeWhitespace`][api-unicode-whitespace]. +There is no default export. + +### `asciiAlpha(code)` + +Check whether the [character code][code] represents an ASCII alpha (`a` through +`z`, case insensitive). + +An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + +An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) +to U+005A (`Z`). + +An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) +to U+007A (`z`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiAlphanumeric(code)` + +Check whether the [character code][code] represents an ASCII alphanumeric (`a` +through `z`, case insensitive, or `0` through `9`). + +An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha +(see `asciiAlpha`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiAtext(code)` + +Check whether the [character code][code] represents an ASCII atext. + +atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in +the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), +U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F +SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E +CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE +(`{`) to U+007E TILDE (`~`) (**\[RFC5322]**). + +See **\[RFC5322]**:\ +[Internet Message Format](https://tools.ietf.org/html/rfc5322).\ +P. Resnick.\ +IETF. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiControl(code)` + +Check whether a [character code][code] is an ASCII control character. + +An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) +to U+001F (US), or U+007F (DEL). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiDigit(code)` + +Check whether the [character code][code] represents an ASCII digit (`0` through +`9`). + +An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to +U+0039 (`9`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiHexDigit(code)` + +Check whether the [character code][code] represents an ASCII hex digit (`a` +through `f`, case insensitive, or `0` through `9`). + +An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex +digit, or an ASCII lower hex digit. + +An **ASCII upper hex digit** is a character in the inclusive range U+0041 +(`A`) to U+0046 (`F`). + +An **ASCII lower hex digit** is a character in the inclusive range U+0061 +(`a`) to U+0066 (`f`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiPunctuation(code)` + +Check whether the [character code][code] represents ASCII punctuation. + +An **ASCII punctuation** is a character in the inclusive ranges U+0021 +EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT +SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT +(`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownLineEnding(code)` + +Check whether a [character code][code] is a markdown line ending. + +A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN +LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + +In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE +RETURN (CR) are replaced by these virtual characters depending on whether +they occurred together. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownLineEndingOrSpace(code)` + +Check whether a [character code][code] is a markdown line ending (see +`markdownLineEnding`) or markdown space (see `markdownSpace`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownSpace(code)` + +Check whether a [character code][code] is a markdown space. + +A **markdown space** is the concrete character U+0020 SPACE (SP) and the +virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + +In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is +replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL +SPACE (VS) characters, depending on the column at which the tab occurred. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `unicodePunctuation(code)` + +Check whether the [character code][code] represents Unicode punctuation. + +A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, +Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` +(Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` +(Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII +punctuation (see `asciiPunctuation`) (**\[UNICODE]**). + +See **\[UNICODE]**:\ +[The Unicode Standard](https://www.unicode.org/versions/).\ +Unicode Consortium. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `unicodeWhitespace(code)` + +Check whether the [character code][code] represents Unicode whitespace. + +Note that this does handle micromark specific markdown whitespace characters. +See `markdownLineEndingOrSpace` to check that. + +A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, +Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), +U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + +See **\[UNICODE]**:\ +[The Unicode Standard](https://www.unicode.org/versions/).\ +Unicode Consortium. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-character@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-character.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-character + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-character + +[bundle-size]: https://bundlejs.com/?q=micromark-util-character + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[code]: https://github.com/micromark/micromark#preprocess + +[api-ascii-alpha]: #asciialphacode + +[api-ascii-alphanumeric]: #asciialphanumericcode + +[api-ascii-atext]: #asciiatextcode + +[api-ascii-control]: #asciicontrolcode + +[api-ascii-digit]: #asciidigitcode + +[api-ascii-hex-digit]: #asciihexdigitcode + +[api-ascii-punctuation]: #asciipunctuationcode + +[api-markdown-line-ending]: #markdownlineendingcode + +[api-markdown-line-ending-or-space]: #markdownlineendingorspacecode + +[api-markdown-space]: #markdownspacecode + +[api-unicode-punctuation]: #unicodepunctuationcode + +[api-unicode-whitespace]: #unicodewhitespacecode diff --git a/node_modules/micromark-util-chunked/dev/index.d.ts b/node_modules/micromark-util-chunked/dev/index.d.ts new file mode 100644 index 00000000..ed04ba20 --- /dev/null +++ b/node_modules/micromark-util-chunked/dev/index.d.ts @@ -0,0 +1,41 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice<T extends unknown>(list: Array<T>, start: number, remove: number, items: Array<T>): undefined; +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push<T extends unknown>(list: Array<T>, items: Array<T>): Array<T>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-chunked/dev/index.d.ts.map b/node_modules/micromark-util-chunked/dev/index.d.ts.map new file mode 100644 index 00000000..43212539 --- /dev/null +++ b/node_modules/micromark-util-chunked/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,uBAbuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,MAAM,UAEN,MAAM,SAEN,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CA0CrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBATuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,KAAK,CAAC,CAAC,CAAC,GAEN,KAAK,CAAC,CAAC,CAAC,CAUpB"} \ No newline at end of file diff --git a/node_modules/micromark-util-chunked/dev/index.js b/node_modules/micromark-util-chunked/dev/index.js new file mode 100644 index 00000000..7b6a18f8 --- /dev/null +++ b/node_modules/micromark-util-chunked/dev/index.js @@ -0,0 +1,89 @@ +import {constants} from 'micromark-util-symbol' + +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice(list, start, remove, items) { + const end = list.length + let chunkStart = 0 + /** @type {Array<unknown>} */ + let parameters + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < constants.v8MaxSafeChunkSize) { + parameters = Array.from(items) + parameters.unshift(start, remove) + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) list.splice(start, remove) + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice( + chunkStart, + chunkStart + constants.v8MaxSafeChunkSize + ) + parameters.unshift(start, 0) + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters) + + chunkStart += constants.v8MaxSafeChunkSize + start += constants.v8MaxSafeChunkSize + } + } +} + +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push(list, items) { + if (list.length > 0) { + splice(list, list.length, 0, items) + return list + } + + return items +} diff --git a/node_modules/micromark-util-chunked/index.d.ts b/node_modules/micromark-util-chunked/index.d.ts new file mode 100644 index 00000000..ed04ba20 --- /dev/null +++ b/node_modules/micromark-util-chunked/index.d.ts @@ -0,0 +1,41 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice<T extends unknown>(list: Array<T>, start: number, remove: number, items: Array<T>): undefined; +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push<T extends unknown>(list: Array<T>, items: Array<T>): Array<T>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-chunked/index.d.ts.map b/node_modules/micromark-util-chunked/index.d.ts.map new file mode 100644 index 00000000..43212539 --- /dev/null +++ b/node_modules/micromark-util-chunked/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,uBAbuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,MAAM,UAEN,MAAM,SAEN,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CA0CrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBATuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,KAAK,CAAC,CAAC,CAAC,GAEN,KAAK,CAAC,CAAC,CAAC,CAUpB"} \ No newline at end of file diff --git a/node_modules/micromark-util-chunked/index.js b/node_modules/micromark-util-chunked/index.js new file mode 100644 index 00000000..3a4b2624 --- /dev/null +++ b/node_modules/micromark-util-chunked/index.js @@ -0,0 +1,81 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice(list, start, remove, items) { + const end = list.length; + let chunkStart = 0; + /** @type {Array<unknown>} */ + let parameters; + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start; + } else { + start = start > end ? end : start; + } + remove = remove > 0 ? remove : 0; + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < 10000) { + parameters = Array.from(items); + parameters.unshift(start, remove); + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters); + } else { + // Delete `remove` items starting from `start` + if (remove) list.splice(start, remove); + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000); + parameters.unshift(start, 0); + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters); + chunkStart += 10000; + start += 10000; + } + } +} + +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push(list, items) { + if (list.length > 0) { + splice(list, list.length, 0, items); + return list; + } + return items; +} \ No newline at end of file diff --git a/node_modules/micromark-util-chunked/license b/node_modules/micromark-util-chunked/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-chunked/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-chunked/package.json b/node_modules/micromark-util-chunked/package.json new file mode 100644 index 00000000..8a5c91d3 --- /dev/null +++ b/node_modules/micromark-util-chunked/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-util-chunked", + "version": "2.0.1", + "description": "micromark utility to splice and push with giant arrays", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "chunk", + "splice", + "push" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-chunked", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-chunked/readme.md b/node_modules/micromark-util-chunked/readme.md new file mode 100644 index 00000000..6628fad7 --- /dev/null +++ b/node_modules/micromark-util-chunked/readme.md @@ -0,0 +1,219 @@ +# micromark-util-chunked + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to splice and push with giant arrays. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`push(list, items)`](#pushlist-items) + * [`splice(list, start, remove, items)`](#splicelist-start-remove-items) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to splice for giant arrays, which V8 bugs +out on. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-chunked +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {push, splice} from 'https://esm.sh/micromark-util-chunked@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {push, splice} from 'https://esm.sh/micromark-util-chunked@1?bundle' +</script> +``` + +## Use + +```js +import {push, splice} from 'micromark-util-chunked' + +// … + +nextEvents = push(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] +]) + +// … + +splice(events, open - 1, index - open + 3, nextEvents) + +// … +``` + +## API + +This module exports the identifiers [`push`][api-push] +and [`splice`][api-splice]. +There is no default export. + +### `push(list, items)` + +Append `items` (an array) at the end of `list` (another array). +When `list` was empty, returns `items` instead. + +This prevents a potentially expensive operation when `list` is empty, +and adds items in batches to prevent V8 from hanging. + +###### Parameters + +* `list` (`Array<unknown>`) + — list to operate on +* `items` (`Array<unknown>`) + — items to add to `list` + +###### Returns + +Either `list` or `items` (`Array<unknown>`). + +### `splice(list, start, remove, items)` + +Like `Array#splice`, but smarter for giant arrays. + +`Array#splice` takes all items to be inserted as individual argument which +causes a stack overflow in V8 when trying to insert 100k items for instance. + +Otherwise, this does not return the removed items, and takes `items` as an +array instead of rest parameters. + +###### Parameters + +* `list` (`Array<unknown>`) + — list to operate on +* `start` (`number`) + — index to remove/insert at (can be negative) +* `remove` (`number`) + — number of items to remove +* `items` (`Array<unknown>`) + — items to inject into `list` + +###### Returns + +Nothing (`undefined`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-chunked@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-chunked.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-chunked + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-chunked + +[bundle-size]: https://bundlejs.com/?q=micromark-util-chunked + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-push]: #pushlist-items + +[api-splice]: #splicelist-start-remove-items diff --git a/node_modules/micromark-util-classify-character/dev/index.d.ts b/node_modules/micromark-util-classify-character/dev/index.d.ts new file mode 100644 index 00000000..db98cd1f --- /dev/null +++ b/node_modules/micromark-util-classify-character/dev/index.d.ts @@ -0,0 +1,18 @@ +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined; +import type { Code } from 'micromark-util-types'; +import { constants } from 'micromark-util-symbol'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-classify-character/dev/index.d.ts.map b/node_modules/micromark-util-classify-character/dev/index.d.ts.map new file mode 100644 index 00000000..9b63a5be --- /dev/null +++ b/node_modules/micromark-util-classify-character/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,wCALW,IAAI,GAEF,OAAO,SAAS,CAAC,wBAAwB,GAAG,OAAO,SAAS,CAAC,yBAAyB,GAAG,SAAS,CAe9G;0BApCsB,sBAAsB;0BAQd,uBAAuB"} \ No newline at end of file diff --git a/node_modules/micromark-util-classify-character/dev/index.js b/node_modules/micromark-util-classify-character/dev/index.js new file mode 100644 index 00000000..0d824745 --- /dev/null +++ b/node_modules/micromark-util-classify-character/dev/index.js @@ -0,0 +1,38 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import { + markdownLineEndingOrSpace, + unicodePunctuation, + unicodeWhitespace +} from 'micromark-util-character' +import {codes, constants} from 'micromark-util-symbol' + +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code) { + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return constants.characterGroupWhitespace + } + + if (unicodePunctuation(code)) { + return constants.characterGroupPunctuation + } +} diff --git a/node_modules/micromark-util-classify-character/index.d.ts b/node_modules/micromark-util-classify-character/index.d.ts new file mode 100644 index 00000000..db98cd1f --- /dev/null +++ b/node_modules/micromark-util-classify-character/index.d.ts @@ -0,0 +1,18 @@ +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined; +import type { Code } from 'micromark-util-types'; +import { constants } from 'micromark-util-symbol'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-classify-character/index.d.ts.map b/node_modules/micromark-util-classify-character/index.d.ts.map new file mode 100644 index 00000000..9b63a5be --- /dev/null +++ b/node_modules/micromark-util-classify-character/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,wCALW,IAAI,GAEF,OAAO,SAAS,CAAC,wBAAwB,GAAG,OAAO,SAAS,CAAC,yBAAyB,GAAG,SAAS,CAe9G;0BApCsB,sBAAsB;0BAQd,uBAAuB"} \ No newline at end of file diff --git a/node_modules/micromark-util-classify-character/index.js b/node_modules/micromark-util-classify-character/index.js new file mode 100644 index 00000000..a9aebc6c --- /dev/null +++ b/node_modules/micromark-util-classify-character/index.js @@ -0,0 +1,27 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character'; +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code) { + if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { + return 1; + } + if (unicodePunctuation(code)) { + return 2; + } +} \ No newline at end of file diff --git a/node_modules/micromark-util-classify-character/license b/node_modules/micromark-util-classify-character/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-classify-character/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-classify-character/package.json b/node_modules/micromark-util-classify-character/package.json new file mode 100644 index 00000000..f424ff97 --- /dev/null +++ b/node_modules/micromark-util-classify-character/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-classify-character", + "version": "2.0.1", + "description": "micromark utility to classify whether a character is whitespace or punctuation", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "attention", + "classify", + "character" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-classify-character", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-classify-character/readme.md b/node_modules/micromark-util-classify-character/readme.md new file mode 100644 index 00000000..f0b3ee78 --- /dev/null +++ b/node_modules/micromark-util-classify-character/readme.md @@ -0,0 +1,205 @@ +# micromark-util-classify-character + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to classify whether a character is whitespace or +punctuation. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`classifyCharacter(code)`](#classifycharactercode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to classify characters into 3 categories. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-classify-character +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {classifyCharacter} from 'https://esm.sh/micromark-util-classify-character@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {classifyCharacter} from 'https://esm.sh/micromark-util-classify-character@1?bundle' +</script> +``` + +## Use + +```js +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAttention(effects, ok) { + return start + + // … + + /** @type {State} */ + function sequence(code) { + if (code === marker) { + // … + } + + const token = effects.exit('attentionSequence') + const after = classifyCharacter(code) + const open = + !after || (after === constants.characterGroupPunctuation && before) + const close = + !before || (before === constants.characterGroupPunctuation && after) + // … + } + + // … +} +``` + +## API + +This module exports the identifier +[`classifyCharacter`][api-classify-character]. +There is no default export. + +### `classifyCharacter(code)` + +Classify whether a code represents whitespace, punctuation, or something +else. + +Used for attention (emphasis, strong), whose sequences can open or close +based on the class of surrounding characters. + +> 👉 **Note**: eof (`null`) is seen as whitespace. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Group (`constants.characterGroupWhitespace`, +`constants.characterGroupPunctuation`, or `undefined`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-classify-character@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-classify-character.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-classify-character + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-classify-character + +[bundle-size]: https://bundlejs.com/?q=micromark-util-classify-character + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-classify-character]: #classifycharactercode diff --git a/node_modules/micromark-util-combine-extensions/index.d.ts b/node_modules/micromark-util-combine-extensions/index.d.ts new file mode 100644 index 00000000..dbd674cb --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/index.d.ts @@ -0,0 +1,22 @@ +/** + * Combine multiple syntax extensions into one. + * + * @param {ReadonlyArray<Extension>} extensions + * List of syntax extensions. + * @returns {NormalizedExtension} + * A single combined extension. + */ +export function combineExtensions(extensions: ReadonlyArray<Extension>): NormalizedExtension; +/** + * Combine multiple HTML extensions into one. + * + * @param {ReadonlyArray<HtmlExtension>} htmlExtensions + * List of HTML extensions. + * @returns {HtmlExtension} + * Single combined HTML extension. + */ +export function combineHtmlExtensions(htmlExtensions: ReadonlyArray<HtmlExtension>): HtmlExtension; +import type { Extension } from 'micromark-util-types'; +import type { NormalizedExtension } from 'micromark-util-types'; +import type { HtmlExtension } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-combine-extensions/index.d.ts.map b/node_modules/micromark-util-combine-extensions/index.d.ts.map new file mode 100644 index 00000000..e0ea7bf1 --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,8CALW,aAAa,CAAC,SAAS,CAAC,GAEtB,mBAAmB,CAa/B;AA+DD;;;;;;;GAOG;AACH,sDALW,aAAa,CAAC,aAAa,CAAC,GAE1B,aAAa,CAazB;+BA1GS,sBAAsB;yCAAtB,sBAAsB;mCAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-combine-extensions/index.js b/node_modules/micromark-util-combine-extensions/index.js new file mode 100644 index 00000000..bc28f6d9 --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/index.js @@ -0,0 +1,143 @@ +/** + * @import { + * Extension, + * Handles, + * HtmlExtension, + * NormalizedExtension + * } from 'micromark-util-types' + */ + +import {splice} from 'micromark-util-chunked' + +const hasOwnProperty = {}.hasOwnProperty + +/** + * Combine multiple syntax extensions into one. + * + * @param {ReadonlyArray<Extension>} extensions + * List of syntax extensions. + * @returns {NormalizedExtension} + * A single combined extension. + */ +export function combineExtensions(extensions) { + /** @type {NormalizedExtension} */ + const all = {} + let index = -1 + + while (++index < extensions.length) { + syntaxExtension(all, extensions[index]) + } + + return all +} + +/** + * Merge `extension` into `all`. + * + * @param {NormalizedExtension} all + * Extension to merge into. + * @param {Extension} extension + * Extension to merge. + * @returns {undefined} + * Nothing. + */ +function syntaxExtension(all, extension) { + /** @type {keyof Extension} */ + let hook + + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined + /** @type {Record<string, unknown>} */ + const left = maybe || (all[hook] = {}) + /** @type {Record<string, unknown> | undefined} */ + const right = extension[hook] + /** @type {string} */ + let code + + if (right) { + for (code in right) { + if (!hasOwnProperty.call(left, code)) left[code] = [] + const value = right[code] + constructs( + // @ts-expect-error Looks like a list. + left[code], + Array.isArray(value) ? value : value ? [value] : [] + ) + } + } + } +} + +/** + * Merge `list` into `existing` (both lists of constructs). + * Mutates `existing`. + * + * @param {Array<unknown>} existing + * List of constructs to merge into. + * @param {Array<unknown>} list + * List of constructs to merge. + * @returns {undefined} + * Nothing. + */ +function constructs(existing, list) { + let index = -1 + /** @type {Array<unknown>} */ + const before = [] + + while (++index < list.length) { + // @ts-expect-error Looks like an object. + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + splice(existing, 0, 0, before) +} + +/** + * Combine multiple HTML extensions into one. + * + * @param {ReadonlyArray<HtmlExtension>} htmlExtensions + * List of HTML extensions. + * @returns {HtmlExtension} + * Single combined HTML extension. + */ +export function combineHtmlExtensions(htmlExtensions) { + /** @type {HtmlExtension} */ + const handlers = {} + let index = -1 + + while (++index < htmlExtensions.length) { + htmlExtension(handlers, htmlExtensions[index]) + } + + return handlers +} + +/** + * Merge `extension` into `all`. + * + * @param {HtmlExtension} all + * Extension to merge into. + * @param {HtmlExtension} extension + * Extension to merge. + * @returns {undefined} + * Nothing. + */ +function htmlExtension(all, extension) { + /** @type {keyof HtmlExtension} */ + let hook + + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined + const left = maybe || (all[hook] = {}) + const right = extension[hook] + /** @type {keyof Handles} */ + let type + + if (right) { + for (type in right) { + // @ts-expect-error assume document vs regular handler are managed correctly. + left[type] = right[type] + } + } + } +} diff --git a/node_modules/micromark-util-combine-extensions/license b/node_modules/micromark-util-combine-extensions/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-combine-extensions/package.json b/node_modules/micromark-util-combine-extensions/package.json new file mode 100644 index 00000000..f46ff409 --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/package.json @@ -0,0 +1,52 @@ +{ + "name": "micromark-util-combine-extensions", + "version": "2.0.1", + "description": "micromark utility to combine syntax or html extensions", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "extension", + "combine", + "merge" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-combine-extensions", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "guard-for-in": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-combine-extensions/readme.md b/node_modules/micromark-util-combine-extensions/readme.md new file mode 100644 index 00000000..b9b6fc13 --- /dev/null +++ b/node_modules/micromark-util-combine-extensions/readme.md @@ -0,0 +1,201 @@ +# micromark-util-combine-extensions + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to combine [syntax][] or [html][] extensions. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`combineExtensions(extensions)`](#combineextensionsextensions) + * [`combineHtmlExtensions(htmlExtensions)`](#combinehtmlextensionshtmlextensions) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package can merge multiple extensions into one. + +## When should I use this? + +This package might be useful when you are making “presets”, such as +[`micromark-extension-gfm`][micromark-extension-gfm]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-combine-extensions +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {combineExtensions} from 'https://esm.sh/micromark-util-combine-extensions@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {combineExtensions} from 'https://esm.sh/micromark-util-combine-extensions@1?bundle' +</script> +``` + +## Use + +```js +import {gfmAutolinkLiteral} from 'micromark-extension-gfm-autolink-literal' +import {gfmStrikethrough} from 'micromark-extension-gfm-strikethrough' +import {gfmTable} from 'micromark-extension-gfm-table' +import {gfmTaskListItem} from 'micromark-extension-gfm-task-list-item' +import {combineExtensions} from 'micromark-util-combine-extensions' + +const gfm = combineExtensions([gfmAutolinkLiteral, gfmStrikethrough(), gfmTable, gfmTaskListItem]) +``` + +## API + +This module exports the identifiers +[`combineExtensions`][api-combine-extensions] and +[`combineHtmlExtensions`][api-combine-html-extensions]. +There is no default export. + +### `combineExtensions(extensions)` + +Combine multiple syntax extensions into one. + +###### Parameters + +* `extensions` (`Array<Extension>`) + — list of syntax extensions + +###### Returns + +A single combined extension (`Extension`). + +### `combineHtmlExtensions(htmlExtensions)` + +Combine multiple html extensions into one. + +###### Parameters + +* `htmlExtensions` (`Array<HtmlExtension>`) + — list of HTML extensions + +###### Returns + +A single combined HTML extension (`HtmlExtension`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-combine-extensions@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-combine-extensions.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-combine-extensions + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-combine-extensions + +[bundle-size]: https://bundlejs.com/?q=micromark-util-combine-extensions + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[syntax]: https://github.com/micromark/micromark#syntaxextension + +[html]: https://github.com/micromark/micromark#htmlextension + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[api-combine-extensions]: #combineextensionsextensions + +[api-combine-html-extensions]: #combinehtmlextensionshtmlextensions diff --git a/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts new file mode 100644 index 00000000..333bdbbd --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts @@ -0,0 +1,16 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value: string, base: number): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map new file mode 100644 index 00000000..17f668f1 --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,uDAPW,MAAM,QAEN,MAAM,GAEJ,MAAM,CA4BlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js new file mode 100644 index 00000000..a96c4238 --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js @@ -0,0 +1,42 @@ +import {codes, values} from 'micromark-util-symbol' + +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value, base) { + const code = Number.parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space. + code < codes.ht || + code === codes.vt || + (code > codes.cr && code < codes.space) || + // Control character (DEL) of C0, and C1 controls. + (code > codes.tilde && code < 160) || + // Lone high surrogates and low surrogates. + (code > 55_295 && code < 57_344) || + // Noncharacters. + (code > 64_975 && code < 65_008) || + /* eslint-disable no-bitwise */ + (code & 65_535) === 65_535 || + (code & 65_535) === 65_534 || + /* eslint-enable no-bitwise */ + // Out of range + code > 1_114_111 + ) { + return values.replacementCharacter + } + + return String.fromCodePoint(code) +} diff --git a/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts b/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts new file mode 100644 index 00000000..333bdbbd --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts @@ -0,0 +1,16 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value: string, base: number): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map b/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map new file mode 100644 index 00000000..17f668f1 --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,uDAPW,MAAM,QAEN,MAAM,GAEJ,MAAM,CA4BlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-numeric-character-reference/index.js b/node_modules/micromark-util-decode-numeric-character-reference/index.js new file mode 100644 index 00000000..1d75d7ba --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/index.js @@ -0,0 +1,32 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value, base) { + const code = Number.parseInt(value, base); + if ( + // C0 except for HT, LF, FF, CR, space. + code < 9 || code === 11 || code > 13 && code < 32 || + // Control character (DEL) of C0, and C1 controls. + code > 126 && code < 160 || + // Lone high surrogates and low surrogates. + code > 55_295 && code < 57_344 || + // Noncharacters. + code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */ + (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */ + // Out of range + code > 1_114_111) { + return "\uFFFD"; + } + return String.fromCodePoint(code); +} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-numeric-character-reference/license b/node_modules/micromark-util-decode-numeric-character-reference/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-decode-numeric-character-reference/package.json b/node_modules/micromark-util-decode-numeric-character-reference/package.json new file mode 100644 index 00000000..759e989b --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-decode-numeric-character-reference", + "version": "2.0.2", + "description": "micromark utility to decode numeric character references", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "decode", + "numeric", + "number", + "character", + "reference" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-numeric-character-reference", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-decode-numeric-character-reference/readme.md b/node_modules/micromark-util-decode-numeric-character-reference/readme.md new file mode 100644 index 00000000..4610c59b --- /dev/null +++ b/node_modules/micromark-util-decode-numeric-character-reference/readme.md @@ -0,0 +1,184 @@ +# micromark-util-decode-numeric-character-reference + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to decode numeric character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`decodeNumericCharacterReference(value, base)`](#decodenumericcharacterreferencevalue-base) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to decode numeric character references. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-decode-numeric-character-reference +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {decodeNumericCharacterReference} from 'https://esm.sh/micromark-util-decode-numeric-character-reference@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {decodeNumericCharacterReference} from 'https://esm.sh/micromark-util-decode-numeric-character-reference@1?bundle' +</script> +``` + +## Use + +```js +import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' + +decodeNumericCharacterReference('41', 16) // 'A' +decodeNumericCharacterReference('65', 10) // 'A' +decodeNumericCharacterReference('A', 16) // '\n' +decodeNumericCharacterReference('7F', 16) // '�' - Control +decodeNumericCharacterReference('110000', 16) // '�' - Out of range +``` + +## API + +This module exports the identifier: +[`decodeNumericCharacterReference`][api-decode-numeric-character-reference]. +There is no default export. + +### `decodeNumericCharacterReference(value, base)` + +Turn the number (in string form as either hexa- or plain decimal) coming from +a numeric character reference into a character. + +Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes +non-characters and control characters safe. + +###### Parameters + +* `value` (`string`) + — value to decode +* `base` (`number`, probably `10` or `16`) + — numeric base + +###### Returns + +Character (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-decode-numeric-character-reference@2`, compatible with +Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-decode-numeric-character-reference]: #decodenumericcharacterreferencevalue-base diff --git a/node_modules/micromark-util-decode-string/dev/index.d.ts b/node_modules/micromark-util-decode-string/dev/index.d.ts new file mode 100644 index 00000000..7395fe09 --- /dev/null +++ b/node_modules/micromark-util-decode-string/dev/index.d.ts @@ -0,0 +1,14 @@ +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-decode-string/dev/index.d.ts.map b/node_modules/micromark-util-decode-string/dev/index.d.ts.map new file mode 100644 index 00000000..773ee9f4 --- /dev/null +++ b/node_modules/micromark-util-decode-string/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,oCALW,MAAM,GAEJ,MAAM,CAKlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-string/dev/index.js b/node_modules/micromark-util-decode-string/dev/index.js new file mode 100644 index 00000000..214ca166 --- /dev/null +++ b/node_modules/micromark-util-decode-string/dev/index.js @@ -0,0 +1,53 @@ +import {decodeNamedCharacterReference} from 'decode-named-character-reference' +import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' +import {codes, constants} from 'micromark-util-symbol' + +const characterEscapeOrReference = + /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi + +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value) { + return value.replace(characterEscapeOrReference, decode) +} + +/** + * @param {string} $0 + * Match. + * @param {string} $1 + * Character escape. + * @param {string} $2 + * Character reference. + * @returns {string} + * Decoded value + */ +function decode($0, $1, $2) { + if ($1) { + // Escape. + return $1 + } + + // Reference. + const head = $2.charCodeAt(0) + + if (head === codes.numberSign) { + const head = $2.charCodeAt(1) + const hex = head === codes.lowercaseX || head === codes.uppercaseX + return decodeNumericCharacterReference( + $2.slice(hex ? 2 : 1), + hex ? constants.numericBaseHexadecimal : constants.numericBaseDecimal + ) + } + + return decodeNamedCharacterReference($2) || $0 +} diff --git a/node_modules/micromark-util-decode-string/index.d.ts b/node_modules/micromark-util-decode-string/index.d.ts new file mode 100644 index 00000000..7395fe09 --- /dev/null +++ b/node_modules/micromark-util-decode-string/index.d.ts @@ -0,0 +1,14 @@ +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-decode-string/index.d.ts.map b/node_modules/micromark-util-decode-string/index.d.ts.map new file mode 100644 index 00000000..773ee9f4 --- /dev/null +++ b/node_modules/micromark-util-decode-string/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,oCALW,MAAM,GAEJ,MAAM,CAKlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-string/index.js b/node_modules/micromark-util-decode-string/index.js new file mode 100644 index 00000000..e6f07c8c --- /dev/null +++ b/node_modules/micromark-util-decode-string/index.js @@ -0,0 +1,45 @@ +import { decodeNamedCharacterReference } from 'decode-named-character-reference'; +import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference'; +const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; + +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value) { + return value.replace(characterEscapeOrReference, decode); +} + +/** + * @param {string} $0 + * Match. + * @param {string} $1 + * Character escape. + * @param {string} $2 + * Character reference. + * @returns {string} + * Decoded value + */ +function decode($0, $1, $2) { + if ($1) { + // Escape. + return $1; + } + + // Reference. + const head = $2.charCodeAt(0); + if (head === 35) { + const head = $2.charCodeAt(1); + const hex = head === 120 || head === 88; + return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10); + } + return decodeNamedCharacterReference($2) || $0; +} \ No newline at end of file diff --git a/node_modules/micromark-util-decode-string/license b/node_modules/micromark-util-decode-string/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-decode-string/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-decode-string/package.json b/node_modules/micromark-util-decode-string/package.json new file mode 100644 index 00000000..e32660a7 --- /dev/null +++ b/node_modules/micromark-util-decode-string/package.json @@ -0,0 +1,63 @@ +{ + "name": "micromark-util-decode-string", + "version": "2.0.1", + "description": "micromark utility to decode markdown strings", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "decode", + "character", + "reference", + "escape", + "string" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-string", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "decode-named-character-reference": "^1.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/micromark-util-decode-string/readme.md b/node_modules/micromark-util-decode-string/readme.md new file mode 100644 index 00000000..291fe693 --- /dev/null +++ b/node_modules/micromark-util-decode-string/readme.md @@ -0,0 +1,179 @@ +# micromark-util-decode-string + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to decode markdown strings. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`decodeString(value)`](#decodestringvalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to parse character escapes and character +references. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-decode-string +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {decodeString} from 'https://esm.sh/micromark-util-decode-string@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {decodeString} from 'https://esm.sh/micromark-util-decode-string@1?bundle' +</script> +``` + +## Use + +```js +import {decodeString} from 'micromark-util-decode-string' + +decodeString('a &semi; b') // 'a ; b' +decodeString('a \\; b') // 'a ; b' +decodeString('a ; b') // 'a ; b' +``` + +## API + +This module exports the identifier [`decodeString`][api-decode-string]. +There is no default export. + +### `decodeString(value)` + +Decode markdown strings (which occur in places such as fenced code info strings, +destinations, labels, and titles). + +The “string” content type allows character escapes and -references. +This decodes those. + +###### Parameters + +* `value` (`string`) + — value to decode + +###### Returns + +Decoded value (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-decode-string@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-decode-string]: #decodestringvalue diff --git a/node_modules/micromark-util-encode/index.d.ts b/node_modules/micromark-util-encode/index.d.ts new file mode 100644 index 00000000..760226f6 --- /dev/null +++ b/node_modules/micromark-util-encode/index.d.ts @@ -0,0 +1,14 @@ +/** + * Encode only the dangerous HTML characters. + * + * This ensures that certain characters which have special meaning in HTML are + * dealt with. + * Technically, we can skip `>` and `"` in many cases, but CM includes them. + * + * @param {string} value + * Value to encode. + * @returns {string} + * Encoded value. + */ +export function encode(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-encode/index.d.ts.map b/node_modules/micromark-util-encode/index.d.ts.map new file mode 100644 index 00000000..16eebb1c --- /dev/null +++ b/node_modules/micromark-util-encode/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,8BALW,MAAM,GAEJ,MAAM,CAqBlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-encode/index.js b/node_modules/micromark-util-encode/index.js new file mode 100644 index 00000000..397f1d40 --- /dev/null +++ b/node_modules/micromark-util-encode/index.js @@ -0,0 +1,33 @@ +const characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'} + +/** + * Encode only the dangerous HTML characters. + * + * This ensures that certain characters which have special meaning in HTML are + * dealt with. + * Technically, we can skip `>` and `"` in many cases, but CM includes them. + * + * @param {string} value + * Value to encode. + * @returns {string} + * Encoded value. + */ +export function encode(value) { + return value.replace(/["&<>]/g, replace) + + /** + * @param {string} value + * Value to replace. + * @returns {string} + * Encoded value. + */ + function replace(value) { + return ( + '&' + + characterReferences[ + /** @type {keyof typeof characterReferences} */ (value) + ] + + ';' + ) + } +} diff --git a/node_modules/micromark-util-encode/license b/node_modules/micromark-util-encode/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-encode/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-encode/package.json b/node_modules/micromark-util-encode/package.json new file mode 100644 index 00000000..a56c6b3b --- /dev/null +++ b/node_modules/micromark-util-encode/package.json @@ -0,0 +1,47 @@ +{ + "name": "micromark-util-encode", + "version": "2.0.1", + "description": "micromark utility to encode dangerous html characters", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "html", + "encode" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-encode", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-string-replace-all": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-encode/readme.md b/node_modules/micromark-util-encode/readme.md new file mode 100644 index 00000000..cd27292f --- /dev/null +++ b/node_modules/micromark-util-encode/readme.md @@ -0,0 +1,176 @@ +# micromark-util-encode + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to encode dangerous html characters. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`encode(value)`](#encodevalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to make text safe for embedding in HTML. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-encode +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {encode} from 'https://esm.sh/micromark-util-encode@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {encode} from 'https://esm.sh/micromark-util-encode@1?bundle' +</script> +``` + +## Use + +```js +import {encode} from 'micromark-util-encode' + +encode('<3') // '&lt;3' +``` + +## API + +This module exports the identifier [`encode`][api-encode]. +There is no default export. + +### `encode(value)` + +Encode only the dangerous HTML characters. + +This ensures that certain characters which have special meaning in HTML are +dealt with. +Technically, we can skip `>` and `"` in many cases, but CM includes them. + +###### Parameters + +* `value` (`string`) + — value to encode + +###### Returns + +Encoded value (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-encode@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-encode.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-encode + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-encode + +[bundle-size]: https://bundlejs.com/?q=micromark-util-encode + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-encode]: #encodevalue diff --git a/node_modules/micromark-util-html-tag-name/index.d.ts b/node_modules/micromark-util-html-tag-name/index.d.ts new file mode 100644 index 00000000..cd5ef317 --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/index.d.ts @@ -0,0 +1,30 @@ +/** + * List of lowercase HTML “block” tag names. + * + * The list, when parsing HTML (flow), results in more relaxed rules (condition + * 6). + * Because they are known blocks, the HTML-like syntax doesn’t have to be + * strictly parsed. + * For tag names not in this list, a more strict algorithm (condition 7) is used + * to detect whether the HTML-like syntax is seen as HTML (flow) or not. + * + * This is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `search` was added in `CommonMark@0.31`. + */ +export const htmlBlockNames: string[]; +/** + * List of lowercase HTML “raw” tag names. + * + * The list, when parsing HTML (flow), results in HTML that can include lines + * without exiting, until a closing tag also in this list is found (condition + * 1). + * + * This module is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + */ +export const htmlRawNames: string[]; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-html-tag-name/index.d.ts.map b/node_modules/micromark-util-html-tag-name/index.d.ts.map new file mode 100644 index 00000000..56f2fc0f --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,sCA+DC;AAED;;;;;;;;;;;GAWG;AACH,oCAAkE"} \ No newline at end of file diff --git a/node_modules/micromark-util-html-tag-name/index.js b/node_modules/micromark-util-html-tag-name/index.js new file mode 100644 index 00000000..fa0a0fd9 --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/index.js @@ -0,0 +1,93 @@ +/** + * List of lowercase HTML “block” tag names. + * + * The list, when parsing HTML (flow), results in more relaxed rules (condition + * 6). + * Because they are known blocks, the HTML-like syntax doesn’t have to be + * strictly parsed. + * For tag names not in this list, a more strict algorithm (condition 7) is used + * to detect whether the HTML-like syntax is seen as HTML (flow) or not. + * + * This is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `search` was added in `CommonMark@0.31`. + */ +export const htmlBlockNames = [ + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'search', + 'section', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +] + +/** + * List of lowercase HTML “raw” tag names. + * + * The list, when parsing HTML (flow), results in HTML that can include lines + * without exiting, until a closing tag also in this list is found (condition + * 1). + * + * This module is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + */ +export const htmlRawNames = ['pre', 'script', 'style', 'textarea'] diff --git a/node_modules/micromark-util-html-tag-name/license b/node_modules/micromark-util-html-tag-name/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-html-tag-name/package.json b/node_modules/micromark-util-html-tag-name/package.json new file mode 100644 index 00000000..9015e128 --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/package.json @@ -0,0 +1,47 @@ +{ + "name": "micromark-util-html-tag-name", + "version": "2.0.1", + "description": "micromark utility with list of html tag names", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "html", + "tag", + "name" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-html-tag-name", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-html-tag-name/readme.md b/node_modules/micromark-util-html-tag-name/readme.md new file mode 100644 index 00000000..ff16f68e --- /dev/null +++ b/node_modules/micromark-util-html-tag-name/readme.md @@ -0,0 +1,193 @@ +# micromark-util-html-tag-name + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility with list of html tag names. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`htmlBlockNames`](#htmlblocknames) + * [`htmlRawNames`](#htmlrawnames) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a list of known tag names to markdown. + +## When should I use this? + +This package is only useful if you want to build an alternative to micromark. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-html-tag-name +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {htmlBlockNames, htmlRawNames} from 'https://esm.sh/micromark-util-html-tag-name@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {htmlBlockNames, htmlRawNames} from 'https://esm.sh/micromark-util-html-tag-name@1?bundle' +</script> +``` + +## Use + +```js +import {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name' + +console.log(htmlBlockNames) // ['address', 'article', …] +console.log(htmlRawNames) // ['pre', 'script', …] +``` + +## API + +This module exports the identifiers [`htmlBlockNames`][api-html-block-names] +and [`htmlRawNames`][api-html-raw-names]. +There is no default export. + +### `htmlBlockNames` + +List of lowercase HTML “block” tag names (`Array<string>`). + +The list, when parsing HTML (flow), results in more relaxed rules (condition +6\). +Because they are known blocks, the HTML-like syntax doesn’t have to be strictly +parsed. +For tag names not in this list, a more strict algorithm (condition 7) is used +to detect whether the HTML-like syntax is seen as HTML (flow) or not. + +This is copied from: +<https://spec.commonmark.org/0.30/#html-blocks>. + +> 👉 **Note**: `search` was added in `CommonMark@0.31`. + +### `htmlRawNames` + +List of lowercase HTML “raw” tag names (`Array<string>`). + +The list, when parsing HTML (flow), results in HTML that can include lines +without exiting, until a closing tag also in this list is found (condition +1\). + +This module is copied from: +<https://spec.commonmark.org/0.30/#html-blocks>. + +> 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-html-tag-name@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-html-tag-name.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-html-tag-name + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-html-tag-name + +[bundle-size]: https://bundlejs.com/?q=micromark-util-html-tag-name + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-html-block-names]: #htmlblocknames + +[api-html-raw-names]: #htmlrawnames diff --git a/node_modules/micromark-util-normalize-identifier/dev/index.d.ts b/node_modules/micromark-util-normalize-identifier/dev/index.d.ts new file mode 100644 index 00000000..96074f60 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/dev/index.d.ts @@ -0,0 +1,21 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map b/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map new file mode 100644 index 00000000..684ad8d8 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CALW,MAAM,GAEJ,MAAM,CAmBlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-normalize-identifier/dev/index.js b/node_modules/micromark-util-normalize-identifier/dev/index.js new file mode 100644 index 00000000..ce4ce9b6 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/dev/index.js @@ -0,0 +1,38 @@ +import {values} from 'micromark-util-symbol' + +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value) { + return ( + value + // Collapse markdown whitespace. + .replace(/[\t\n\r ]+/g, values.space) + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} diff --git a/node_modules/micromark-util-normalize-identifier/index.d.ts b/node_modules/micromark-util-normalize-identifier/index.d.ts new file mode 100644 index 00000000..96074f60 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/index.d.ts @@ -0,0 +1,21 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-normalize-identifier/index.d.ts.map b/node_modules/micromark-util-normalize-identifier/index.d.ts.map new file mode 100644 index 00000000..684ad8d8 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CALW,MAAM,GAEJ,MAAM,CAmBlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-normalize-identifier/index.js b/node_modules/micromark-util-normalize-identifier/index.js new file mode 100644 index 00000000..f2060214 --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/index.js @@ -0,0 +1,33 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value) { + return value + // Collapse markdown whitespace. + .replace(/[\t\n\r ]+/g, " ") + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no method is uppercase. + .toLowerCase().toUpperCase(); +} \ No newline at end of file diff --git a/node_modules/micromark-util-normalize-identifier/license b/node_modules/micromark-util-normalize-identifier/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-normalize-identifier/package.json b/node_modules/micromark-util-normalize-identifier/package.json new file mode 100644 index 00000000..4fb1982d --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/package.json @@ -0,0 +1,58 @@ +{ + "name": "micromark-util-normalize-identifier", + "version": "2.0.1", + "description": "micromark utility normalize identifiers (as found in references, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "normalize", + "id", + "identifier" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-normalize-identifier", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/micromark-util-normalize-identifier/readme.md b/node_modules/micromark-util-normalize-identifier/readme.md new file mode 100644 index 00000000..97e2383a --- /dev/null +++ b/node_modules/micromark-util-normalize-identifier/readme.md @@ -0,0 +1,187 @@ +# micromark-util-normalize-identifier + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility normalize identifiers. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`normalizeIdentifier(value)`](#normalizeidentifiervalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to normalize identifiers found in markdown. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-normalize-identifier +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {normalizeIdentifier} from 'https://esm.sh/micromark-util-normalize-identifier@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {normalizeIdentifier} from 'https://esm.sh/micromark-util-normalize-identifier@1?bundle' +</script> +``` + +## Use + +```js +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' + +normalizeIdentifier(' a ') // 'A' +normalizeIdentifier('a\t\r\nb') // 'A B' +normalizeIdentifier('ТОЛПОЙ') // 'ТОЛПОЙ' +normalizeIdentifier('Толпой') // 'ТОЛПОЙ' +``` + +## API + +This module exports the identifier +[`normalizeIdentifier`][api-normalize-identifier]. +There is no default export. + +### `normalizeIdentifier(value)` + +Normalize an identifier (as found in references, definitions). + +Collapses markdown whitespace, trim, and then lower- and uppercase. + +Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their +lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different +uppercase character (U+0398 (`Θ`)). +So, to get a canonical form, we perform both lower- and uppercase. + +Using uppercase last makes sure keys will never interact with default +prototypal values (such as `constructor`): nothing in the prototype of `Object` +is uppercase. + +###### Parameters + +* `value` (`string`) + — identifier to normalize + +###### Returns + +Normalized identifier (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-normalize-identifier@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-normalize-identifier]: #normalizeidentifiervalue diff --git a/node_modules/micromark-util-resolve-all/index.d.ts b/node_modules/micromark-util-resolve-all/index.d.ts new file mode 100644 index 00000000..c9cbe16b --- /dev/null +++ b/node_modules/micromark-util-resolve-all/index.d.ts @@ -0,0 +1,22 @@ +/** + * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types' + */ +/** + * Call all `resolveAll`s. + * + * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs + * List of constructs, optionally with `resolveAll`s. + * @param {Array<Event>} events + * List of events. + * @param {TokenizeContext} context + * Context used by `tokenize`. + * @returns {Array<Event>} + * Changed events. + */ +export function resolveAll(constructs: ReadonlyArray<{ + resolveAll?: Resolver | undefined; +}>, events: Array<Event>, context: TokenizeContext): Array<Event>; +import type { Resolver } from 'micromark-util-types'; +import type { Event } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-resolve-all/index.d.ts.map b/node_modules/micromark-util-resolve-all/index.d.ts.map new file mode 100644 index 00000000..8ba707e7 --- /dev/null +++ b/node_modules/micromark-util-resolve-all/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,uCATW,aAAa,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAC,CAAC,UAElD,KAAK,CAAC,KAAK,CAAC,WAEZ,eAAe,GAEb,KAAK,CAAC,KAAK,CAAC,CAkBxB;8BA9BkD,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-resolve-all/index.js b/node_modules/micromark-util-resolve-all/index.js new file mode 100644 index 00000000..69eb32b6 --- /dev/null +++ b/node_modules/micromark-util-resolve-all/index.js @@ -0,0 +1,32 @@ +/** + * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types' + */ + +/** + * Call all `resolveAll`s. + * + * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs + * List of constructs, optionally with `resolveAll`s. + * @param {Array<Event>} events + * List of events. + * @param {TokenizeContext} context + * Context used by `tokenize`. + * @returns {Array<Event>} + * Changed events. + */ +export function resolveAll(constructs, events, context) { + /** @type {Array<Resolver>} */ + const called = [] + let index = -1 + + while (++index < constructs.length) { + const resolve = constructs[index].resolveAll + + if (resolve && !called.includes(resolve)) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} diff --git a/node_modules/micromark-util-resolve-all/license b/node_modules/micromark-util-resolve-all/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-resolve-all/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-resolve-all/package.json b/node_modules/micromark-util-resolve-all/package.json new file mode 100644 index 00000000..f1d7c2b2 --- /dev/null +++ b/node_modules/micromark-util-resolve-all/package.json @@ -0,0 +1,48 @@ +{ + "name": "micromark-util-resolve-all", + "version": "2.0.1", + "description": "micromark utility to resolve subtokens", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "resolve" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-resolve-all", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-resolve-all/readme.md b/node_modules/micromark-util-resolve-all/readme.md new file mode 100644 index 00000000..11eefd47 --- /dev/null +++ b/node_modules/micromark-util-resolve-all/readme.md @@ -0,0 +1,238 @@ +# micromark-util-resolve-all + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to resolve subtokens. + +[Resolvers][resolver] are functions that take events and manipulate them. +This is needed for example because media (links, images) and attention (strong, +italic) aren’t parsed left-to-right. +Instead, their openings and closings are parsed, and when done, their openings +and closings are matched, and left overs are turned into plain text. +Because media and attention can’t overlap, we need to perform that operation +when one closing matches an opening, too. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`resolveAll(constructs, events, context)`](#resolveallconstructs-events-context) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a micromark internal that you probably don’t need. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-resolve-all +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1?bundle' +</script> +``` + +## Use + +```js +import {push} from 'micromark-util-chunked' +import {resolveAll} from 'micromark-util-resolve-all' + +/** + * @type {Resolver} + */ +function resolveAllAttention(events, context) { + // … + + // Walk through all events. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + // … + ) { + // … + + // Opening. + nextEvents = push(nextEvents, [ + // … + ]) + + // Between. + nextEvents = push( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) + + // Closing. + nextEvents = push(nextEvents, [ + // … + ]) + + // … + } + } + } + } + + // … +} +``` + +## API + +This module exports the identifier [`resolveAll`][api-resolve-all]. +There is no default export. + +### `resolveAll(constructs, events, context)` + +Call all `resolveAll`s in `constructs`. + +###### Parameters + +* `constructs` (`Array<Construct>`) + — list of constructs, optionally with `resolveAll`s +* `events` (`Array<Event>`) + — list of events +* `context` (`TokenizeContext`) + — context used by `tokenize` + +###### Returns + +Changed events (`Array<Events>`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-resolve-all@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-resolve-all.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-resolve-all + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-resolve-all + +[bundle-size]: https://bundlejs.com/?q=micromark-util-resolve-all + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[resolver]: https://github.com/micromark/micromark/blob/a571c09/packages/micromark-util-types/index.js#L219 + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-resolve-all]: #resolveallconstructs-events-context diff --git a/node_modules/micromark-util-sanitize-uri/dev/index.d.ts b/node_modules/micromark-util-sanitize-uri/dev/index.d.ts new file mode 100644 index 00000000..a105f230 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/dev/index.d.ts @@ -0,0 +1,36 @@ +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url: string | null | undefined, protocol?: RegExp | null | undefined): string; +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map b/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map new file mode 100644 index 00000000..cab94835 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iCAPW,MAAM,GAAG,IAAI,GAAG,SAAS,aAEzB,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,MAAM,CA6BlB;AAED;;;;;;;;;;GAUG;AACH,oCALW,MAAM,GAEJ,MAAM,CA6DlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-sanitize-uri/dev/index.js b/node_modules/micromark-util-sanitize-uri/dev/index.js new file mode 100644 index 00000000..cc454b5e --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/dev/index.js @@ -0,0 +1,124 @@ +import {asciiAlphanumeric} from 'micromark-util-character' +import {encode} from 'micromark-util-encode' +import {codes, values} from 'micromark-util-symbol' + +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url, protocol) { + const value = encode(normalizeUri(url || '')) + + if (!protocol) { + return value + } + + const colon = value.indexOf(':') + const questionMark = value.indexOf('?') + const numberSign = value.indexOf('#') + const slash = value.indexOf('/') + + if ( + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + (slash > -1 && colon > slash) || + (questionMark > -1 && colon > questionMark) || + (numberSign > -1 && colon > numberSign) || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon)) + ) { + return value + } + + return '' +} + +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value) { + /** @type {Array<string>} */ + const result = [] + let index = -1 + let start = 0 + let skip = 0 + + while (++index < value.length) { + const code = value.charCodeAt(index) + /** @type {string} */ + let replace = '' + + // A correct percent encoded value. + if ( + code === codes.percentSign && + asciiAlphanumeric(value.charCodeAt(index + 1)) && + asciiAlphanumeric(value.charCodeAt(index + 2)) + ) { + skip = 2 + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { + replace = String.fromCharCode(code) + } + } + // Astral. + else if (code > 55_295 && code < 57_344) { + const next = value.charCodeAt(index + 1) + + // A correct surrogate pair. + if (code < 56_320 && next > 56_319 && next < 57_344) { + replace = String.fromCharCode(code, next) + skip = 1 + } + // Lone surrogate. + else { + replace = values.replacementCharacter + } + } + // Unicode. + else { + replace = String.fromCharCode(code) + } + + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)) + start = index + skip + 1 + replace = '' + } + + if (skip) { + index += skip + skip = 0 + } + } + + return result.join('') + value.slice(start) +} diff --git a/node_modules/micromark-util-sanitize-uri/index.d.ts b/node_modules/micromark-util-sanitize-uri/index.d.ts new file mode 100644 index 00000000..a105f230 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/index.d.ts @@ -0,0 +1,36 @@ +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url: string | null | undefined, protocol?: RegExp | null | undefined): string; +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-sanitize-uri/index.d.ts.map b/node_modules/micromark-util-sanitize-uri/index.d.ts.map new file mode 100644 index 00000000..cab94835 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iCAPW,MAAM,GAAG,IAAI,GAAG,SAAS,aAEzB,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,MAAM,CA6BlB;AAED;;;;;;;;;;GAUG;AACH,oCALW,MAAM,GAEJ,MAAM,CA6DlB"} \ No newline at end of file diff --git a/node_modules/micromark-util-sanitize-uri/index.js b/node_modules/micromark-util-sanitize-uri/index.js new file mode 100644 index 00000000..fb6fe6fb --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/index.js @@ -0,0 +1,107 @@ +import { asciiAlphanumeric } from 'micromark-util-character'; +import { encode } from 'micromark-util-encode'; +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url, protocol) { + const value = encode(normalizeUri(url || '')); + if (!protocol) { + return value; + } + const colon = value.indexOf(':'); + const questionMark = value.indexOf('?'); + const numberSign = value.indexOf('#'); + const slash = value.indexOf('/'); + if ( + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + slash > -1 && colon > slash || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon))) { + return value; + } + return ''; +} + +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value) { + /** @type {Array<string>} */ + const result = []; + let index = -1; + let start = 0; + let skip = 0; + while (++index < value.length) { + const code = value.charCodeAt(index); + /** @type {string} */ + let replace = ''; + + // A correct percent encoded value. + if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) { + skip = 2; + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { + replace = String.fromCharCode(code); + } + } + // Astral. + else if (code > 55_295 && code < 57_344) { + const next = value.charCodeAt(index + 1); + + // A correct surrogate pair. + if (code < 56_320 && next > 56_319 && next < 57_344) { + replace = String.fromCharCode(code, next); + skip = 1; + } + // Lone surrogate. + else { + replace = "\uFFFD"; + } + } + // Unicode. + else { + replace = String.fromCharCode(code); + } + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)); + start = index + skip + 1; + replace = ''; + } + if (skip) { + index += skip; + skip = 0; + } + } + return result.join('') + value.slice(start); +} \ No newline at end of file diff --git a/node_modules/micromark-util-sanitize-uri/license b/node_modules/micromark-util-sanitize-uri/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-sanitize-uri/package.json b/node_modules/micromark-util-sanitize-uri/package.json new file mode 100644 index 00000000..068ecbc7 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-sanitize-uri", + "version": "2.0.1", + "description": "micromark utility to sanitize urls", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "sanitize", + "clear", + "url" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-sanitize-uri", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-sanitize-uri/readme.md b/node_modules/micromark-util-sanitize-uri/readme.md new file mode 100644 index 00000000..2d08fc51 --- /dev/null +++ b/node_modules/micromark-util-sanitize-uri/readme.md @@ -0,0 +1,214 @@ +# micromark-util-sanitize-uri + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to sanitize urls. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`normalizeUri(value)`](#normalizeurivalue) + * [`sanitizeUri(url[, pattern])`](#sanitizeuriurl-pattern) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to make URLs safe. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-sanitize-uri +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {sanitizeUri} from 'https://esm.sh/micromark-util-sanitize-uri@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {sanitizeUri} from 'https://esm.sh/micromark-util-sanitize-uri@1?bundle' +</script> +``` + +## Use + +```js +import {sanitizeUri} from 'micromark-util-sanitize-uri' + +sanitizeUri('https://example.com/a&amp;b') // 'https://example.com/a&amp;amp;b' +sanitizeUri('https://example.com/a%b') // 'https://example.com/a%25b' +sanitizeUri('https://example.com/a%20b') // 'https://example.com/a%20b' +sanitizeUri('https://example.com/👍') // 'https://example.com/%F0%9F%91%8D' +sanitizeUri('https://example.com/', /^https?$/i) // 'https://example.com/' +sanitizeUri('javascript:alert(1)', /^https?$/i) // '' +sanitizeUri('./example.jpg', /^https?$/i) // './example.jpg' +sanitizeUri('#a', /^https?$/i) // '#a' +``` + +## API + +This module exports the identifiers [`normalizeUri`][api-normalize-uri] and +[`sanitizeUri`][api-sanitize-uri]. +There is no default export. + +### `normalizeUri(value)` + +Normalize a URL. + +Encode unsafe characters with percent-encoding, skipping already encoded +sequences. + +###### Parameters + +* `value` (`string`) + — URI to normalize + +###### Returns + +Normalized URI (`string`). + +### `sanitizeUri(url[, pattern])` + +Make a value safe for injection as a URL. + +This encodes unsafe characters with percent-encoding and skips already +encoded sequences (see [`normalizeUri`][api-normalize-uri]). +Further unsafe characters are encoded as character references (see +[`micromark-util-encode`][micromark-util-encode]). + +A regex of allowed protocols can be given, in which case the URL is sanitized. +For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or +`/^https?$/i` for `img[src]` (this is what `github.com` allows). +If the URL includes an unknown protocol (one not matched by `protocol`, such +as a dangerous example, `javascript:`), the value is ignored. + +###### Parameters + +* `url` (`string`) + — URI to sanitize +* `pattern` (`RegExp`, optional) + — allowed protocols + +###### Returns + +Sanitized URI (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-sanitize-uri@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-sanitize-uri.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-sanitize-uri + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-sanitize-uri + +[bundle-size]: https://bundlejs.com/?q=micromark-util-sanitize-uri + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-util-encode]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-encode + +[api-normalize-uri]: #normalizeurivalue + +[api-sanitize-uri]: #sanitizeuriurl-pattern diff --git a/node_modules/micromark-util-subtokenize/dev/index.d.ts b/node_modules/micromark-util-subtokenize/dev/index.d.ts new file mode 100644 index 00000000..b252238a --- /dev/null +++ b/node_modules/micromark-util-subtokenize/dev/index.d.ts @@ -0,0 +1,12 @@ +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +export function subtokenize(eventsArray: Array<Event>): boolean; +export { SpliceBuffer } from "./lib/splice-buffer.js"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-subtokenize/dev/index.d.ts.map b/node_modules/micromark-util-subtokenize/dev/index.d.ts.map new file mode 100644 index 00000000..e0a024dc --- /dev/null +++ b/node_modules/micromark-util-subtokenize/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,yCANW,KAAK,CAAC,KAAK,CAAC,GAEV,OAAO,CAuHnB;;2BAvIqC,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-subtokenize/dev/index.js b/node_modules/micromark-util-subtokenize/dev/index.js new file mode 100644 index 00000000..986ff0a3 --- /dev/null +++ b/node_modules/micromark-util-subtokenize/dev/index.js @@ -0,0 +1,284 @@ +/** + * @import {Chunk, Event, Token} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {splice} from 'micromark-util-chunked' +import {codes, types} from 'micromark-util-symbol' +import {SpliceBuffer} from './lib/splice-buffer.js' + +// Hidden API exposed for testing. +export {SpliceBuffer} from './lib/splice-buffer.js' + +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +// eslint-disable-next-line complexity +export function subtokenize(eventsArray) { + /** @type {Record<string, number>} */ + const jumps = {} + let index = -1 + /** @type {Event} */ + let event + /** @type {number | undefined} */ + let lineIndex + /** @type {number} */ + let otherIndex + /** @type {Event} */ + let otherEvent + /** @type {Array<Event>} */ + let parameters + /** @type {Array<Event>} */ + let subevents + /** @type {boolean | undefined} */ + let more + const events = new SpliceBuffer(eventsArray) + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events.get(index) + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if ( + index && + event[1].type === types.chunkFlow && + events.get(index - 1)[1].type === types.listItemPrefix + ) { + assert(event[1]._tokenizer, 'expected `_tokenizer` on subtokens') + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.lineEndingBlank + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.content + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === types.content) { + break + } + + if (subevents[otherIndex][1].type === types.chunkText) { + subevents[otherIndex][1]._isInFirstContentOfListItem = true + otherIndex++ + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } + // Exit. + else if (event[1]._container) { + otherIndex = index + lineIndex = undefined + + while (otherIndex--) { + otherEvent = events.get(otherIndex) + + if ( + otherEvent[1].type === types.lineEnding || + otherEvent[1].type === types.lineEndingBlank + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events.get(lineIndex)[1].type = types.lineEndingBlank + } + + otherEvent[1].type = types.lineEnding + lineIndex = otherIndex + } + } else if ( + otherEvent[1].type === types.linePrefix || + otherEvent[1].type === types.listItemIndent + ) { + // Move past. + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = {...events.get(lineIndex)[1].start} + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + events.splice(lineIndex, index - lineIndex + 1, parameters) + } + } + } + + // The changes to the `events` buffer must be copied back into the eventsArray + splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)) + return !more +} + +/** + * Tokenize embedded tokens. + * + * @param {SpliceBuffer<Event>} events + * Events. + * @param {number} eventIndex + * Index. + * @returns {Record<string, number>} + * Gaps. + */ +function subcontent(events, eventIndex) { + const token = events.get(eventIndex)[1] + const context = events.get(eventIndex)[2] + let startPosition = eventIndex - 1 + /** @type {Array<number>} */ + const startPositions = [] + assert(token.contentType, 'expected `contentType` on subtokens') + + let tokenizer = token._tokenizer + + if (!tokenizer) { + tokenizer = context.parser[token.contentType](token.start) + + if (token._contentTypeTextTrailing) { + tokenizer._contentTypeTextTrailing = true + } + } + + const childEvents = tokenizer.events + /** @type {Array<[number, number]>} */ + const jumps = [] + /** @type {Record<string, number>} */ + const gaps = {} + /** @type {Array<Chunk>} */ + let stream + /** @type {Token | undefined} */ + let previous + let index = -1 + /** @type {Token | undefined} */ + let current = token + let adjust = 0 + let start = 0 + const breaks = [start] + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (current) { + // Find the position of the event for this token. + while (events.get(++startPosition)[1] !== current) { + // Empty. + } + + assert( + !previous || current.previous === previous, + 'expected previous to match' + ) + assert(!previous || previous.next === current, 'expected next to match') + + startPositions.push(startPosition) + + if (!current._tokenizer) { + stream = context.sliceStream(current) + + if (!current.next) { + stream.push(codes.eof) + } + + if (previous) { + tokenizer.defineSkip(current.start) + } + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true + } + + tokenizer.write(stream) + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined + } + } + + // Unravel the next token. + previous = current + current = current.next + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + current = token + + while (++index < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index][0] === 'exit' && + childEvents[index - 1][0] === 'enter' && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + assert(current, 'expected a current token') + start = index + 1 + breaks.push(start) + // Help GC. + current._tokenizer = undefined + current.previous = undefined + current = current.next + } + } + + // Help GC. + tokenizer.events = [] + + // If there’s one more token (which is the cases for lines that end in an + // EOF), that’s perfect: the last point we found starts it. + // If there isn’t then make sure any remaining content is added to it. + if (current) { + // Help GC. + current._tokenizer = undefined + current.previous = undefined + assert(!current.next, 'expected no next token') + } else { + breaks.pop() + } + + // Now splice the events from the subtokenizer into the current events, + // moving back to front so that splice indices aren’t affected. + index = breaks.length + + while (index--) { + const slice = childEvents.slice(breaks[index], breaks[index + 1]) + const start = startPositions.pop() + assert(start !== undefined, 'expected a start position when splicing') + jumps.push([start, start + slice.length - 1]) + events.splice(start, 2, slice) + } + + jumps.reverse() + index = -1 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps +} diff --git a/node_modules/micromark-util-subtokenize/index.d.ts b/node_modules/micromark-util-subtokenize/index.d.ts new file mode 100644 index 00000000..b252238a --- /dev/null +++ b/node_modules/micromark-util-subtokenize/index.d.ts @@ -0,0 +1,12 @@ +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +export function subtokenize(eventsArray: Array<Event>): boolean; +export { SpliceBuffer } from "./lib/splice-buffer.js"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark-util-subtokenize/index.d.ts.map b/node_modules/micromark-util-subtokenize/index.d.ts.map new file mode 100644 index 00000000..e0a024dc --- /dev/null +++ b/node_modules/micromark-util-subtokenize/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,yCANW,KAAK,CAAC,KAAK,CAAC,GAEV,OAAO,CAuHnB;;2BAvIqC,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark-util-subtokenize/index.js b/node_modules/micromark-util-subtokenize/index.js new file mode 100644 index 00000000..f046dc30 --- /dev/null +++ b/node_modules/micromark-util-subtokenize/index.js @@ -0,0 +1,228 @@ +/** + * @import {Chunk, Event, Token} from 'micromark-util-types' + */ + +import { splice } from 'micromark-util-chunked'; +import { SpliceBuffer } from './lib/splice-buffer.js'; + +// Hidden API exposed for testing. +export { SpliceBuffer } from './lib/splice-buffer.js'; + +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +// eslint-disable-next-line complexity +export function subtokenize(eventsArray) { + /** @type {Record<string, number>} */ + const jumps = {}; + let index = -1; + /** @type {Event} */ + let event; + /** @type {number | undefined} */ + let lineIndex; + /** @type {number} */ + let otherIndex; + /** @type {Event} */ + let otherEvent; + /** @type {Array<Event>} */ + let parameters; + /** @type {Array<Event>} */ + let subevents; + /** @type {boolean | undefined} */ + let more; + const events = new SpliceBuffer(eventsArray); + while (++index < events.length) { + while (index in jumps) { + index = jumps[index]; + } + event = events.get(index); + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { + otherIndex += 2; + } + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === "content") { + break; + } + if (subevents[otherIndex][1].type === "chunkText") { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index)); + index = jumps[index]; + more = true; + } + } + // Exit. + else if (event[1]._container) { + otherIndex = index; + lineIndex = undefined; + while (otherIndex--) { + otherEvent = events.get(otherIndex); + if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events.get(lineIndex)[1].type = "lineEndingBlank"; + } + otherEvent[1].type = "lineEnding"; + lineIndex = otherIndex; + } + } else if (otherEvent[1].type === "linePrefix" || otherEvent[1].type === "listItemIndent") { + // Move past. + } else { + break; + } + } + if (lineIndex) { + // Fix position. + event[1].end = { + ...events.get(lineIndex)[1].start + }; + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index); + parameters.unshift(event); + events.splice(lineIndex, index - lineIndex + 1, parameters); + } + } + } + + // The changes to the `events` buffer must be copied back into the eventsArray + splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)); + return !more; +} + +/** + * Tokenize embedded tokens. + * + * @param {SpliceBuffer<Event>} events + * Events. + * @param {number} eventIndex + * Index. + * @returns {Record<string, number>} + * Gaps. + */ +function subcontent(events, eventIndex) { + const token = events.get(eventIndex)[1]; + const context = events.get(eventIndex)[2]; + let startPosition = eventIndex - 1; + /** @type {Array<number>} */ + const startPositions = []; + let tokenizer = token._tokenizer; + if (!tokenizer) { + tokenizer = context.parser[token.contentType](token.start); + if (token._contentTypeTextTrailing) { + tokenizer._contentTypeTextTrailing = true; + } + } + const childEvents = tokenizer.events; + /** @type {Array<[number, number]>} */ + const jumps = []; + /** @type {Record<string, number>} */ + const gaps = {}; + /** @type {Array<Chunk>} */ + let stream; + /** @type {Token | undefined} */ + let previous; + let index = -1; + /** @type {Token | undefined} */ + let current = token; + let adjust = 0; + let start = 0; + const breaks = [start]; + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (current) { + // Find the position of the event for this token. + while (events.get(++startPosition)[1] !== current) { + // Empty. + } + startPositions.push(startPosition); + if (!current._tokenizer) { + stream = context.sliceStream(current); + if (!current.next) { + stream.push(null); + } + if (previous) { + tokenizer.defineSkip(current.start); + } + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true; + } + tokenizer.write(stream); + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined; + } + } + + // Unravel the next token. + previous = current; + current = current.next; + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + current = token; + while (++index < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) { + start = index + 1; + breaks.push(start); + // Help GC. + current._tokenizer = undefined; + current.previous = undefined; + current = current.next; + } + } + + // Help GC. + tokenizer.events = []; + + // If there’s one more token (which is the cases for lines that end in an + // EOF), that’s perfect: the last point we found starts it. + // If there isn’t then make sure any remaining content is added to it. + if (current) { + // Help GC. + current._tokenizer = undefined; + current.previous = undefined; + } else { + breaks.pop(); + } + + // Now splice the events from the subtokenizer into the current events, + // moving back to front so that splice indices aren’t affected. + index = breaks.length; + while (index--) { + const slice = childEvents.slice(breaks[index], breaks[index + 1]); + const start = startPositions.pop(); + jumps.push([start, start + slice.length - 1]); + events.splice(start, 2, slice); + } + jumps.reverse(); + index = -1; + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; + adjust += jumps[index][1] - jumps[index][0] - 1; + } + return gaps; +} \ No newline at end of file diff --git a/node_modules/micromark-util-subtokenize/license b/node_modules/micromark-util-subtokenize/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-subtokenize/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-subtokenize/package.json b/node_modules/micromark-util-subtokenize/package.json new file mode 100644 index 00000000..e085c487 --- /dev/null +++ b/node_modules/micromark-util-subtokenize/package.json @@ -0,0 +1,60 @@ +{ + "name": "micromark-util-subtokenize", + "version": "2.1.0", + "description": "micromark utility to tokenize subtokens", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "tokenize" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-subtokenize", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-depth": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-subtokenize/readme.md b/node_modules/micromark-util-subtokenize/readme.md new file mode 100644 index 00000000..75cf59c1 --- /dev/null +++ b/node_modules/micromark-util-subtokenize/readme.md @@ -0,0 +1,181 @@ +# micromark-util-subtokenize + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to tokenize subtokens. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`subtokenize(events)`](#subtokenizeevents) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a micromark internal that you probably don’t need. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-subtokenize +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {subtokenize} from 'https://esm.sh/micromark-util-subtokenize@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {subtokenize} from 'https://esm.sh/micromark-util-subtokenize@1?bundle' +</script> +``` + +## Use + +```js +import {subtokenize} from 'micromark-util-subtokenize' + +/** + * Content is transparent: it’s parsed right now. That way, definitions are also + * parsed right now: before text in paragraphs (specifically, media) are parsed. + * + * @type {Resolver} + */ +function resolveContent(events) { + subtokenize(events) + return events +} +``` + +## API + +This module exports the identifiers [`subtokenize`][api-subtokenize]. +There is no default export. + +### `subtokenize(events)` + +Tokenize subcontent. + +###### Parameters + +* `events` (`Array<Event>`) + — list of events + +###### Returns + +Whether subtokens were found (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-subtokenize@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-subtokenize]: #subtokenizeevents + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-util-subtokenize + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-subtokenize + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-subtokenize + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-subtokenize.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/micromark-util-symbol/license b/node_modules/micromark-util-symbol/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-symbol/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-symbol/package.json b/node_modules/micromark-util-symbol/package.json new file mode 100644 index 00000000..b557140a --- /dev/null +++ b/node_modules/micromark-util-symbol/package.json @@ -0,0 +1,43 @@ +{ + "name": "micromark-util-symbol", + "version": "2.0.1", + "description": "micromark utility with symbols", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "symbol" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-symbol", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "lib/" + ], + "exports": "./lib/default.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/node_modules/micromark-util-symbol/readme.md b/node_modules/micromark-util-symbol/readme.md new file mode 100644 index 00000000..4bad1772 --- /dev/null +++ b/node_modules/micromark-util-symbol/readme.md @@ -0,0 +1,168 @@ +# micromark-util-symbol + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility with symbols. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes constants used throughout the micromark ecosystem. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. +It’s useful to reference these constants by name instead of value while +developing. +[`micromark-build`][micromark-build] compiles them away for production code. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-symbol +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as symbol from 'https://esm.sh/micromark-util-symbol@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import * as symbol from 'https://esm.sh/micromark-util-symbol@1?bundle' +</script> +``` + +## Use + +```js +import {codes, constants, types, values} from 'micromark-util-symbol' + +console.log(codes.atSign) // 64 +console.log(constants.characterReferenceNamedSizeMax) // 31 +console.log(types.definitionDestinationRaw) // 'definitionDestinationRaw' +console.log(values.atSign) // '@' +``` + +## API + +This package exports the identifiers `codes`, `constants`, `types`, and +`values`. +There is no default export. + +Each identifier is an object mapping strings to values. +See the code for the exposed data. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-symbol@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-symbol.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-symbol + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-symbol + +[bundle-size]: https://bundlejs.com/?q=micromark-util-symbol + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-build]: https://github.com/micromark/micromark/tree/main/packages/micromark-build diff --git a/node_modules/micromark-util-types/index.d.ts b/node_modules/micromark-util-types/index.d.ts new file mode 100644 index 00000000..a960aff7 --- /dev/null +++ b/node_modules/micromark-util-types/index.d.ts @@ -0,0 +1,1312 @@ +// Note: this file is authored manually, not generated from `index.js`. + +/** + * A character code. + * + * This is often the same as what `String#charCodeAt()` yields but micromark + * adds meaning to certain other values. + * + * `null` represents the end of the input stream (called eof). + * Negative integers are used instead of certain sequences of characters (such + * as line endings and tabs). + */ +export type Code = number | null + +/** + * A chunk is either a character code or a slice of a buffer in the form of a + * string. + * + * Chunks are used because strings are more efficient storage that character + * codes, but limited in what they can represent. + */ +export type Chunk = Code | string + +/** + * Enumeration of the content types. + * + * Technically `document` is also a content type, which includes containers + * (lists, block quotes) and flow. + * As `ContentType` is used on tokens to define the type of subcontent but + * `document` is the highest level of content, so it’s not listed here. + * + * Containers in markdown come from the margin and include more constructs + * on the lines that define them. + * Take for example a block quote with a paragraph inside it (such as + * `> asd`). + * + * `flow` represents the sections, such as headings, code, and content, which + * is also parsed per line + * An example is HTML, which has a certain starting condition (such as + * `<script>` on its own line), then continues for a while, until an end + * condition is found (such as `</style>`). + * If that line with an end condition is never found, that flow goes until + * the end. + * + * `content` is zero or more definitions, and then zero or one paragraph. + * It’s a weird one, and needed to make certain edge cases around definitions + * spec compliant. + * Definitions are unlike other things in markdown, in that they behave like + * `text` in that they can contain arbitrary line endings, but *have* to end + * at a line ending. + * If they end in something else, the whole definition instead is seen as a + * paragraph. + * + * The content in markdown first needs to be parsed up to this level to + * figure out which things are defined, for the whole document, before + * continuing on with `text`, as whether a link or image reference forms or + * not depends on whether it’s defined. + * This unfortunately prevents a true streaming markdown to HTML compiler. + * + * `text` contains phrasing content such as attention (emphasis, strong), + * media (links, images), and actual text. + * + * `string` is a limited `text` like content type which only allows character + * references and character escapes. + * It exists in things such as identifiers (media references, definitions), + * titles, or URLs. + */ +export type ContentType = 'content' | 'document' | 'flow' | 'string' | 'text' + +/** + * A location in the document (`line`/`column`/`offset`) and chunk (`_index`, + * `_bufferIndex`). + * + * `_bufferIndex` is `-1` when `_index` points to a code chunk and it’s a + * non-negative integer when pointing to a string chunk. + * + * The interface for the location in the document comes from unist `Point`: + * <https://github.com/syntax-tree/unist#point> + */ +export interface Point { + /** + * Position in a string chunk (or `-1` when pointing to a numeric chunk). + */ + _bufferIndex: number + + /** + * Position in a list of chunks. + */ + _index: number + + /** + * 1-indexed column number. + */ + column: number + + /** + * 1-indexed line number. + */ + line: number + + /** + * 0-indexed position in the document. + */ + offset: number +} + +/** + * A token: a span of chunks. + * + * Tokens are what the core of micromark produces: the built in HTML compiler + * or other tools can turn them into different things. + * + * Tokens are essentially names attached to a slice of chunks, such as + * `lineEndingBlank` for certain line endings, or `codeFenced` for a whole + * fenced code. + * + * Sometimes, more info is attached to tokens, such as `_open` and `_close` + * by `attention` (strong, emphasis) to signal whether the sequence can open + * or close an attention run. + * + * Linked tokens are used because outer constructs are parsed first. + * Take for example: + * + * ```markdown + * > *a + * b*. + * ``` + * + * 1. The block quote marker and the space after it is parsed first + * 2. The rest of the line is a `chunkFlow` token + * 3. The two spaces on the second line are a `linePrefix` + * 4. The rest of the line is another `chunkFlow` token + * + * The two `chunkFlow` tokens are linked together. + * The chunks they span are then passed through the flow tokenizer. + */ +export interface Token { + /** + * Token type. + */ + type: TokenType + + /** + * Point where the token starts. + */ + start: Point + + /** + * Point where the token ends. + */ + end: Point + + /** + * The previous token in a list of linked tokens. + */ + previous?: Token | undefined + + /** + * The next token in a list of linked tokens. + */ + next?: Token | undefined + + /** + * Declares a token as having content of a certain type. + */ + contentType?: ContentType | undefined + + /** + * Declares that trailing whitespace is sensitive, + * is allowed, + * when `contentType` is `text` (or `string`). + * Normally, + * trailing spaces and tabs are dropped. + */ + _contentTypeTextTrailing?: boolean | undefined + + /** + * Connected tokenizer. + * + * Used when dealing with linked tokens. + * A child tokenizer is needed to tokenize them, which is stored on those + * tokens. + */ + _tokenizer?: TokenizeContext | undefined + + /** + * Field to help parse attention. + * + * Depending on the character before sequences (`**`), the sequence can open, + * close, both, or none. + */ + _open?: boolean | undefined + + /** + * Field to help parse attention. + * + * Depending on the character before sequences (`**`), the sequence can open, + * close, both, or none. + */ + _close?: boolean | undefined + + /** + * Field to help parse GFM task lists. + * + * This boolean is used internally to figure out if a token is in the first + * content of a list item construct. + */ + _isInFirstContentOfListItem?: boolean | undefined + + /** + * Field to help parse containers. + * + * This boolean is used internally to figure out if a token is a container + * token. + */ + _container?: boolean | undefined + + /** + * Field to help parse lists. + * + * This boolean is used internally to figure out if a list is loose or not. + */ + _loose?: boolean | undefined + + /** + * Field to help parse links. + * + * This boolean is used internally to figure out if a link opening + * can’t be used (because links in links are incorrect). + */ + _inactive?: boolean | undefined + + /** + * Field to help parse links. + * + * This boolean is used internally to figure out if a link opening is + * balanced: it’s not a link opening but has a balanced closing. + */ + _balanced?: boolean | undefined +} + +/** + * The start or end of a token amongst other events. + * + * Tokens can “contain” other tokens, even though they are stored in a flat + * list, through `enter`ing before them, and `exit`ing after them. + */ +export type Event = ['enter' | 'exit', Token, TokenizeContext] + +/** + * Open a token. + * + * @param type + * Token type. + * @param fields + * Extra fields. + * @returns {Token} + * Token. + */ +export type Enter = ( + type: TokenType, + fields?: Omit<Partial<Token>, 'type'> | undefined +) => Token + +/** + * Close a token. + * + * @param type + * Token type. + * @returns + * Token. + */ +export type Exit = (type: TokenType) => Token + +/** + * Deal with the character and move to the next. + * + * @param code + * Current code. + */ +export type Consume = (code: Code) => undefined + +/** + * Attempt deals with several values, and tries to parse according to those + * values. + * + * If a value resulted in `ok`, it worked, the tokens that were made are used, + * and `ok` is switched to. + * If the result is `nok`, the attempt failed, so we revert to the original + * state, and `nok` is used. + * + * @param construct + * Construct(s) to try. + * @param ok + * State to move to when successful. + * @param nok + * State to move to when unsuccessful. + * @returns + * Next state. + */ +export type Attempt = ( + construct: Array<Construct> | ConstructRecord | Construct, + ok: State, + nok?: State | undefined +) => State + +/** + * A context object to transition the state machine. + */ +export interface Effects { + /** + * Try to tokenize a construct. + */ + attempt: Attempt + + /** + * Attempt, then revert. + */ + check: Attempt + + /** + * Deal with the character and move to the next. + */ + consume: Consume + + /** + * Start a new token. + */ + enter: Enter + + /** + * End a started token. + */ + exit: Exit + + /** + * Interrupt is used for stuff right after a line of content. + */ + interrupt: Attempt +} + +/** + * The main unit in the state machine: a function that gets a character code + * and has certain effects. + * + * A state function should return another function: the next + * state-as-a-function to go to. + * + * But there is one case where they return `undefined`: for the eof character + * code (at the end of a value). + * The reason being: well, there isn’t any state that makes sense, so + * `undefined` works well. + * Practically that has also helped: if for some reason it was a mistake, then + * an exception is throw because there is no next function, meaning it + * surfaces early. + * + * @param code + * Current code. + * @returns + * Next state. + */ +export type State = (code: Code) => State | undefined + +/** + * A resolver handles and cleans events coming from `tokenize`. + * + * @param events + * List of events. + * @param context + * Tokenize context. + * @returns + * The given, modified, events. + */ +export type Resolver = ( + events: Array<Event>, + context: TokenizeContext +) => Array<Event> + +/** + * A tokenize function sets up a state machine to handle character codes streaming in. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @param ok + * State to go to when successful. + * @param nok + * State to go to when unsuccessful. + * @returns + * First state. + */ +export type Tokenizer = ( + this: TokenizeContext, + effects: Effects, + ok: State, + nok: State +) => State + +/** + * Like a tokenizer, but without `ok` or `nok`. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @returns + * First state. + */ +export type Initializer = (this: TokenizeContext, effects: Effects) => State + +/** + * Like a tokenizer, but without `ok` or `nok`, and returning `undefined`. + * + * This is the final hook when a container must be closed. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @returns + * Nothing. + */ +export type Exiter = (this: TokenizeContext, effects: Effects) => undefined + +/** + * Guard whether `code` can come before the construct. + * + * In certain cases a construct can hook into many potential start characters. + * Instead of setting up an attempt to parse that construct for most + * characters, this is a speedy way to reduce that. + * + * @param this + * Tokenize context. + * @param code + * Previous code. + * @returns + * Whether `code` is allowed before. + */ +export type Previous = (this: TokenizeContext, code: Code) => boolean + +/** + * An object describing how to parse a markdown construct. + */ +export interface Construct { + /** + * Whether the construct, when in a `ConstructRecord`, precedes over existing + * constructs for the same character code when merged. + * + * The default is that new constructs precede over existing ones. + */ + add?: 'after' | 'before' | undefined + + /** + * Concrete constructs cannot be interrupted by more containers. + * + * For example, when parsing the document (containers, such as block quotes + * and lists) and this construct is parsing fenced code: + * + * ````markdown + * > ```js + * > - list? + * ```` + * + * …then `- list?` cannot form if this fenced code construct is concrete. + * + * An example of a construct that is not concrete is a GFM table: + * + * ````markdown + * | a | + * | - | + * > | b | + * ```` + * + * …`b` is not part of the table. + */ + concrete?: boolean | undefined + + /** + * For containers, a continuation construct. + */ + continuation?: Construct | undefined + + /** + * For containers, a final hook. + */ + exit?: Exiter | undefined + + /** + * Name of the construct, used to toggle constructs off. + * + * Named constructs must not be `partial`. + */ + name?: string | undefined + + /** + * Whether this construct represents a partial construct. + * + * Partial constructs must not have a `name`. + */ + partial?: boolean | undefined + + /** + * Guard whether the previous character can come before the construct. + */ + previous?: Previous | undefined + + /** + * Resolve all events when the content is complete, from the start to the end. + * Only used if `tokenize` is successful once in the content. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolveAll` is called *if* at least one + * character reference is found, ranging from the start to the end of the link + * title to the end. + */ + resolveAll?: Resolver | undefined + + /** + * Resolve the events from the start of the content (which includes other + * constructs) to the last one parsed by `tokenize`. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolveTo` is called with the events + * ranging from the start of the link title to the end of a character + * reference each time one is found. + */ + resolveTo?: Resolver | undefined + + /** + * Resolve the events parsed by `tokenize`. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolve` is called with the events + * ranging from the start to the end of a character reference each time one is + * found. + */ + resolve?: Resolver | undefined + + /** + * Set up a state machine to handle character codes streaming in. + */ + tokenize: Tokenizer +} + +/** + * Like a construct, but `tokenize` does not accept `ok` or `nok`. + */ +export interface InitialConstruct extends Omit<Construct, 'tokenize'> { + tokenize: Initializer +} + +/** + * Several constructs, mapped from their initial codes. + */ +export type ConstructRecord = Record< + string, + Array<Construct> | Construct | undefined +> + +/** + * State shared between container calls. + */ +export interface ContainerState { + /** + * Special field to close the current flow (or containers). + */ + _closeFlow?: boolean | undefined + + /** + * Whether there are further blank lines, used by lists. + */ + furtherBlankLines?: boolean | undefined + + /** + * Whether there first line is blank, used by lists. + */ + initialBlankLine?: boolean | undefined + + /** + * Current marker, used by lists. + */ + marker?: Code | undefined + + /** + * Used by block quotes. + */ + open?: boolean | undefined + + /** + * Current size, used by lists. + */ + size?: number | undefined + + /** + * Current token type, used by lists. + */ + type?: TokenType | undefined +} + +/** + * A context object that helps w/ tokenizing markdown constructs. + */ +export interface TokenizeContext { + // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer + // needed in micromark-extension-gfm-table@1.0.6). + /** + * Internal boolean shared with `micromark-extension-gfm-table` whose body + * rows are not affected by normal interruption rules. + * “Normal” rules are, for example, that an empty list item can’t interrupt: + * + * ````markdown + * a + * * + * ```` + * + * The above is one paragraph. + * These rules don’t apply to table body rows: + * + * ````markdown + * | a | + * | - | + * * + * ```` + * + * The above list interrupts the table. + */ + _gfmTableDynamicInterruptHack?: boolean + + /** + * Internal boolean shared with `micromark-extension-gfm-task-list-item` to + * signal whether the tokenizer is tokenizing the first content of a list item + * construct. + */ + _gfmTasklistFirstContentOfListItem?: boolean | undefined + + /** + * Declares that trailing whitespace is sensitive, + * is allowed, + * when tokenizing `text` (or `string`). + * Normally, + * trailing spaces and tabs are dropped. + */ + _contentTypeTextTrailing?: boolean | undefined + + /** + * Current code. + */ + code: Code + + /** + * Share state set when parsing containers. + * + * Containers are parsed in separate phases: their first line (`tokenize`), + * continued lines (`continuation.tokenize`), and finally `exit`. + * This record can be used to store some information between these hooks. + */ + containerState?: ContainerState | undefined + + /** + * The current construct. + * + * Constructs that are not `partial` are set here. + */ + currentConstruct?: Construct | undefined + + /** + * Current list of events. + */ + events: Array<Event> + + /** + * Whether we’re currently interrupting. + * + * Take for example: + * + * ```markdown + * a + * # b + * ``` + * + * At 2:1, we’re “interrupting”. + */ + interrupt?: boolean | undefined + + /** + * The relevant parsing context. + */ + parser: ParseContext + + /** + * The previous code. + */ + previous: Code + + /** + * Define a skip + * + * As containers (block quotes, lists), “nibble” a prefix from the margins, + * where a line starts after that prefix is defined here. + * When the tokenizers moves after consuming a line ending corresponding to + * the line number in the given point, the tokenizer shifts past the prefix + * based on the column in the shifted point. + * + * @param point + * Skip. + * @returns + * Nothing. + */ + defineSkip(point: Point): undefined + + /** + * Get the current place. + * + * @returns + * Current point. + */ + now(): Point + + /** + * Get the source text that spans a token (or location). + * + * @param token + * Start/end in stream. + * @param expandTabs + * Whether to expand tabs. + * @returns + * Serialized chunks. + */ + sliceSerialize( + token: Pick<Token, 'end' | 'start'>, + expandTabs?: boolean | undefined + ): string + + /** + * Get the chunks that span a token (or location). + * + * @param token + * Start/end in stream. + * @returns + * List of chunks. + */ + sliceStream(token: Pick<Token, 'end' | 'start'>): Array<Chunk> + + /** + * Write a slice of chunks. + * + * The eof code (`null`) can be used to signal the end of the stream. + * + * @param slice + * Chunks. + * @returns + * Events. + */ + write(slice: Array<Chunk>): Array<Event> +} + +/** + * Encodings supported by `TextEncoder`. + * + * Arbitrary encodings can be supported depending on how the engine is built. + * So any string *could* be valid. + * But you probably want `utf-8`. + */ +export type Encoding = + // Encodings supported in Node by default or when built with the small-icu option. + // Does not include aliases. + | 'utf-8' // Always supported in Node. + | 'utf-16le' // Always supported in Node. + | 'utf-16be' // Not supported when ICU is disabled. + // Everything else (depends on browser, or full ICU data). + // eslint-disable-next-line @typescript-eslint/ban-types + | (string & {}) + +/** + * Contents of the file. + * + * Can either be text, or a `Uint8Array` like structure. + */ +export type Value = Uint8Array | string + +/** + * A syntax extension changes how markdown is tokenized. + * + * See: <https://github.com/micromark/micromark#syntaxextension> + */ +export interface Extension { + attentionMarkers?: {null?: Array<Code> | undefined} | undefined + contentInitial?: ConstructRecord | undefined + disable?: {null?: Array<string> | undefined} | undefined + document?: ConstructRecord | undefined + flowInitial?: ConstructRecord | undefined + flow?: ConstructRecord | undefined + insideSpan?: + | {null?: Array<Pick<Construct, 'resolveAll'>> | undefined} + | undefined + string?: ConstructRecord | undefined + text?: ConstructRecord | undefined +} + +/** + * A filtered, combined, extension. + */ +export type NormalizedExtension = { + [Key in keyof Extension]: Exclude<Extension[Key], undefined> +} + +/** + * A full, filtereed, normalized, extension. + */ +export type FullNormalizedExtension = { + [Key in keyof Extension]-?: Exclude<Extension[Key], undefined> +} + +/** + * Create a context. + * + * @param from + * Where to create from. + * @returns + * Context. + */ +export type Create = ( + from?: Omit<Point, '_bufferIndex' | '_index'> | undefined +) => TokenizeContext + +/** + * Config defining how to parse. + */ +export interface ParseOptions { + /** + * Array of syntax extensions (default: `[]`). + */ + extensions?: Array<Extension> | null | undefined +} + +/** + * A context object that helps w/ parsing markdown. + */ +export interface ParseContext { + /** + * All constructs. + */ + constructs: FullNormalizedExtension + + /** + * List of defined identifiers. + */ + defined: Array<string> + + /** + * Map of line numbers to whether they are lazy (as opposed to the line before + * them). + * Take for example: + * + * ```markdown + * > a + * b + * ``` + * + * L1 here is not lazy, L2 is. + */ + lazy: Record<number, boolean> + + /** + * Create a content tokenizer. + */ + content: Create + + /** + * Create a document tokenizer. + */ + document: Create + + /** + * Create a flow tokenizer. + */ + flow: Create + + /** + * Create a string tokenizer. + */ + string: Create + + /** + * Create a text tokenizer. + */ + text: Create +} + +/** + * HTML compiler context. + */ +export interface CompileContext { + /** + * Configuration passed by the user. + */ + options: CompileOptions + + /** + * Capture some of the output data. + * + * @returns + * Nothing. + */ + buffer(): undefined + + /** + * Make a value safe for injection in HTML (except w/ `ignoreEncode`). + * + * @param value + * Raw value. + * @returns + * Safe value. + */ + encode(value: string): string + + /** + * Get data from the key-value store. + * + * @param key + * Key. + * @returns + * Value at `key` in compile data. + */ + getData<Key extends keyof CompileData>(key: Key): CompileData[Key] + + /** + * Output an extra line ending if the previous value wasn’t EOF/EOL. + * + * @returns + * Nothing. + */ + lineEndingIfNeeded(): undefined + + /** + * Output raw data. + * + * @param value + * Raw value. + * @returns + * Nothing. + */ + raw(value: string): undefined + + /** + * Stop capturing and access the output data. + * + * @returns + * Captured data. + */ + resume(): string + + /** + * Set data into the key-value store. + * + * @param key + * Key. + * @param value + * Value. + * @returns + * Nothing. + */ + setData<Key extends keyof CompileData>( + key: Key, + value?: CompileData[Key] + ): undefined + + /** + * Get the string value of a token. + * + * @param token + * Start/end in stream. + * @param expandTabs + * Whether to expand tabs. + * @returns + * Serialized chunks. + */ + sliceSerialize( + token: Pick<Token, 'end' | 'start'>, + expandTabs?: boolean | undefined + ): string + + /** + * Output (parts of) HTML tags. + * + * @param value + * Raw value. + * @returns + * Nothing. + */ + tag(value: string): undefined +} + +/** + * Serialize micromark events as HTML. + */ +export type Compile = (events: Array<Event>) => string + +/** + * Handle one token. + * + * @param token + * Token. + * @returns + * Nothing. + */ +export type Handle = (this: CompileContext, token: Token) => undefined + +/** + * Handle the whole document. + * + * @returns + * Nothing. + */ +export type DocumentHandle = ( + this: Omit<CompileContext, 'sliceSerialize'> +) => undefined + +/** + * Token types mapping to handles. + */ +export interface Handles extends Partial<Record<TokenType, Handle>> { + /** + * Document handle. + */ + null?: DocumentHandle +} + +/** + * Normalized extenion. + */ +export interface HtmlExtension { + enter?: Handles | undefined + exit?: Handles | undefined +} + +/** + * An HTML extension changes how markdown tokens are serialized. + */ +export type NormalizedHtmlExtension = { + [Key in keyof HtmlExtension]-?: Exclude<HtmlExtension[Key], undefined> +} + +/** + * Definition. + */ +export interface Definition { + /** + * Destination. + */ + destination?: string | undefined + /** + * Title. + */ + title?: string | undefined +} + +/** + * State tracked to compile events as HTML. + */ +export interface CompileData { + /** + * Whether the first list item is expected, used by lists. + */ + expectFirstItem?: boolean | undefined + + /** + * Current character reference kind. + */ + characterReferenceType?: string | undefined + + /** + * Collected definitions. + */ + definitions: Record<string, Definition> + + /** + * Whether we’re in fenced code, used by code (fenced). + */ + fencedCodeInside?: boolean | undefined + + /** + * Number of fences that were seen, used by code (fenced). + */ + fencesCount?: number | undefined + + /** + * Whether we’ve seen code data, used by code (fenced, indented). + */ + flowCodeSeenData?: boolean | undefined + + /** + * Current heading rank, used by heading (atx, setext). + */ + headingRank?: number | undefined + + /** + * Ignore encoding unsafe characters, used for example for URLs which are + * first percent encoded, or by HTML when supporting it. + */ + ignoreEncode?: boolean | undefined + + /** + * Whether we’re in code data, used by code (text). + */ + inCodeText?: boolean | undefined + + /** + * Whether the last emitted value was a tag. + */ + lastWasTag?: boolean | undefined + + /** + * Whether to slurp all future line endings (has to be unset manually). + */ + slurpAllLineEndings?: boolean | undefined + + /** + * Whether to slurp the next line ending (resets itself on the next line + * ending). + */ + slurpOneLineEnding?: boolean | undefined + + /** + * Stack of containers, whether they’re tight or not. + */ + tightStack: Array<boolean> +} + +/** + * Type of line ending in markdown. + */ +export type LineEnding = '\r' | '\n' | '\r\n' + +/** + * Compile options. + */ +export interface CompileOptions { + /** + * Whether to allow (dangerous) HTML (`boolean`, default: `false`). + * + * The default is `false`, which still parses the HTML according to + * `CommonMark` but shows the HTML as text instead of as elements. + * + * Pass `true` for trusted content to get actual HTML elements. + */ + allowDangerousHtml?: boolean | null | undefined + + /** + * Whether to allow dangerous protocols in links and images (`boolean`, + * default: `false`). + * + * The default is `false`, which drops URLs in links and images that use + * dangerous protocols. + * + * Pass `true` for trusted content to support all protocols. + * + * URLs that have no protocol (which means it’s relative to the current page, + * such as `./some/page.html`) and URLs that have a safe protocol (for + * images: `http`, `https`; for links: `http`, `https`, `irc`, `ircs`, + * `mailto`, `xmpp`), are safe. + * All other URLs are dangerous and dropped. + */ + allowDangerousProtocol?: boolean | null | undefined + + /** + * Default line ending to use when compiling to HTML, for line endings not in + * `value`. + * + * Generally, `micromark` copies line endings (`\r`, `\n`, `\r\n`) in the + * markdown document over to the compiled HTML. + * In some cases, such as `> a`, CommonMark requires that extra line endings + * are added: `<blockquote>\n<p>a</p>\n</blockquote>`. + * + * To create that line ending, the document is checked for the first line + * ending that is used. + * If there is no line ending, `defaultLineEnding` is used. + * If that isn’t configured, `\n` is used. + */ + defaultLineEnding?: LineEnding | null | undefined + + /** + * Array of HTML extensions (default: `[]`). + */ + htmlExtensions?: Array<HtmlExtension> | null | undefined +} + +/** + * Configuration. + */ +export type Options = CompileOptions & ParseOptions + +/** + * Enum of allowed token types. + */ +export type TokenType = keyof TokenTypeMap + +// Note: when changing the next interface, you likely also have to change +// `micromark-util-symbol`. +/** + * Map of allowed token types. + */ +export interface TokenTypeMap { + // Note: these are compiled away. + attentionSequence: 'attentionSequence' // To do: remove. + space: 'space' // To do: remove. + + data: 'data' + whitespace: 'whitespace' + lineEnding: 'lineEnding' + lineEndingBlank: 'lineEndingBlank' + linePrefix: 'linePrefix' + lineSuffix: 'lineSuffix' + atxHeading: 'atxHeading' + atxHeadingSequence: 'atxHeadingSequence' + atxHeadingText: 'atxHeadingText' + autolink: 'autolink' + autolinkEmail: 'autolinkEmail' + autolinkMarker: 'autolinkMarker' + autolinkProtocol: 'autolinkProtocol' + characterEscape: 'characterEscape' + characterEscapeValue: 'characterEscapeValue' + characterReference: 'characterReference' + characterReferenceMarker: 'characterReferenceMarker' + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric' + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal' + characterReferenceValue: 'characterReferenceValue' + codeFenced: 'codeFenced' + codeFencedFence: 'codeFencedFence' + codeFencedFenceSequence: 'codeFencedFenceSequence' + codeFencedFenceInfo: 'codeFencedFenceInfo' + codeFencedFenceMeta: 'codeFencedFenceMeta' + codeFlowValue: 'codeFlowValue' + codeIndented: 'codeIndented' + codeText: 'codeText' + codeTextData: 'codeTextData' + codeTextPadding: 'codeTextPadding' + codeTextSequence: 'codeTextSequence' + content: 'content' + definition: 'definition' + definitionDestination: 'definitionDestination' + definitionDestinationLiteral: 'definitionDestinationLiteral' + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker' + definitionDestinationRaw: 'definitionDestinationRaw' + definitionDestinationString: 'definitionDestinationString' + definitionLabel: 'definitionLabel' + definitionLabelMarker: 'definitionLabelMarker' + definitionLabelString: 'definitionLabelString' + definitionMarker: 'definitionMarker' + definitionTitle: 'definitionTitle' + definitionTitleMarker: 'definitionTitleMarker' + definitionTitleString: 'definitionTitleString' + emphasis: 'emphasis' + emphasisSequence: 'emphasisSequence' + emphasisText: 'emphasisText' + escapeMarker: 'escapeMarker' + hardBreakEscape: 'hardBreakEscape' + hardBreakTrailing: 'hardBreakTrailing' + htmlFlow: 'htmlFlow' + htmlFlowData: 'htmlFlowData' + htmlText: 'htmlText' + htmlTextData: 'htmlTextData' + image: 'image' + label: 'label' + labelText: 'labelText' + labelLink: 'labelLink' + labelImage: 'labelImage' + labelMarker: 'labelMarker' + labelImageMarker: 'labelImageMarker' + labelEnd: 'labelEnd' + link: 'link' + paragraph: 'paragraph' + reference: 'reference' + referenceMarker: 'referenceMarker' + referenceString: 'referenceString' + resource: 'resource' + resourceDestination: 'resourceDestination' + resourceDestinationLiteral: 'resourceDestinationLiteral' + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker' + resourceDestinationRaw: 'resourceDestinationRaw' + resourceDestinationString: 'resourceDestinationString' + resourceMarker: 'resourceMarker' + resourceTitle: 'resourceTitle' + resourceTitleMarker: 'resourceTitleMarker' + resourceTitleString: 'resourceTitleString' + setextHeading: 'setextHeading' + setextHeadingText: 'setextHeadingText' + setextHeadingLine: 'setextHeadingLine' + setextHeadingLineSequence: 'setextHeadingLineSequence' + strong: 'strong' + strongSequence: 'strongSequence' + strongText: 'strongText' + thematicBreak: 'thematicBreak' + thematicBreakSequence: 'thematicBreakSequence' + blockQuote: 'blockQuote' + blockQuotePrefix: 'blockQuotePrefix' + blockQuoteMarker: 'blockQuoteMarker' + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace' + listOrdered: 'listOrdered' + listUnordered: 'listUnordered' + listItemIndent: 'listItemIndent' + listItemMarker: 'listItemMarker' + listItemPrefix: 'listItemPrefix' + listItemPrefixWhitespace: 'listItemPrefixWhitespace' + listItemValue: 'listItemValue' + chunkDocument: 'chunkDocument' + chunkContent: 'chunkContent' + chunkFlow: 'chunkFlow' + chunkText: 'chunkText' + chunkString: 'chunkString' +} diff --git a/node_modules/micromark-util-types/index.js b/node_modules/micromark-util-types/index.js new file mode 100644 index 00000000..00d55de7 --- /dev/null +++ b/node_modules/micromark-util-types/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts`. +export {} diff --git a/node_modules/micromark-util-types/license b/node_modules/micromark-util-types/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark-util-types/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark-util-types/package.json b/node_modules/micromark-util-types/package.json new file mode 100644 index 00000000..b56d6483 --- /dev/null +++ b/node_modules/micromark-util-types/package.json @@ -0,0 +1,71 @@ +{ + "name": "micromark-util-types", + "version": "2.0.2", + "description": "micromark utility with a couple of typescript types", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "typescript", + "types" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-types", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "unicorn/text-encoding-identifier-case": "off" + } + } +} diff --git a/node_modules/micromark-util-types/readme.md b/node_modules/micromark-util-types/readme.md new file mode 100644 index 00000000..361624a3 --- /dev/null +++ b/node_modules/micromark-util-types/readme.md @@ -0,0 +1,151 @@ +# micromark-util-types + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility package with TypeScript types. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes TypeScript types shared throughout the micromark +ecosystem. + +## When should I use this? + +This package is useful when you are making your own, typed, micromark +extensions. + +## Install + +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-types +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import type {Point, /* … */} from 'https://esm.sh/micromark-util-types@1' +``` + +## Use + +```js +/** + * @import {Point} from 'micromark-util-types' + */ +``` + +## API + +This module exports no identifiers. +There is no default export. + +See [the code][code] for all about the exposed types. + +## Types + +This package is just [TypeScript][] types. +It exports lots of different types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-types@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-util-encode + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-encode + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[code]: https://github.com/micromark/micromark/blob/main/packages/micromark-util-types/index.d.ts + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-encode + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-encode.svg + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/micromark/dev/index.d.ts b/node_modules/micromark/dev/index.d.ts new file mode 100644 index 00000000..46d294ea --- /dev/null +++ b/node_modules/micromark/dev/index.d.ts @@ -0,0 +1,82 @@ +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, encoding: Encoding | null | undefined, options?: Options | null | undefined): string; +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, options?: Options | null | undefined): string; +export { compile } from "./lib/compile.js"; +export { parse } from "./lib/parse.js"; +export { postprocess } from "./lib/postprocess.js"; +export { preprocess } from "./lib/preprocess.js"; +export type Options = import("micromark-util-types").Options; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark/dev/index.d.ts.map b/node_modules/micromark/dev/index.d.ts.map new file mode 100644 index 00000000..be751c43 --- /dev/null +++ b/node_modules/micromark/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG,iCACQ,KAAK,YAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,YAG3B,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCACQ,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;sBAvCU,OAAO,sBAAsB,EAAE,OAAO;2BAJjB,sBAAsB;8BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark/dev/index.js b/node_modules/micromark/dev/index.js new file mode 100644 index 00000000..e608e4db --- /dev/null +++ b/node_modules/micromark/dev/index.js @@ -0,0 +1,68 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +import {compile} from './lib/compile.js' +import {parse} from './lib/parse.js' +import {postprocess} from './lib/postprocess.js' +import {preprocess} from './lib/preprocess.js' + +export {compile} from './lib/compile.js' +export {parse} from './lib/parse.js' +export {postprocess} from './lib/postprocess.js' +export {preprocess} from './lib/preprocess.js' + +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compile(options)( + postprocess( + parse(options) + .document() + .write(preprocess()(value, encoding, true)) + ) + ) +} diff --git a/node_modules/micromark/dev/stream.d.ts b/node_modules/micromark/dev/stream.d.ts new file mode 100644 index 00000000..2b05447e --- /dev/null +++ b/node_modules/micromark/dev/stream.d.ts @@ -0,0 +1,35 @@ +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options?: Options | null | undefined): MinimalDuplex; +export type Options = import("micromark-util-types").Options; +/** + * Function called when write was successful. + */ +export type Callback = () => undefined; +/** + * Configuration for piping. + */ +export type PipeOptions = { + /** + * Whether to end the destination stream when the source stream ends. + */ + end?: boolean | null | undefined; +}; +/** + * Duplex stream. + */ +export type MinimalDuplex = Omit<NodeJS.ReadableStream & NodeJS.WritableStream, "isPaused" | "pause" | "read" | "resume" | "setEncoding" | "unpipe" | "unshift" | "wrap">; +//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark/dev/stream.d.ts.map b/node_modules/micromark/dev/stream.d.ts.map new file mode 100644 index 00000000..f89c748f --- /dev/null +++ b/node_modules/micromark/dev/stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["stream.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;GAcG;AACH,iCALW,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,aAAa,CAoOzB;sBAxQY,OAAO,sBAAsB,EAAE,OAAO;;;;6BAMtC,SAAS;;;;;;;;UAKR,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;4BAG3B,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/micromark/dev/stream.js b/node_modules/micromark/dev/stream.js new file mode 100644 index 00000000..a72962bc --- /dev/null +++ b/node_modules/micromark/dev/stream.js @@ -0,0 +1,270 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +/** + * @callback Callback + * Function called when write was successful. + * @returns {undefined} + * Nothing. + * + * @typedef PipeOptions + * Configuration for piping. + * @property {boolean | null | undefined} [end] + * Whether to end the destination stream when the source stream ends. + * + * @typedef {Omit<NodeJS.ReadableStream & NodeJS.WritableStream, 'isPaused' | 'pause' | 'read' | 'resume' | 'setEncoding' | 'unpipe' | 'unshift' | 'wrap'>} MinimalDuplex + * Duplex stream. + */ + +import {EventEmitter} from 'node:events' +import {compile} from './lib/compile.js' +import {parse} from './lib/parse.js' +import {postprocess} from './lib/postprocess.js' +import {preprocess} from './lib/preprocess.js' + +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options) { + const prep = preprocess() + const tokenize = parse(options).document().write + const comp = compile(options) + /** @type {boolean} */ + let ended + + const emitter = /** @type {MinimalDuplex} */ (new EventEmitter()) + // @ts-expect-error: fine. + emitter.end = end + emitter.pipe = pipe + emitter.readable = true + emitter.writable = true + // @ts-expect-error: fine. + emitter.write = write + + return emitter + + /** + * Write a chunk into memory. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + if (ended) { + throw new Error('Did not expect `write` after `end`') + } + + tokenize(prep(chunk || '', encoding)) + + if (callback) { + callback() + } + + // Signal successful write. + return true + } + + /** + * End the writing. + * + * Passes all arguments as a final `write`. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Callback | Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function end(chunk, encoding, callback) { + if (typeof chunk === 'function') { + encoding = chunk + chunk = undefined + } + + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + write(chunk, encoding, callback) + + emitter.emit('data', comp(postprocess(tokenize(prep('', encoding, true))))) + + emitter.emit('end') + ended = true + return true + } + + /** + * Pipe the processor into a writable stream. + * + * Basically `Stream#pipe`, but inlined and simplified to keep the bundled + * size down. + * See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>. + * + * @template {NodeJS.WritableStream} Stream + * Writable stream. + * @param {Stream} destination + * Stream to pipe into. + * @param {PipeOptions | null | undefined} [options] + * Configuration. + * @returns {Stream} + * Destination stream. + */ + function pipe(destination, options) { + emitter.on('data', ondata) + emitter.on('error', onerror) + emitter.on('end', cleanup) + emitter.on('close', cleanup) + + // If the `end` option is not supplied, `destination.end()` will be + // called when the `end` or `close` events are received. + // @ts-expect-error `_isStdio` is available on `std{err,out}` + if (!destination._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend) + } + + destination.on('error', onerror) + destination.on('close', cleanup) + + destination.emit('pipe', emitter) + + return destination + + /** + * End destination stream. + * + * @returns {undefined} + * Nothing. + */ + function onend() { + if (destination.end) { + destination.end() + } + } + + /** + * Handle data. + * + * @param {string} chunk + * Data. + * @returns {undefined} + * Nothing. + */ + function ondata(chunk) { + if (destination.writable) { + destination.write(chunk) + } + } + + /** + * Clean listeners. + * + * @returns {undefined} + * Nothing. + */ + function cleanup() { + emitter.removeListener('data', ondata) + emitter.removeListener('end', onend) + emitter.removeListener('error', onerror) + emitter.removeListener('end', cleanup) + emitter.removeListener('close', cleanup) + + destination.removeListener('error', onerror) + destination.removeListener('close', cleanup) + } + + /** + * Close dangling pipes and handle unheard errors. + * + * @param {Error | null | undefined} [error] + * Error, if any. + * @returns {undefined} + * Nothing. + */ + function onerror(error) { + cleanup() + + if (!emitter.listenerCount('error')) { + throw error // Unhandled stream error in pipe. + } + } + } +} diff --git a/node_modules/micromark/index.d.ts b/node_modules/micromark/index.d.ts new file mode 100644 index 00000000..46d294ea --- /dev/null +++ b/node_modules/micromark/index.d.ts @@ -0,0 +1,82 @@ +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, encoding: Encoding | null | undefined, options?: Options | null | undefined): string; +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, options?: Options | null | undefined): string; +export { compile } from "./lib/compile.js"; +export { parse } from "./lib/parse.js"; +export { postprocess } from "./lib/postprocess.js"; +export { preprocess } from "./lib/preprocess.js"; +export type Options = import("micromark-util-types").Options; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark/index.d.ts.map b/node_modules/micromark/index.d.ts.map new file mode 100644 index 00000000..be751c43 --- /dev/null +++ b/node_modules/micromark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG,iCACQ,KAAK,YAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,YAG3B,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCACQ,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;sBAvCU,OAAO,sBAAsB,EAAE,OAAO;2BAJjB,sBAAsB;8BAAtB,sBAAsB"} \ No newline at end of file diff --git a/node_modules/micromark/index.js b/node_modules/micromark/index.js new file mode 100644 index 00000000..1977e060 --- /dev/null +++ b/node_modules/micromark/index.js @@ -0,0 +1,60 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +import { compile } from './lib/compile.js'; +import { parse } from './lib/parse.js'; +import { postprocess } from './lib/postprocess.js'; +import { preprocess } from './lib/preprocess.js'; +export { compile } from './lib/compile.js'; +export { parse } from './lib/parse.js'; +export { postprocess } from './lib/postprocess.js'; +export { preprocess } from './lib/preprocess.js'; + +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding; + encoding = undefined; + } + return compile(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true)))); +} \ No newline at end of file diff --git a/node_modules/micromark/license b/node_modules/micromark/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/micromark/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/micromark/package.json b/node_modules/micromark/package.json new file mode 100644 index 00000000..c1c00e88 --- /dev/null +++ b/node_modules/micromark/package.json @@ -0,0 +1,100 @@ +{ + "name": "micromark", + "version": "4.0.2", + "description": "small commonmark compliant markdown parser with positional info and concrete tokens", + "license": "MIT", + "keywords": [ + "commonmark", + "compiler", + "gfm", + "html", + "lexer", + "markdown", + "markup", + "md", + "unified", + "parse", + "parser", + "plugin", + "process", + "remark", + "render", + "renderer", + "token", + "tokenizer" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js", + "stream.d.ts.map", + "stream.d.ts", + "stream.js" + ], + "exports": { + ".": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "./stream": { + "development": "./dev/stream.js", + "default": "./stream.js" + } + }, + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off", + "unicorn/prefer-event-target": "off" + } + } +} diff --git a/node_modules/micromark/readme.md b/node_modules/micromark/readme.md new file mode 100644 index 00000000..43ee4938 --- /dev/null +++ b/node_modules/micromark/readme.md @@ -0,0 +1,488 @@ +# micromark + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +Markdown parser. + +> **Note**: this is the `micromark` package from the micromark monorepo. +> See the [monorepo readme][micromark] for more on the project. +> See this readme for how to use it. + +## Feature highlights + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +* [x] **[compliant][commonmark]** (100% to CommonMark) +* [x] **[extensions][]** (100% [GFM][], 100% [MDX.js][mdxjs], [directives][], + [frontmatter][], [math][]) +* [x] **[safe][security]** (by default) +* [x] **[robust][test]** (±2k tests, 100% coverage, fuzz testing) +* [x] **[small][size-debug]** (smallest CM parser at ±14kb) + +## Contents + +* [When should I use this?](#when-should-i-use-this) +* [What is this?](#what-is-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`micromark(value[, encoding][, options])`](#micromarkvalue-encoding-options) + * [`stream(options?)`](#streamoptions) + * [`Options`](#options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [License](#license) + +## When should I use this? + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +* If you *just* want to turn markdown into HTML (with maybe a few extensions) +* If you want to do *really complex things* with markdown + +See [§ Comparison][comparison] for more info + +## What is this? + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +`micromark` is an open source markdown parser written in JavaScript. +It’s implemented as a state machine that emits concrete tokens, so that every +byte is accounted for, with positional info. +It then compiles those tokens directly to HTML, but other tools can take the +data and for example build an AST which is easier to work with +([`mdast-util-to-markdown`][mdast-util-to-markdown]). + +While most markdown parsers work towards compliancy with CommonMark (or GFM), +this project goes further by following how the reference parsers (`cmark`, +`cmark-gfm`) work, which is confirmed with thousands of extra tests. + +Other than CommonMark and GFM, micromark also supports common extensions to +markdown such as MDX, math, and frontmatter. + +These npm packages have a sibling project in Rust: +[`markdown-rs`][markdown-rs]. + +* to learn markdown, see this [cheatsheet and tutorial][cheat] +* for more about us, see [`unifiedjs.com`][site] +* for questions, see [Discussions][chat] +* to help, see [contribute][] and [sponsor][] below + +## Install + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {micromark} from 'https://esm.sh/micromark@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {micromark} from 'https://esm.sh/micromark@3?bundle' +</script> +``` + +## Use + +<!-- Note: this section has to be in sync with the `micromark` readme. --> + +Typical use (buffering): + +```js +import {micromark} from 'micromark' + +console.log(micromark('## Hello, *world*!')) +``` + +Yields: + +```html +<h2>Hello, <em>world</em>!</h2> +``` + +You can pass extensions (in this case [`micromark-extension-gfm`][gfm]): + +```js +import {micromark} from 'micromark' +import {gfmHtml, gfm} from 'micromark-extension-gfm' + +const value = '* [x] contact@example.com ~~strikethrough~~' + +const result = micromark(value, { + extensions: [gfm()], + htmlExtensions: [gfmHtml()] +}) + +console.log(result) +``` + +Yields: + +```html +<ul> +<li><input checked="" disabled="" type="checkbox"> <a href="mailto:contact@example.com">contact@example.com</a> <del>strikethrough</del></li> +</ul> +``` + +Streaming interface: + +```js +import {createReadStream} from 'node:fs' +import {stream} from 'micromark/stream' + +createReadStream('example.md') + .on('error', handleError) + .pipe(stream()) + .pipe(process.stdout) + +function handleError(error) { + // Handle your error here! + throw error +} +``` + +## API + +`micromark` core has two entries in its export map: `micromark` and +`micromark/stream`. + +`micromark` exports the identifier [`micromark`][api-micromark]. +`micromark/stream` exports the identifier [`stream`][api-stream]. +There are no default exports. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. +See [§ Size & debug][size-debug] for more info. + +### `micromark(value[, encoding][, options])` + +Compile markdown to HTML. + +> Note: which encodings are supported depends on the engine. +> For info on Node.js, see *[WHATWG supported encodings][encoding]*. + +###### Parameters + +* `value` (`string` or [`Uint8Array`][uint8-array]) + — markdown to parse +* `encoding` (`string`, default: `'utf8'`) + — [character encoding][encoding] to understand `value` as when it’s a + [`Uint8Array`][uint8-array] +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Compiled HTML (`string`). + +### `stream(options?)` + +Create a duplex (readable and writable) stream. + +Some of the work to parse markdown can be done streaming, but in the +end buffering is required. + +micromark does not handle errors for you, so you must handle errors on whatever +streams you pipe into it. +As markdown does not know errors, `micromark` itself does not emit errors. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Duplex stream. + +### `Options` + +Configuration (TypeScript type). + +##### Fields + +###### `allowDangerousHtml` + +Whether to allow (dangerous) HTML (`boolean`, default: `false`). + +The default is `false`, which still parses the HTML according to `CommonMark` +but shows the HTML as text instead of as elements. + +Pass `true` for trusted content to get actual HTML elements. +See [§ Security][security]. + +###### `allowDangerousProtocol` + +Whether to allow dangerous protocols in links and images (`boolean`, default: +`false`). + +The default is `false`, which drops URLs in links and images that use dangerous +protocols. + +Pass `true` for trusted content to support all protocols. + +URLs that have no protocol (which means it’s relative to the current page, such +as `./some/page.html`) and URLs that have a safe protocol (for images: `http`, +`https`; for links: `http`, `https`, `irc`, `ircs`, `mailto`, `xmpp`), are +safe. +All other URLs are dangerous and dropped. +See [§ Security][security]. + +###### `defaultLineEnding` + +Default line ending to use when compiling to HTML, for line endings not in +`value` (`'\r'`, `'\n'`, or `'\r\n'`; default: first line ending or `'\n'`). + +Generally, `micromark` copies line endings (`\r`, `\n`, `\r\n`) in the markdown +document over to the compiled HTML. +In some cases, such as `> a`, CommonMark requires that extra line endings are +added: `<blockquote>\n<p>a</p>\n</blockquote>`. + +To create that line ending, the document is checked for the first line ending +that is used. +If there is no line ending, `defaultLineEnding` is used. +If that isn’t configured, `\n` is used. + +###### `extensions` + +Array of syntax extensions (`Array<SyntaxExtension>`, default: `[]`). +See [§ Extensions][extensions]. + +###### `htmlExtensions` + +Array of syntax extensions (`Array<HtmlExtension>`, default: `[]`). +See [§ Extensions][extensions]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `micromark@4`, compatible +with Node.js 16. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## Sponsor + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +Support this effort and give back by sponsoring on [OpenCollective][]! + +<table> +<tr valign="middle"> +<td width="100%" align="center" colspan="10"> + <br> + <a href="https://www.salesforce.com">Salesforce</a> 🏅<br><br> + <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo/512.png" width="256"></a> +</td> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +<td width="10%"></td> +<td width="10%"></td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="8"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-micromark]: #micromarkvalue-encoding-options + +[api-options]: #options + +[api-stream]: #streamoptions + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[cheat]: https://commonmark.org/help/ + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[commonmark]: https://commonmark.org + +[comparison]: https://github.com/micromark/micromark#comparison + +[contribute]: #contribute + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[directives]: https://github.com/micromark/micromark-extension-directive + +[downloads]: https://www.npmjs.com/package/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark.svg + +[encoding]: https://nodejs.org/api/util.html#whatwg-supported-encodings + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[extensions]: https://github.com/micromark/micromark#extensions + +[frontmatter]: https://github.com/micromark/micromark-extension-frontmatter + +[gfm]: https://github.com/micromark/micromark-extension-gfm + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[markdown-rs]: https://github.com/wooorm/markdown-rs + +[math]: https://github.com/micromark/micromark-extension-math + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdxjs]: https://github.com/micromark/micromark-extension-mdxjs + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[security]: #security + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[site]: https://unifiedjs.com + +[size-debug]: https://github.com/micromark/micromark#size--debug + +[sponsor]: #sponsor + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[test]: https://github.com/micromark/micromark#test + +[typescript]: https://www.typescriptlang.org + +[uint8-array]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array diff --git a/node_modules/micromark/stream.d.ts b/node_modules/micromark/stream.d.ts new file mode 100644 index 00000000..2b05447e --- /dev/null +++ b/node_modules/micromark/stream.d.ts @@ -0,0 +1,35 @@ +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options?: Options | null | undefined): MinimalDuplex; +export type Options = import("micromark-util-types").Options; +/** + * Function called when write was successful. + */ +export type Callback = () => undefined; +/** + * Configuration for piping. + */ +export type PipeOptions = { + /** + * Whether to end the destination stream when the source stream ends. + */ + end?: boolean | null | undefined; +}; +/** + * Duplex stream. + */ +export type MinimalDuplex = Omit<NodeJS.ReadableStream & NodeJS.WritableStream, "isPaused" | "pause" | "read" | "resume" | "setEncoding" | "unpipe" | "unshift" | "wrap">; +//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/node_modules/micromark/stream.d.ts.map b/node_modules/micromark/stream.d.ts.map new file mode 100644 index 00000000..f89c748f --- /dev/null +++ b/node_modules/micromark/stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["stream.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;GAcG;AACH,iCALW,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,aAAa,CAoOzB;sBAxQY,OAAO,sBAAsB,EAAE,OAAO;;;;6BAMtC,SAAS;;;;;;;;UAKR,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;4BAG3B,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/micromark/stream.js b/node_modules/micromark/stream.js new file mode 100644 index 00000000..75616200 --- /dev/null +++ b/node_modules/micromark/stream.js @@ -0,0 +1,256 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +/** + * @callback Callback + * Function called when write was successful. + * @returns {undefined} + * Nothing. + * + * @typedef PipeOptions + * Configuration for piping. + * @property {boolean | null | undefined} [end] + * Whether to end the destination stream when the source stream ends. + * + * @typedef {Omit<NodeJS.ReadableStream & NodeJS.WritableStream, 'isPaused' | 'pause' | 'read' | 'resume' | 'setEncoding' | 'unpipe' | 'unshift' | 'wrap'>} MinimalDuplex + * Duplex stream. + */ + +import { EventEmitter } from 'node:events'; +import { compile } from './lib/compile.js'; +import { parse } from './lib/parse.js'; +import { postprocess } from './lib/postprocess.js'; +import { preprocess } from './lib/preprocess.js'; + +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options) { + const prep = preprocess(); + const tokenize = parse(options).document().write; + const comp = compile(options); + /** @type {boolean} */ + let ended; + const emitter = /** @type {MinimalDuplex} */new EventEmitter(); + // @ts-expect-error: fine. + emitter.end = end; + emitter.pipe = pipe; + emitter.readable = true; + emitter.writable = true; + // @ts-expect-error: fine. + emitter.write = write; + return emitter; + + /** + * Write a chunk into memory. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding; + encoding = undefined; + } + if (ended) { + throw new Error('Did not expect `write` after `end`'); + } + tokenize(prep(chunk || '', encoding)); + if (callback) { + callback(); + } + + // Signal successful write. + return true; + } + + /** + * End the writing. + * + * Passes all arguments as a final `write`. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Callback | Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function end(chunk, encoding, callback) { + if (typeof chunk === 'function') { + encoding = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + callback = encoding; + encoding = undefined; + } + write(chunk, encoding, callback); + emitter.emit('data', comp(postprocess(tokenize(prep('', encoding, true))))); + emitter.emit('end'); + ended = true; + return true; + } + + /** + * Pipe the processor into a writable stream. + * + * Basically `Stream#pipe`, but inlined and simplified to keep the bundled + * size down. + * See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>. + * + * @template {NodeJS.WritableStream} Stream + * Writable stream. + * @param {Stream} destination + * Stream to pipe into. + * @param {PipeOptions | null | undefined} [options] + * Configuration. + * @returns {Stream} + * Destination stream. + */ + function pipe(destination, options) { + emitter.on('data', ondata); + emitter.on('error', onerror); + emitter.on('end', cleanup); + emitter.on('close', cleanup); + + // If the `end` option is not supplied, `destination.end()` will be + // called when the `end` or `close` events are received. + // @ts-expect-error `_isStdio` is available on `std{err,out}` + if (!destination._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend); + } + destination.on('error', onerror); + destination.on('close', cleanup); + destination.emit('pipe', emitter); + return destination; + + /** + * End destination stream. + * + * @returns {undefined} + * Nothing. + */ + function onend() { + if (destination.end) { + destination.end(); + } + } + + /** + * Handle data. + * + * @param {string} chunk + * Data. + * @returns {undefined} + * Nothing. + */ + function ondata(chunk) { + if (destination.writable) { + destination.write(chunk); + } + } + + /** + * Clean listeners. + * + * @returns {undefined} + * Nothing. + */ + function cleanup() { + emitter.removeListener('data', ondata); + emitter.removeListener('end', onend); + emitter.removeListener('error', onerror); + emitter.removeListener('end', cleanup); + emitter.removeListener('close', cleanup); + destination.removeListener('error', onerror); + destination.removeListener('close', cleanup); + } + + /** + * Close dangling pipes and handle unheard errors. + * + * @param {Error | null | undefined} [error] + * Error, if any. + * @returns {undefined} + * Nothing. + */ + function onerror(error) { + cleanup(); + if (!emitter.listenerCount('error')) { + throw error; // Unhandled stream error in pipe. + } + } + } +} \ No newline at end of file diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js new file mode 100644 index 00000000..ea734fb7 --- /dev/null +++ b/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/ms/license.md b/node_modules/ms/license.md new file mode 100644 index 00000000..fa5d39b6 --- /dev/null +++ b/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Vercel, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ms/package.json b/node_modules/ms/package.json new file mode 100644 index 00000000..49971890 --- /dev/null +++ b/node_modules/ms/package.json @@ -0,0 +1,38 @@ +{ + "name": "ms", + "version": "2.1.3", + "description": "Tiny millisecond conversion utility", + "repository": "vercel/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.18.2", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1", + "prettier": "2.0.5" + } +} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md new file mode 100644 index 00000000..0fc1abb3 --- /dev/null +++ b/node_modules/ms/readme.md @@ -0,0 +1,59 @@ +# ms + +![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/parse-entities/index.d.ts b/node_modules/parse-entities/index.d.ts new file mode 100644 index 00000000..4e943418 --- /dev/null +++ b/node_modules/parse-entities/index.d.ts @@ -0,0 +1,126 @@ +import type {Point, Position} from 'unist' + +// To do: next major: remove `void` from allowed return types. + +/** + * @typeParam Context + * Value used as `this`. + * @this + * The `warningContext` given to `parseEntities` + * @param reason + * Human readable reason for emitting a parse error. + * @param point + * Place where the error occurred. + * @param code + * Machine readable code the error. + */ +export type WarningHandler<Context = undefined> = ( + this: Context, + reason: string, + point: Point, + code: number +) => undefined | void + +/** + * @typeParam Context + * Value used as `this`. + * @this + * The `referenceContext` given to `parseEntities` + * @param value + * Decoded character reference. + * @param position + * Place where `value` starts and ends. + * @param source + * Raw source of character reference. + */ +export type ReferenceHandler<Context = undefined> = ( + this: Context, + value: string, + position: Position, + source: string +) => undefined | void + +/** + * @typeParam Context + * Value used as `this`. + * @this + * The `textContext` given to `parseEntities`. + * @param value + * String of content. + * @param position + * Place where `value` starts and ends. + */ +export type TextHandler<Context = undefined> = ( + this: Context, + value: string, + position: Position +) => undefined | void + +/** + * Configuration. + * + * @typeParam WarningContext + * Value used as `this` in the `warning` handler. + * @typeParam ReferenceContext + * Value used as `this` in the `reference` handler. + * @typeParam TextContext + * Value used as `this` in the `text` handler. + */ +export interface Options< + WarningContext = undefined, + ReferenceContext = undefined, + TextContext = undefined +> { + /** + * Additional character to accept. + * This allows other characters, without error, when following an ampersand. + * + * @default '' + */ + additional?: string | null | undefined + /** + * Whether to parse `value` as an attribute value. + * This results in slightly different behavior. + * + * @default false + */ + attribute?: boolean | null | undefined + /** + * Whether to allow nonterminated character references. + * For example, `&copycat` for `©cat`. + * This behavior is compliant to the spec but can lead to unexpected results. + * + * @default true + */ + nonTerminated?: boolean | null | undefined + /** + * Starting `position` of `value` (`Point` or `Position`). Useful when dealing with values nested in some sort of syntax tree. + */ + position?: Readonly<Position> | Readonly<Point> | null | undefined + /** + * Context used when calling `warning`. + */ + warningContext?: WarningContext | null | undefined + /** + * Context used when calling `reference`. + */ + referenceContext?: ReferenceContext | null | undefined + /** + * Context used when calling `text`. + */ + textContext?: TextContext | null | undefined + /** + * Warning handler. + */ + warning?: WarningHandler<WarningContext> | null | undefined + /** + * Reference handler. + */ + reference?: ReferenceHandler<ReferenceContext> | null | undefined + /** + * Text handler. + */ + text?: TextHandler<TextContext> | null | undefined +} + +export {parseEntities} from './lib/index.js' diff --git a/node_modules/parse-entities/index.js b/node_modules/parse-entities/index.js new file mode 100644 index 00000000..60157967 --- /dev/null +++ b/node_modules/parse-entities/index.js @@ -0,0 +1,3 @@ +// Note: more types exposed from `index.d.ts`. +// To do: refactor to include type parameters in JS. +export {parseEntities} from './lib/index.js' diff --git a/node_modules/parse-entities/license b/node_modules/parse-entities/license new file mode 100644 index 00000000..8fbc47dd --- /dev/null +++ b/node_modules/parse-entities/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <mailto:tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/parse-entities/node_modules/@types/unist/LICENSE b/node_modules/parse-entities/node_modules/@types/unist/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/parse-entities/node_modules/@types/unist/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/parse-entities/node_modules/@types/unist/README.md b/node_modules/parse-entities/node_modules/@types/unist/README.md new file mode 100644 index 00000000..c64ed294 --- /dev/null +++ b/node_modules/parse-entities/node_modules/@types/unist/README.md @@ -0,0 +1,122 @@ +# Installation +> `npm install --save @types/unist` + +# Summary +This package contains type definitions for unist (https://github.com/syntax-tree/unist). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2/index.d.ts) +````ts +/** + * Syntactic units in unist syntax trees are called nodes. + * + * @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}. + */ +export interface Node<TData extends object = Data> { + /** + * The variant of a node. + */ + type: string; + + /** + * Information from the ecosystem. + */ + data?: TData | undefined; + + /** + * Location of a node in a source document. + * Must not be present if a node is generated. + */ + position?: Position | undefined; +} + +/** + * Information associated by the ecosystem with the node. + * Space is guaranteed to never be specified by unist or specifications + * implementing unist. + */ +export interface Data { + [key: string]: unknown; +} + +/** + * Location of a node in a source file. + */ +export interface Position { + /** + * Place of the first character of the parsed source region. + */ + start: Point; + + /** + * Place of the first character after the parsed source region. + */ + end: Point; + + /** + * Start column at each index (plus start line) in the source region, + * for elements that span multiple lines. + */ + indent?: number[] | undefined; +} + +/** + * One place in a source file. + */ +export interface Point { + /** + * Line in a source file (1-indexed integer). + */ + line: number; + + /** + * Column in a source file (1-indexed integer). + */ + column: number; + /** + * Character in a source file (0-indexed integer). + */ + offset?: number | undefined; +} + +/** + * Util for extracting type of {@link Node.data} + * + * @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc. + * + * @example `NodeData<Node<{ key: string }>>` -> `{ key: string }` + */ +export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never; + +/** + * Nodes containing other nodes. + * + * @typeParam ChildNode Node item of {@link Parent.children} + */ +export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>> + extends Node<TData> +{ + /** + * List representing the children of a node. + */ + children: ChildNode[]; +} + +/** + * Nodes containing a value. + * + * @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node + */ +export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> { + value: Value; +} + +```` + +### Additional Details + * Last updated: Thu, 15 Aug 2024 02:18:53 GMT + * Dependencies: none + +# Credits +These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), and [JounQin](https://github.com/JounQin). diff --git a/node_modules/parse-entities/node_modules/@types/unist/index.d.ts b/node_modules/parse-entities/node_modules/@types/unist/index.d.ts new file mode 100644 index 00000000..b019d389 --- /dev/null +++ b/node_modules/parse-entities/node_modules/@types/unist/index.d.ts @@ -0,0 +1,103 @@ +/** + * Syntactic units in unist syntax trees are called nodes. + * + * @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}. + */ +export interface Node<TData extends object = Data> { + /** + * The variant of a node. + */ + type: string; + + /** + * Information from the ecosystem. + */ + data?: TData | undefined; + + /** + * Location of a node in a source document. + * Must not be present if a node is generated. + */ + position?: Position | undefined; +} + +/** + * Information associated by the ecosystem with the node. + * Space is guaranteed to never be specified by unist or specifications + * implementing unist. + */ +export interface Data { + [key: string]: unknown; +} + +/** + * Location of a node in a source file. + */ +export interface Position { + /** + * Place of the first character of the parsed source region. + */ + start: Point; + + /** + * Place of the first character after the parsed source region. + */ + end: Point; + + /** + * Start column at each index (plus start line) in the source region, + * for elements that span multiple lines. + */ + indent?: number[] | undefined; +} + +/** + * One place in a source file. + */ +export interface Point { + /** + * Line in a source file (1-indexed integer). + */ + line: number; + + /** + * Column in a source file (1-indexed integer). + */ + column: number; + /** + * Character in a source file (0-indexed integer). + */ + offset?: number | undefined; +} + +/** + * Util for extracting type of {@link Node.data} + * + * @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc. + * + * @example `NodeData<Node<{ key: string }>>` -> `{ key: string }` + */ +export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never; + +/** + * Nodes containing other nodes. + * + * @typeParam ChildNode Node item of {@link Parent.children} + */ +export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>> + extends Node<TData> +{ + /** + * List representing the children of a node. + */ + children: ChildNode[]; +} + +/** + * Nodes containing a value. + * + * @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node + */ +export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> { + value: Value; +} diff --git a/node_modules/parse-entities/node_modules/@types/unist/package.json b/node_modules/parse-entities/node_modules/@types/unist/package.json new file mode 100644 index 00000000..01cb5b0d --- /dev/null +++ b/node_modules/parse-entities/node_modules/@types/unist/package.json @@ -0,0 +1,55 @@ +{ + "name": "@types/unist", + "version": "2.0.11", + "description": "TypeScript definitions for unist", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist", + "license": "MIT", + "contributors": [ + { + "name": "bizen241", + "githubUsername": "bizen241", + "url": "https://github.com/bizen241" + }, + { + "name": "Jun Lu", + "githubUsername": "lujun2", + "url": "https://github.com/lujun2" + }, + { + "name": "Hernan Rajchert", + "githubUsername": "hrajchert", + "url": "https://github.com/hrajchert" + }, + { + "name": "Titus Wormer", + "githubUsername": "wooorm", + "url": "https://github.com/wooorm" + }, + { + "name": "Junyoung Choi", + "githubUsername": "rokt33r", + "url": "https://github.com/rokt33r" + }, + { + "name": "Ben Moon", + "githubUsername": "GuiltyDolphin", + "url": "https://github.com/GuiltyDolphin" + }, + { + "name": "JounQin", + "githubUsername": "JounQin", + "url": "https://github.com/JounQin" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/unist" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "6e36525a6db49ae5517fe0751796ca8f6c65099098415046d4f1ad6c2ef1a33c", + "typeScriptVersion": "4.8" +} \ No newline at end of file diff --git a/node_modules/parse-entities/package.json b/node_modules/parse-entities/package.json new file mode 100644 index 00000000..cb3820aa --- /dev/null +++ b/node_modules/parse-entities/package.json @@ -0,0 +1,91 @@ +{ + "name": "parse-entities", + "version": "4.0.2", + "description": "Parse HTML character references", + "license": "MIT", + "keywords": [ + "parse", + "html", + "character", + "reference", + "entity", + "entities" + ], + "repository": "wooorm/parse-entities", + "bugs": "https://github.com/wooorm/parse-entities/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "rules": { + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/ban-types": "off", + "complexity": "off", + "max-depth": "off", + "no-bitwise": "off", + "unicorn/numeric-separators-style": "off", + "unicorn/prefer-code-point": "off" + } + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/parse-entities/readme.md b/node_modules/parse-entities/readme.md new file mode 100644 index 00000000..cdc8c327 --- /dev/null +++ b/node_modules/parse-entities/readme.md @@ -0,0 +1,266 @@ +# parse-entities + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Parse HTML character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`parseEntities(value[, options])`](#parseentitiesvalue-options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a small and powerful decoder of HTML character references (often called +entities). + +## When should I use this? + +You can use this for spec-compliant decoding of character references. +It’s small and fast enough to do that well. +You can also use this when making a linter, because there are different warnings +emitted with reasons for why and positional info on where they happened. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install parse-entities +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {parseEntities} from 'https://esm.sh/parse-entities@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {parseEntities} from 'https://esm.sh/parse-entities@3?bundle' +</script> +``` + +## Use + +```js +import {parseEntities} from 'parse-entities' + +console.log(parseEntities('alpha &amp bravo'))) +// => alpha & bravo + +console.log(parseEntities('charlie &copycat; delta')) +// => charlie ©cat; delta + +console.log(parseEntities('echo &copy; foxtrot &#8800; golf &#x1D306; hotel')) +// => echo © foxtrot ≠ golf 𝌆 hotel +``` + +## API + +This package exports the identifier `parseEntities`. +There is no default export. + +### `parseEntities(value[, options])` + +Parse HTML character references. + +##### `options` + +Configuration (optional). + +###### `options.additional` + +Additional character to accept (`string?`, default: `''`). +This allows other characters, without error, when following an ampersand. + +###### `options.attribute` + +Whether to parse `value` as an attribute value (`boolean?`, default: `false`). +This results in slightly different behavior. + +###### `options.nonTerminated` + +Whether to allow nonterminated references (`boolean`, default: `true`). +For example, `&copycat` for `©cat`. +This behavior is compliant to the spec but can lead to unexpected results. + +###### `options.position` + +Starting `position` of `value` (`Position` or `Point`, optional). +Useful when dealing with values nested in some sort of syntax tree. +The default is: + +```js +{line: 1, column: 1, offset: 0} +``` + +###### `options.warning` + +Error handler ([`Function?`][warning]). + +###### `options.text` + +Text handler ([`Function?`][text]). + +###### `options.reference` + +Reference handler ([`Function?`][reference]). + +###### `options.warningContext` + +Context used when calling `warning` (`'*'`, optional). + +###### `options.textContext` + +Context used when calling `text` (`'*'`, optional). + +###### `options.referenceContext` + +Context used when calling `reference` (`'*'`, optional) + +##### Returns + +`string` — decoded `value`. + +#### `function warning(reason, point, code)` + +Error handler. + +###### Parameters + +* `this` (`*`) — refers to `warningContext` when given to `parseEntities` +* `reason` (`string`) — human readable reason for emitting a parse error +* `point` ([`Point`][point]) — place where the error occurred +* `code` (`number`) — machine readable code the error + +The following codes are used: + +| Code | Example | Note | +| ---- | ------------------ | --------------------------------------------- | +| `1` | `foo &amp bar` | Missing semicolon (named) | +| `2` | `foo &#123 bar` | Missing semicolon (numeric) | +| `3` | `Foo &bar baz` | Empty (named) | +| `4` | `Foo &#` | Empty (numeric) | +| `5` | `Foo &bar; baz` | Unknown (named) | +| `6` | `Foo &#128; baz` | [Disallowed reference][invalid] | +| `7` | `Foo &#xD800; baz` | Prohibited: outside permissible unicode range | + +#### `function text(value, position)` + +Text handler. + +###### Parameters + +* `this` (`*`) — refers to `textContext` when given to `parseEntities` +* `value` (`string`) — string of content +* `position` ([`Position`][position]) — place where `value` starts and ends + +#### `function reference(value, position, source)` + +Character reference handler. + +###### Parameters + +* `this` (`*`) — refers to `referenceContext` when given to `parseEntities` +* `value` (`string`) — decoded character reference +* `position` ([`Position`][position]) — place where `source` starts and ends +* `source` (`string`) — raw source of character reference + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types `Options`, `WarningHandler`, +`ReferenceHandler`, and `TextHandler`. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe: it matches the HTML spec to parse character references. + +## Related + +* [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities) + — encode HTML character references +* [`wooorm/character-entities`](https://github.com/wooorm/character-entities) + — info on character references +* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — info on HTML4 character references +* [`wooorm/character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — info on legacy character references +* [`wooorm/character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — info on invalid numeric character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/wooorm/parse-entities/workflows/main/badge.svg + +[build]: https://github.com/wooorm/parse-entities/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/parse-entities.svg + +[coverage]: https://codecov.io/github/wooorm/parse-entities + +[downloads-badge]: https://img.shields.io/npm/dm/parse-entities.svg + +[downloads]: https://www.npmjs.com/package/parse-entities + +[size-badge]: https://img.shields.io/bundlephobia/minzip/parse-entities.svg + +[size]: https://bundlephobia.com/result?p=parse-entities + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[warning]: #function-warningreason-point-code + +[text]: #function-textvalue-position + +[reference]: #function-referencevalue-position-source + +[invalid]: https://github.com/wooorm/character-reference-invalid + +[point]: https://github.com/syntax-tree/unist#point + +[position]: https://github.com/syntax-tree/unist#position + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/property-information/index.d.ts b/node_modules/property-information/index.d.ts new file mode 100644 index 00000000..463d9986 --- /dev/null +++ b/node_modules/property-information/index.d.ts @@ -0,0 +1,118 @@ +/** + * Info on a property. + */ +export interface Info { + /** + * Attribute name for the property that could be used in markup + * (such as `'aria-describedby'`, `'allowfullscreen'`, `'xml:lang'`, + * `'for'`, or `'charoff'`). + */ + attribute: string + /** + * The property is *like* a `boolean` + * (such as `draggable`); + * these properties have both an on and off state when defined, + * *and* another state when not defined. + */ + booleanish: boolean + /** + * The property is a `boolean` + * (such as `hidden`); + * these properties have an on state when defined and an off state when not + * defined. + */ + boolean: boolean + /** + * The property is a list separated by spaces or commas + * (such as `strokeDashArray`). + */ + commaOrSpaceSeparated: boolean + /** + * The property is a list separated by commas + * (such as `coords`). + */ + commaSeparated: boolean + /** + * The property is defined by a space; + * this is the case for values in HTML + * (including data and ARIA), + * SVG, XML, XMLNS, and XLink; + * not defined properties can only be found through `find`. + */ + defined: boolean + /** + * When working with the DOM, + * this property has to be changed as a field on the element, + * instead of through `setAttribute` + * (this is true only for `'checked'`, `'multiple'`, `'muted'`, and + * `'selected'`). + */ + mustUseProperty: boolean + /** + * The property is a `number` (such as `height`). + */ + number: boolean + /** + * The property is *like* a `boolean` (such as `download`); + * these properties have an on state *and* more states when defined and an + * off state when not defined. + */ + overloadedBoolean: boolean + /** + * JavaScript-style camel-cased name; + * based on the DOM but sometimes different + * (such as `'ariaDescribedBy'`, `'allowFullScreen'`, `'xmlLang'`, + * `'htmlFor'`, `'charOff'`). + */ + property: string + /** + * The property is a list separated by spaces + * (such as `className`). + */ + spaceSeparated: boolean + /** + * Space of the property. + */ + space: Space | undefined +} + +/** + * Schema for a primary space. + */ +export interface Schema { + /** + * Object mapping normalized attributes and properties to properly cased + * properties. + */ + normal: Record<string, string> + /** + * Object mapping properties to info. + */ + property: Record<string, Info> + space: Space | undefined +} + +/** + * Space of a property. + */ +export type Space = 'html' | 'svg' | 'xlink' | 'xmlns' | 'xml' + +export {find} from './lib/find.js' + +export {hastToReact} from './lib/hast-to-react.js' + +/** + * `Schema` for HTML, + * with info on properties from HTML itself and related embedded spaces + * (ARIA, XML, XMLNS, XLink). + */ +export const html: Schema + +export {normalize} from './lib/normalize.js' + +/** + * `Schema` for SVG, + * with info on properties from SVG itself and related embedded spaces + * (ARIA, XML, XMLNS, XLink). + */ +export const svg: Schema diff --git a/node_modules/property-information/index.js b/node_modules/property-information/index.js new file mode 100644 index 00000000..e434f836 --- /dev/null +++ b/node_modules/property-information/index.js @@ -0,0 +1,17 @@ +// Note: types exposed from `index.d.ts`. +import {merge} from './lib/util/merge.js' +import {aria} from './lib/aria.js' +import {html as htmlBase} from './lib/html.js' +import {svg as svgBase} from './lib/svg.js' +import {xlink} from './lib/xlink.js' +import {xmlns} from './lib/xmlns.js' +import {xml} from './lib/xml.js' + +export {hastToReact} from './lib/hast-to-react.js' + +export const html = merge([aria, htmlBase, xlink, xmlns, xml], 'html') + +export {find} from './lib/find.js' +export {normalize} from './lib/normalize.js' + +export const svg = merge([aria, svgBase, xlink, xmlns, xml], 'svg') diff --git a/node_modules/property-information/license b/node_modules/property-information/license new file mode 100644 index 00000000..8fbc47dd --- /dev/null +++ b/node_modules/property-information/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <mailto:tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/property-information/package.json b/node_modules/property-information/package.json new file mode 100644 index 00000000..46e949d7 --- /dev/null +++ b/node_modules/property-information/package.json @@ -0,0 +1,121 @@ +{ + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "bugs": "https://github.com/wooorm/property-information/issues", + "contributors": [ + "Andrew Burgess <andrew@andrewburgess.io>", + "Dustin Deus <deusdustin@gmail.com> (http://starptech.de)", + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "description": "Info on the properties and attributes of the web platform", + "devDependencies": { + "@types/mdast": "^4.0.0", + "@types/node": "^22.0.0", + "alpha-sort": "^5.0.0", + "c8": "^10.0.0", + "html-element-attributes": "^3.0.0", + "html-event-attributes": "^2.0.0", + "mdast-zone": "^6.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "svg-element-attributes": "^2.0.0", + "svg-event-attributes": "^2.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "unist-builder": "^4.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "keywords": [ + "aria", + "attribute", + "html", + "information", + "info", + "property", + "svg" + ], + "license": "MIT", + "name": "property-information", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm", + "./script/list.js" + ] + }, + "repository": "wooorm/property-information", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "generate": "node --conditions development script/generate-react.js && node --conditions development script/generate-exceptions.js", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "ignoreCatch": true + }, + "type": "module", + "version": "7.1.0", + "xo": { + "overrides": [ + { + "files": [ + "script/**/*.js", + "test.js" + ], + "rules": { + "no-await-in-loop": "off" + } + }, + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "no-bitwise": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/property-information/readme.md b/node_modules/property-information/readme.md new file mode 100644 index 00000000..02eb44cf --- /dev/null +++ b/node_modules/property-information/readme.md @@ -0,0 +1,1062 @@ +# property-information + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +Info on the properties and attributes of the web platform +(HTML, SVG, ARIA, XML, XMLNS, XLink). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`Info`](#info) + * [`Schema`](#schema) + * [`Space`](#space) + * [`find(schema, name)`](#findschema-name) + * [`hastToReact`](#hasttoreact) + * [`html`](#html) + * [`normalize(name)`](#normalizename) + * [`svg`](#svg) +* [Compatibility](#compatibility) +* [Support](#support) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains lots of info on all the properties and attributes found +on the web platform. +It includes data on +HTML, SVG, ARIA, XML, XMLNS, and XLink. +The names of the properties follow [hast][github-hast-property-name]’s +sensible naming scheme. +It includes info on what data types attributes hold, +such as whether they’re booleans or contain lists of space separated numbers. + +## When should I use this? + +You can use this package if you’re working with hast, +which is an AST for HTML, +or have goals related to ASTs, +such as figuring out which properties or attributes are valid, +or what data types they hold. + +## Install + +This package is [ESM only][github-gist-esm]. +In Node.js (version 16+), +install with [npm][npmjs-install]: + +```sh +npm install property-information +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as propertyInformation from 'https://esm.sh/property-information@7' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import * as propertyInformation from 'https://esm.sh/property-information@7?bundle' +</script> +``` + +## Use + +```js +import {find, html, svg} from 'property-information' + +console.log(find(html, 'className')) +// Or: find(html, 'class') +console.log(find(svg, 'horiz-adv-x')) +// Or: find(svg, 'horizAdvX') +console.log(find(svg, 'xlink:arcrole')) +// Or: find(svg, 'xLinkArcRole') +console.log(find(html, 'xmlLang')) +// Or: find(html, 'xml:lang') +console.log(find(html, 'ariaValueNow')) +// Or: find(html, 'aria-valuenow') +``` + +Yields: + +```js +{attribute: 'class', property: 'className', spaceSeparated: true, space: 'html'} +{attribute: 'horiz-adv-x', number: true, property: 'horizAdvX', space: 'svg'} +{attribute: 'xlink:arcrole', property: 'xLinkArcRole', space: 'xlink'} +{attribute: 'xml:lang', property: 'xmlLang', space: 'xml'} +{attribute: 'aria-valuenow', number: true, property: 'ariaValueNow'} +``` + +## API + +This package exports the identifiers +[`find`][api-find], +[`hastToReact`][api-hast-to-react], +[`html`][api-html], +[`normalize`][api-normalize], +and +[`svg`][api-svg]. +There is no default export. +It exports the [TypeScript][] types +[`Info`][api-info], +[`Schema`][api-schema], +and +[`Space`][api-space]. + +### `Info` + +Info on a property (TypeScript type). + +###### Fields + +* `attribute` (`string`) + — attribute name for the property that could be used in markup + (such as `'aria-describedby'`, `'allowfullscreen'`, `'xml:lang'`, `'for'`, + or `'charoff'`) +* `booleanish` (`boolean`) + — the property is *like* a `boolean` + (such as `draggable`); + these properties have both an on and off state when defined, + *and* another state when not defined +* `boolean` (`boolean`) + — the property is a `boolean` + (such as `hidden`); + these properties have an on state when defined and an off state when not + defined +* `commaOrSpaceSeparated` (`boolean`) + — the property is a list separated by spaces or commas + (such as `strokeDashArray`) +* `commaSeparated` (`boolean`) + — the property is a list separated by commas + (such as `coords`) +* `defined` (`boolean`) + — the property is [defined by a space][section-support]; + this is the case for values in HTML + (including [data][mozilla-dataset] and ARIA), + SVG, XML, XMLNS, and XLink; + not defined properties can only be found through `find` +* `mustUseProperty` (`boolean`) + — when working with the DOM, + this property has to be changed as a field on the element, + instead of through `setAttribute` + (this is true only for `'checked'`, `'multiple'`, `'muted'`, and + `'selected'`) +* `number` (`boolean`) + — the property is a `number` (such as `height`) +* `overloadedBoolean` (`boolean`) + — the property is *like* a `boolean` (such as `download`); + these properties have an on state *and* more states when defined and an off + state when not defined +* `property` (`string`) + — JavaScript-style camel-cased name; + based on the DOM but sometimes different + (such as `'ariaDescribedBy'`, `'allowFullScreen'`, `'xmlLang'`, `'htmlFor'`, + `'charOff'`) +* `spaceSeparated` (`boolean`) + — the property is a list separated by spaces + (such as `className`) +* `space` ([`Space`][api-space] or `undefined`) + — [space][github-web-namespaces] of the property + +### `Schema` + +Schema for a primary space (TypeScript type). + +###### Fields + +* `normal` (`Record<string, string>`) + — object mapping normalized attributes and properties to properly cased + properties +* `property` ([`Record<string, Info>`][api-info]) + — object mapping properties to info +* `space` (`'html'` or `'svg'`) + — primary space of the schema + +### `Space` + +Space of a property (TypeScript type). + +###### Type + +```ts +type Space = 'html' | 'svg' | 'xlink' | 'xmlns' | 'xml' +``` + +### `find(schema, name)` + +Look up info on a property. + +In most cases the given `schema` contains info on the property. +All standard, +most legacy, +and some non-standard properties are supported. +For these cases, +the returned [`Info`][api-info] has hints about the value of the property. + +`name` can also be a [valid data attribute or property][mozilla-dataset], +in which case an [`Info`][api-info] object with the correctly cased `attribute` +and `property` is returned. + +`name` can be an unknown attribute, +in which case an [`Info`][api-info] object with `attribute` and `property` set +to the given name is returned. +It is not recommended to provide unsupported legacy or recently specced +properties. + +###### Parameters + +* `schema` ([`Schema`][api-schema]) + — schema; + either the `html` or `svg` export +* `name` (`string`) + — an attribute-like or property-like name; + it will be passed through + [`normalize`][api-normalize] to hopefully find the correct info + +###### Returns + +[`Info`][api-info]. + +###### Example + +Aside from the aforementioned example, +which shows known HTML, SVG, XML, XLink, and ARIA support, +data properties and attributes are also supported: + +```js +console.log(find(html, 'data-date-of-birth')) +// Or: find(html, 'dataDateOfBirth') +// => {attribute: 'data-date-of-birth', property: 'dataDateOfBirth'} +``` + +Unknown values are passed through untouched: + +```js +console.log(find(html, 'un-Known')) +// => {attribute: 'un-Known', property: 'un-Known'} +``` + +### `hastToReact` + +Special cases for React (`Record<string, string>`). + +[`hast`][github-hast] is close to [`React`][github-react] +but differs in a couple of cases. +To get a React property from a hast property, +check if it is in `hastToReact`. +If it is, +use the corresponding value. + +### `html` + +[`Schema`][api-schema] for HTML, +with info on properties from HTML itself and related embedded spaces +(ARIA, XML, XMLNS, XLink). + +###### Example + +```js +console.log(html.property.htmlFor) +// => {attribute: 'for', property: 'htmlFor', spaceSeparated: true, space: 'html'} +console.log(html.property.unknown) +// => undefined +``` + +### `normalize(name)` + +Get the cleaned case insensitive form of an attribute or property. + +###### Parameters + +* `name` (`string`) + — an attribute-like or property-like name + +###### Returns + +Value (`string`) that can be used to look up the properly cased property on a +[`Schema`][api-schema]. + +###### Example + +```js +html.normal[normalize('for')] // => 'htmlFor' +svg.normal[normalize('VIEWBOX')] // => 'viewBox' +html.normal[normalize('unknown')] // => undefined +html.normal[normalize('accept-charset')] // => 'acceptCharset' +``` + +### `svg` + +[`Schema`][api-schema] for SVG, +with info on properties from SVG itself and related embedded spaces +(ARIA, XML, XMLNS, XLink). + +###### Example + +```js +console.log(svg.property.viewBox) +// => {attribute: 'viewBox', property: 'viewBox', space: 'svg'} +console.log(svg.property.unknown) +// => undefined +``` + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, +that is Node.js 16+. +It also works in Deno and modern browsers. + +## Support + +<!--list start--> + +| Property | Attribute | Space | +| ---------------------------- | ------------------------------ | ------------- | +| `aLink` | `alink` | `html` | +| `abbr` | `abbr` | `html` | +| `about` | `about` | `svg` | +| `accentHeight` | `accent-height` | `svg` | +| `accept` | `accept` | `html` | +| `acceptCharset` | `accept-charset` | `html` | +| `accessKey` | `accesskey` | `html` | +| `accumulate` | `accumulate` | `svg` | +| `action` | `action` | `html` | +| `additive` | `additive` | `svg` | +| `align` | `align` | `html` | +| `alignmentBaseline` | `alignment-baseline` | `svg` | +| `allow` | `allow` | `html` | +| `allowFullScreen` | `allowfullscreen` | `html` | +| `allowPaymentRequest` | `allowpaymentrequest` | `html` | +| `allowTransparency` | `allowtransparency` | `html` | +| `allowUserMedia` | `allowusermedia` | `html` | +| `alphabetic` | `alphabetic` | `svg` | +| `alt` | `alt` | `html` | +| `amplitude` | `amplitude` | `svg` | +| `arabicForm` | `arabic-form` | `svg` | +| `archive` | `archive` | `html` | +| `ariaActiveDescendant` | `aria-activedescendant` | | +| `ariaAtomic` | `aria-atomic` | | +| `ariaAutoComplete` | `aria-autocomplete` | | +| `ariaBusy` | `aria-busy` | | +| `ariaChecked` | `aria-checked` | | +| `ariaColCount` | `aria-colcount` | | +| `ariaColIndex` | `aria-colindex` | | +| `ariaColSpan` | `aria-colspan` | | +| `ariaControls` | `aria-controls` | | +| `ariaCurrent` | `aria-current` | | +| `ariaDescribedBy` | `aria-describedby` | | +| `ariaDetails` | `aria-details` | | +| `ariaDisabled` | `aria-disabled` | | +| `ariaDropEffect` | `aria-dropeffect` | | +| `ariaErrorMessage` | `aria-errormessage` | | +| `ariaExpanded` | `aria-expanded` | | +| `ariaFlowTo` | `aria-flowto` | | +| `ariaGrabbed` | `aria-grabbed` | | +| `ariaHasPopup` | `aria-haspopup` | | +| `ariaHidden` | `aria-hidden` | | +| `ariaInvalid` | `aria-invalid` | | +| `ariaKeyShortcuts` | `aria-keyshortcuts` | | +| `ariaLabel` | `aria-label` | | +| `ariaLabelledBy` | `aria-labelledby` | | +| `ariaLevel` | `aria-level` | | +| `ariaLive` | `aria-live` | | +| `ariaModal` | `aria-modal` | | +| `ariaMultiLine` | `aria-multiline` | | +| `ariaMultiSelectable` | `aria-multiselectable` | | +| `ariaOrientation` | `aria-orientation` | | +| `ariaOwns` | `aria-owns` | | +| `ariaPlaceholder` | `aria-placeholder` | | +| `ariaPosInSet` | `aria-posinset` | | +| `ariaPressed` | `aria-pressed` | | +| `ariaReadOnly` | `aria-readonly` | | +| `ariaRelevant` | `aria-relevant` | | +| `ariaRequired` | `aria-required` | | +| `ariaRoleDescription` | `aria-roledescription` | | +| `ariaRowCount` | `aria-rowcount` | | +| `ariaRowIndex` | `aria-rowindex` | | +| `ariaRowSpan` | `aria-rowspan` | | +| `ariaSelected` | `aria-selected` | | +| `ariaSetSize` | `aria-setsize` | | +| `ariaSort` | `aria-sort` | | +| `ariaValueMax` | `aria-valuemax` | | +| `ariaValueMin` | `aria-valuemin` | | +| `ariaValueNow` | `aria-valuenow` | | +| `ariaValueText` | `aria-valuetext` | | +| `as` | `as` | `html` | +| `ascent` | `ascent` | `svg` | +| `async` | `async` | `html` | +| `attributeName` | `attributeName` | `svg` | +| `attributeType` | `attributeType` | `svg` | +| `autoCapitalize` | `autocapitalize` | `html` | +| `autoComplete` | `autocomplete` | `html` | +| `autoCorrect` | `autocorrect` | `html` | +| `autoFocus` | `autofocus` | `html` | +| `autoPlay` | `autoplay` | `html` | +| `autoSave` | `autosave` | `html` | +| `axis` | `axis` | `html` | +| `azimuth` | `azimuth` | `svg` | +| `background` | `background` | `html` | +| `bandwidth` | `bandwidth` | `svg` | +| `baseFrequency` | `baseFrequency` | `svg` | +| `baseProfile` | `baseProfile` | `svg` | +| `baselineShift` | `baseline-shift` | `svg` | +| `bbox` | `bbox` | `svg` | +| `begin` | `begin` | `svg` | +| `bgColor` | `bgcolor` | `html` | +| `bias` | `bias` | `svg` | +| `blocking` | `blocking` | `html` | +| `border` | `border` | `html` | +| `borderColor` | `bordercolor` | `html` | +| `bottomMargin` | `bottommargin` | `html` | +| `by` | `by` | `svg` | +| `calcMode` | `calcMode` | `svg` | +| `capHeight` | `cap-height` | `svg` | +| `capture` | `capture` | `html` | +| `cellPadding` | `cellpadding` | `html` | +| `cellSpacing` | `cellspacing` | `html` | +| `char` | `char` | `html` | +| `charOff` | `charoff` | `html` | +| `charSet` | `charset` | `html` | +| `checked` | `checked` | `html` | +| `cite` | `cite` | `html` | +| `classId` | `classid` | `html` | +| `className` | `class` | `svg`, `html` | +| `clear` | `clear` | `html` | +| `clip` | `clip` | `svg` | +| `clipPath` | `clip-path` | `svg` | +| `clipPathUnits` | `clipPathUnits` | `svg` | +| `clipRule` | `clip-rule` | `svg` | +| `code` | `code` | `html` | +| `codeBase` | `codebase` | `html` | +| `codeType` | `codetype` | `html` | +| `colSpan` | `colspan` | `html` | +| `color` | `color` | `svg`, `html` | +| `colorInterpolation` | `color-interpolation` | `svg` | +| `colorInterpolationFilters` | `color-interpolation-filters` | `svg` | +| `colorProfile` | `color-profile` | `svg` | +| `colorRendering` | `color-rendering` | `svg` | +| `cols` | `cols` | `html` | +| `compact` | `compact` | `html` | +| `content` | `content` | `svg`, `html` | +| `contentEditable` | `contenteditable` | `html` | +| `contentScriptType` | `contentScriptType` | `svg` | +| `contentStyleType` | `contentStyleType` | `svg` | +| `controls` | `controls` | `html` | +| `controlsList` | `controlslist` | `html` | +| `coords` | `coords` | `html` | +| `crossOrigin` | `crossorigin` | `svg`, `html` | +| `cursor` | `cursor` | `svg` | +| `cx` | `cx` | `svg` | +| `cy` | `cy` | `svg` | +| `d` | `d` | `svg` | +| `data` | `data` | `html` | +| `dataType` | `datatype` | `svg` | +| `dateTime` | `datetime` | `html` | +| `declare` | `declare` | `html` | +| `decoding` | `decoding` | `html` | +| `default` | `default` | `html` | +| `defaultAction` | `defaultAction` | `svg` | +| `defer` | `defer` | `html` | +| `descent` | `descent` | `svg` | +| `diffuseConstant` | `diffuseConstant` | `svg` | +| `dir` | `dir` | `html` | +| `dirName` | `dirname` | `html` | +| `direction` | `direction` | `svg` | +| `disablePictureInPicture` | `disablepictureinpicture` | `html` | +| `disableRemotePlayback` | `disableremoteplayback` | `html` | +| `disabled` | `disabled` | `html` | +| `display` | `display` | `svg` | +| `divisor` | `divisor` | `svg` | +| `dominantBaseline` | `dominant-baseline` | `svg` | +| `download` | `download` | `svg`, `html` | +| `draggable` | `draggable` | `html` | +| `dur` | `dur` | `svg` | +| `dx` | `dx` | `svg` | +| `dy` | `dy` | `svg` | +| `edgeMode` | `edgeMode` | `svg` | +| `editable` | `editable` | `svg` | +| `elevation` | `elevation` | `svg` | +| `enableBackground` | `enable-background` | `svg` | +| `encType` | `enctype` | `html` | +| `end` | `end` | `svg` | +| `enterKeyHint` | `enterkeyhint` | `html` | +| `event` | `event` | `svg`, `html` | +| `exponent` | `exponent` | `svg` | +| `externalResourcesRequired` | `externalResourcesRequired` | `svg` | +| `face` | `face` | `html` | +| `fetchPriority` | `fetchpriority` | `html` | +| `fill` | `fill` | `svg` | +| `fillOpacity` | `fill-opacity` | `svg` | +| `fillRule` | `fill-rule` | `svg` | +| `filter` | `filter` | `svg` | +| `filterRes` | `filterRes` | `svg` | +| `filterUnits` | `filterUnits` | `svg` | +| `floodColor` | `flood-color` | `svg` | +| `floodOpacity` | `flood-opacity` | `svg` | +| `focusHighlight` | `focusHighlight` | `svg` | +| `focusable` | `focusable` | `svg` | +| `fontFamily` | `font-family` | `svg` | +| `fontSize` | `font-size` | `svg` | +| `fontSizeAdjust` | `font-size-adjust` | `svg` | +| `fontStretch` | `font-stretch` | `svg` | +| `fontStyle` | `font-style` | `svg` | +| `fontVariant` | `font-variant` | `svg` | +| `fontWeight` | `font-weight` | `svg` | +| `form` | `form` | `html` | +| `formAction` | `formaction` | `html` | +| `formEncType` | `formenctype` | `html` | +| `formMethod` | `formmethod` | `html` | +| `formNoValidate` | `formnovalidate` | `html` | +| `formTarget` | `formtarget` | `html` | +| `format` | `format` | `svg` | +| `fr` | `fr` | `svg` | +| `frame` | `frame` | `html` | +| `frameBorder` | `frameborder` | `html` | +| `from` | `from` | `svg` | +| `fx` | `fx` | `svg` | +| `fy` | `fy` | `svg` | +| `g1` | `g1` | `svg` | +| `g2` | `g2` | `svg` | +| `glyphName` | `glyph-name` | `svg` | +| `glyphOrientationHorizontal` | `glyph-orientation-horizontal` | `svg` | +| `glyphOrientationVertical` | `glyph-orientation-vertical` | `svg` | +| `glyphRef` | `glyphRef` | `svg` | +| `gradientTransform` | `gradientTransform` | `svg` | +| `gradientUnits` | `gradientUnits` | `svg` | +| `hSpace` | `hspace` | `html` | +| `handler` | `handler` | `svg` | +| `hanging` | `hanging` | `svg` | +| `hatchContentUnits` | `hatchContentUnits` | `svg` | +| `hatchUnits` | `hatchUnits` | `svg` | +| `headers` | `headers` | `html` | +| `height` | `height` | `svg`, `html` | +| `hidden` | `hidden` | `html` | +| `high` | `high` | `html` | +| `horizAdvX` | `horiz-adv-x` | `svg` | +| `horizOriginX` | `horiz-origin-x` | `svg` | +| `horizOriginY` | `horiz-origin-y` | `svg` | +| `href` | `href` | `svg`, `html` | +| `hrefLang` | `hreflang` | `svg`, `html` | +| `htmlFor` | `for` | `html` | +| `httpEquiv` | `http-equiv` | `html` | +| `id` | `id` | `svg`, `html` | +| `ideographic` | `ideographic` | `svg` | +| `imageRendering` | `image-rendering` | `svg` | +| `imageSizes` | `imagesizes` | `html` | +| `imageSrcSet` | `imagesrcset` | `html` | +| `in` | `in` | `svg` | +| `in2` | `in2` | `svg` | +| `inert` | `inert` | `html` | +| `initialVisibility` | `initialVisibility` | `svg` | +| `inputMode` | `inputmode` | `html` | +| `integrity` | `integrity` | `html` | +| `intercept` | `intercept` | `svg` | +| `is` | `is` | `html` | +| `isMap` | `ismap` | `html` | +| `itemId` | `itemid` | `html` | +| `itemProp` | `itemprop` | `html` | +| `itemRef` | `itemref` | `html` | +| `itemScope` | `itemscope` | `html` | +| `itemType` | `itemtype` | `html` | +| `k` | `k` | `svg` | +| `k1` | `k1` | `svg` | +| `k2` | `k2` | `svg` | +| `k3` | `k3` | `svg` | +| `k4` | `k4` | `svg` | +| `kernelMatrix` | `kernelMatrix` | `svg` | +| `kernelUnitLength` | `kernelUnitLength` | `svg` | +| `kerning` | `kerning` | `svg` | +| `keyPoints` | `keyPoints` | `svg` | +| `keySplines` | `keySplines` | `svg` | +| `keyTimes` | `keyTimes` | `svg` | +| `kind` | `kind` | `html` | +| `label` | `label` | `html` | +| `lang` | `lang` | `svg`, `html` | +| `language` | `language` | `html` | +| `leftMargin` | `leftmargin` | `html` | +| `lengthAdjust` | `lengthAdjust` | `svg` | +| `letterSpacing` | `letter-spacing` | `svg` | +| `lightingColor` | `lighting-color` | `svg` | +| `limitingConeAngle` | `limitingConeAngle` | `svg` | +| `link` | `link` | `html` | +| `list` | `list` | `html` | +| `loading` | `loading` | `html` | +| `local` | `local` | `svg` | +| `longDesc` | `longdesc` | `html` | +| `loop` | `loop` | `html` | +| `low` | `low` | `html` | +| `lowSrc` | `lowsrc` | `html` | +| `manifest` | `manifest` | `html` | +| `marginHeight` | `marginheight` | `html` | +| `marginWidth` | `marginwidth` | `html` | +| `markerEnd` | `marker-end` | `svg` | +| `markerHeight` | `markerHeight` | `svg` | +| `markerMid` | `marker-mid` | `svg` | +| `markerStart` | `marker-start` | `svg` | +| `markerUnits` | `markerUnits` | `svg` | +| `markerWidth` | `markerWidth` | `svg` | +| `mask` | `mask` | `svg` | +| `maskContentUnits` | `maskContentUnits` | `svg` | +| `maskUnits` | `maskUnits` | `svg` | +| `mathematical` | `mathematical` | `svg` | +| `max` | `max` | `svg`, `html` | +| `maxLength` | `maxlength` | `html` | +| `media` | `media` | `svg`, `html` | +| `mediaCharacterEncoding` | `mediaCharacterEncoding` | `svg` | +| `mediaContentEncodings` | `mediaContentEncodings` | `svg` | +| `mediaSize` | `mediaSize` | `svg` | +| `mediaTime` | `mediaTime` | `svg` | +| `method` | `method` | `svg`, `html` | +| `min` | `min` | `svg`, `html` | +| `minLength` | `minlength` | `html` | +| `mode` | `mode` | `svg` | +| `multiple` | `multiple` | `html` | +| `muted` | `muted` | `html` | +| `name` | `name` | `svg`, `html` | +| `navDown` | `nav-down` | `svg` | +| `navDownLeft` | `nav-down-left` | `svg` | +| `navDownRight` | `nav-down-right` | `svg` | +| `navLeft` | `nav-left` | `svg` | +| `navNext` | `nav-next` | `svg` | +| `navPrev` | `nav-prev` | `svg` | +| `navRight` | `nav-right` | `svg` | +| `navUp` | `nav-up` | `svg` | +| `navUpLeft` | `nav-up-left` | `svg` | +| `navUpRight` | `nav-up-right` | `svg` | +| `noHref` | `nohref` | `html` | +| `noModule` | `nomodule` | `html` | +| `noResize` | `noresize` | `html` | +| `noShade` | `noshade` | `html` | +| `noValidate` | `novalidate` | `html` | +| `noWrap` | `nowrap` | `html` | +| `nonce` | `nonce` | `html` | +| `numOctaves` | `numOctaves` | `svg` | +| `object` | `object` | `html` | +| `observer` | `observer` | `svg` | +| `offset` | `offset` | `svg` | +| `onAbort` | `onabort` | `svg`, `html` | +| `onActivate` | `onactivate` | `svg` | +| `onAfterPrint` | `onafterprint` | `svg`, `html` | +| `onAuxClick` | `onauxclick` | `html` | +| `onBeforeMatch` | `onbeforematch` | `html` | +| `onBeforePrint` | `onbeforeprint` | `svg`, `html` | +| `onBeforeToggle` | `onbeforetoggle` | `html` | +| `onBeforeUnload` | `onbeforeunload` | `html` | +| `onBegin` | `onbegin` | `svg` | +| `onBlur` | `onblur` | `html` | +| `onCanPlay` | `oncanplay` | `svg`, `html` | +| `onCanPlayThrough` | `oncanplaythrough` | `svg`, `html` | +| `onCancel` | `oncancel` | `svg`, `html` | +| `onChange` | `onchange` | `svg`, `html` | +| `onClick` | `onclick` | `svg`, `html` | +| `onClose` | `onclose` | `svg`, `html` | +| `onContextLost` | `oncontextlost` | `html` | +| `onContextMenu` | `oncontextmenu` | `html` | +| `onContextRestored` | `oncontextrestored` | `html` | +| `onCopy` | `oncopy` | `svg`, `html` | +| `onCueChange` | `oncuechange` | `svg`, `html` | +| `onCut` | `oncut` | `svg`, `html` | +| `onDblClick` | `ondblclick` | `svg`, `html` | +| `onDrag` | `ondrag` | `svg`, `html` | +| `onDragEnd` | `ondragend` | `svg`, `html` | +| `onDragEnter` | `ondragenter` | `svg`, `html` | +| `onDragExit` | `ondragexit` | `svg`, `html` | +| `onDragLeave` | `ondragleave` | `svg`, `html` | +| `onDragOver` | `ondragover` | `svg`, `html` | +| `onDragStart` | `ondragstart` | `svg`, `html` | +| `onDrop` | `ondrop` | `svg`, `html` | +| `onDurationChange` | `ondurationchange` | `svg`, `html` | +| `onEmptied` | `onemptied` | `svg`, `html` | +| `onEnd` | `onend` | `svg` | +| `onEnded` | `onended` | `svg`, `html` | +| `onError` | `onerror` | `svg`, `html` | +| `onFocus` | `onfocus` | `svg`, `html` | +| `onFocusIn` | `onfocusin` | `svg` | +| `onFocusOut` | `onfocusout` | `svg` | +| `onFormData` | `onformdata` | `html` | +| `onHashChange` | `onhashchange` | `svg`, `html` | +| `onInput` | `oninput` | `svg`, `html` | +| `onInvalid` | `oninvalid` | `svg`, `html` | +| `onKeyDown` | `onkeydown` | `svg`, `html` | +| `onKeyPress` | `onkeypress` | `svg`, `html` | +| `onKeyUp` | `onkeyup` | `svg`, `html` | +| `onLanguageChange` | `onlanguagechange` | `html` | +| `onLoad` | `onload` | `svg`, `html` | +| `onLoadEnd` | `onloadend` | `html` | +| `onLoadStart` | `onloadstart` | `svg`, `html` | +| `onLoadedData` | `onloadeddata` | `svg`, `html` | +| `onLoadedMetadata` | `onloadedmetadata` | `svg`, `html` | +| `onMessage` | `onmessage` | `svg`, `html` | +| `onMessageError` | `onmessageerror` | `html` | +| `onMouseDown` | `onmousedown` | `svg`, `html` | +| `onMouseEnter` | `onmouseenter` | `svg`, `html` | +| `onMouseLeave` | `onmouseleave` | `svg`, `html` | +| `onMouseMove` | `onmousemove` | `svg`, `html` | +| `onMouseOut` | `onmouseout` | `svg`, `html` | +| `onMouseOver` | `onmouseover` | `svg`, `html` | +| `onMouseUp` | `onmouseup` | `svg`, `html` | +| `onMouseWheel` | `onmousewheel` | `svg` | +| `onOffline` | `onoffline` | `svg`, `html` | +| `onOnline` | `ononline` | `svg`, `html` | +| `onPageHide` | `onpagehide` | `svg`, `html` | +| `onPageShow` | `onpageshow` | `svg`, `html` | +| `onPaste` | `onpaste` | `svg`, `html` | +| `onPause` | `onpause` | `svg`, `html` | +| `onPlay` | `onplay` | `svg`, `html` | +| `onPlaying` | `onplaying` | `svg`, `html` | +| `onPopState` | `onpopstate` | `svg`, `html` | +| `onProgress` | `onprogress` | `svg`, `html` | +| `onRateChange` | `onratechange` | `svg`, `html` | +| `onRejectionHandled` | `onrejectionhandled` | `html` | +| `onRepeat` | `onrepeat` | `svg` | +| `onReset` | `onreset` | `svg`, `html` | +| `onResize` | `onresize` | `svg`, `html` | +| `onScroll` | `onscroll` | `svg`, `html` | +| `onScrollEnd` | `onscrollend` | `html` | +| `onSecurityPolicyViolation` | `onsecuritypolicyviolation` | `html` | +| `onSeeked` | `onseeked` | `svg`, `html` | +| `onSeeking` | `onseeking` | `svg`, `html` | +| `onSelect` | `onselect` | `svg`, `html` | +| `onShow` | `onshow` | `svg` | +| `onSlotChange` | `onslotchange` | `html` | +| `onStalled` | `onstalled` | `svg`, `html` | +| `onStorage` | `onstorage` | `svg`, `html` | +| `onSubmit` | `onsubmit` | `svg`, `html` | +| `onSuspend` | `onsuspend` | `svg`, `html` | +| `onTimeUpdate` | `ontimeupdate` | `svg`, `html` | +| `onToggle` | `ontoggle` | `svg`, `html` | +| `onUnhandledRejection` | `onunhandledrejection` | `html` | +| `onUnload` | `onunload` | `svg`, `html` | +| `onVolumeChange` | `onvolumechange` | `svg`, `html` | +| `onWaiting` | `onwaiting` | `svg`, `html` | +| `onWheel` | `onwheel` | `html` | +| `onZoom` | `onzoom` | `svg` | +| `opacity` | `opacity` | `svg` | +| `open` | `open` | `html` | +| `operator` | `operator` | `svg` | +| `optimum` | `optimum` | `html` | +| `order` | `order` | `svg` | +| `orient` | `orient` | `svg` | +| `orientation` | `orientation` | `svg` | +| `origin` | `origin` | `svg` | +| `overflow` | `overflow` | `svg` | +| `overlay` | `overlay` | `svg` | +| `overlinePosition` | `overline-position` | `svg` | +| `overlineThickness` | `overline-thickness` | `svg` | +| `paintOrder` | `paint-order` | `svg` | +| `panose1` | `panose-1` | `svg` | +| `path` | `path` | `svg` | +| `pathLength` | `pathLength` | `svg` | +| `pattern` | `pattern` | `html` | +| `patternContentUnits` | `patternContentUnits` | `svg` | +| `patternTransform` | `patternTransform` | `svg` | +| `patternUnits` | `patternUnits` | `svg` | +| `phase` | `phase` | `svg` | +| `ping` | `ping` | `svg`, `html` | +| `pitch` | `pitch` | `svg` | +| `placeholder` | `placeholder` | `html` | +| `playbackOrder` | `playbackorder` | `svg` | +| `playsInline` | `playsinline` | `html` | +| `pointerEvents` | `pointer-events` | `svg` | +| `points` | `points` | `svg` | +| `pointsAtX` | `pointsAtX` | `svg` | +| `pointsAtY` | `pointsAtY` | `svg` | +| `pointsAtZ` | `pointsAtZ` | `svg` | +| `popover` | `popover` | `html` | +| `popoverTarget` | `popovertarget` | `html` | +| `popoverTargetAction` | `popovertargetaction` | `html` | +| `poster` | `poster` | `html` | +| `prefix` | `prefix` | `html` | +| `preload` | `preload` | `html` | +| `preserveAlpha` | `preserveAlpha` | `svg` | +| `preserveAspectRatio` | `preserveAspectRatio` | `svg` | +| `primitiveUnits` | `primitiveUnits` | `svg` | +| `profile` | `profile` | `html` | +| `prompt` | `prompt` | `html` | +| `propagate` | `propagate` | `svg` | +| `property` | `property` | `svg`, `html` | +| `r` | `r` | `svg` | +| `radius` | `radius` | `svg` | +| `readOnly` | `readonly` | `html` | +| `refX` | `refX` | `svg` | +| `refY` | `refY` | `svg` | +| `referrerPolicy` | `referrerpolicy` | `svg`, `html` | +| `rel` | `rel` | `svg`, `html` | +| `renderingIntent` | `rendering-intent` | `svg` | +| `repeatCount` | `repeatCount` | `svg` | +| `repeatDur` | `repeatDur` | `svg` | +| `required` | `required` | `html` | +| `requiredExtensions` | `requiredExtensions` | `svg` | +| `requiredFeatures` | `requiredFeatures` | `svg` | +| `requiredFonts` | `requiredFonts` | `svg` | +| `requiredFormats` | `requiredFormats` | `svg` | +| `resource` | `resource` | `svg` | +| `restart` | `restart` | `svg` | +| `result` | `result` | `svg` | +| `results` | `results` | `html` | +| `rev` | `rev` | `svg`, `html` | +| `reversed` | `reversed` | `html` | +| `rightMargin` | `rightmargin` | `html` | +| `role` | `role` | | +| `rotate` | `rotate` | `svg` | +| `rowSpan` | `rowspan` | `html` | +| `rows` | `rows` | `html` | +| `rules` | `rules` | `html` | +| `rx` | `rx` | `svg` | +| `ry` | `ry` | `svg` | +| `sandbox` | `sandbox` | `html` | +| `scale` | `scale` | `svg` | +| `scheme` | `scheme` | `html` | +| `scope` | `scope` | `html` | +| `scoped` | `scoped` | `html` | +| `scrolling` | `scrolling` | `html` | +| `seamless` | `seamless` | `html` | +| `security` | `security` | `html` | +| `seed` | `seed` | `svg` | +| `selected` | `selected` | `html` | +| `shadowRootClonable` | `shadowrootclonable` | `html` | +| `shadowRootDelegatesFocus` | `shadowrootdelegatesfocus` | `html` | +| `shadowRootMode` | `shadowrootmode` | `html` | +| `shape` | `shape` | `html` | +| `shapeRendering` | `shape-rendering` | `svg` | +| `side` | `side` | `svg` | +| `size` | `size` | `html` | +| `sizes` | `sizes` | `html` | +| `slope` | `slope` | `svg` | +| `slot` | `slot` | `html` | +| `snapshotTime` | `snapshotTime` | `svg` | +| `spacing` | `spacing` | `svg` | +| `span` | `span` | `html` | +| `specularConstant` | `specularConstant` | `svg` | +| `specularExponent` | `specularExponent` | `svg` | +| `spellCheck` | `spellcheck` | `html` | +| `spreadMethod` | `spreadMethod` | `svg` | +| `src` | `src` | `html` | +| `srcDoc` | `srcdoc` | `html` | +| `srcLang` | `srclang` | `html` | +| `srcSet` | `srcset` | `html` | +| `standby` | `standby` | `html` | +| `start` | `start` | `html` | +| `startOffset` | `startOffset` | `svg` | +| `stdDeviation` | `stdDeviation` | `svg` | +| `stemh` | `stemh` | `svg` | +| `stemv` | `stemv` | `svg` | +| `step` | `step` | `html` | +| `stitchTiles` | `stitchTiles` | `svg` | +| `stopColor` | `stop-color` | `svg` | +| `stopOpacity` | `stop-opacity` | `svg` | +| `strikethroughPosition` | `strikethrough-position` | `svg` | +| `strikethroughThickness` | `strikethrough-thickness` | `svg` | +| `string` | `string` | `svg` | +| `stroke` | `stroke` | `svg` | +| `strokeDashArray` | `stroke-dasharray` | `svg` | +| `strokeDashOffset` | `stroke-dashoffset` | `svg` | +| `strokeLineCap` | `stroke-linecap` | `svg` | +| `strokeLineJoin` | `stroke-linejoin` | `svg` | +| `strokeMiterLimit` | `stroke-miterlimit` | `svg` | +| `strokeOpacity` | `stroke-opacity` | `svg` | +| `strokeWidth` | `stroke-width` | `svg` | +| `style` | `style` | `svg`, `html` | +| `summary` | `summary` | `html` | +| `surfaceScale` | `surfaceScale` | `svg` | +| `syncBehavior` | `syncBehavior` | `svg` | +| `syncBehaviorDefault` | `syncBehaviorDefault` | `svg` | +| `syncMaster` | `syncMaster` | `svg` | +| `syncTolerance` | `syncTolerance` | `svg` | +| `syncToleranceDefault` | `syncToleranceDefault` | `svg` | +| `systemLanguage` | `systemLanguage` | `svg` | +| `tabIndex` | `tabindex` | `svg`, `html` | +| `tableValues` | `tableValues` | `svg` | +| `target` | `target` | `svg`, `html` | +| `targetX` | `targetX` | `svg` | +| `targetY` | `targetY` | `svg` | +| `text` | `text` | `html` | +| `textAnchor` | `text-anchor` | `svg` | +| `textDecoration` | `text-decoration` | `svg` | +| `textLength` | `textLength` | `svg` | +| `textRendering` | `text-rendering` | `svg` | +| `timelineBegin` | `timelinebegin` | `svg` | +| `title` | `title` | `svg`, `html` | +| `to` | `to` | `svg` | +| `topMargin` | `topmargin` | `html` | +| `transform` | `transform` | `svg` | +| `transformBehavior` | `transformBehavior` | `svg` | +| `transformOrigin` | `transform-origin` | `svg` | +| `translate` | `translate` | `html` | +| `type` | `type` | `svg`, `html` | +| `typeMustMatch` | `typemustmatch` | `html` | +| `typeOf` | `typeof` | `svg` | +| `u1` | `u1` | `svg` | +| `u2` | `u2` | `svg` | +| `underlinePosition` | `underline-position` | `svg` | +| `underlineThickness` | `underline-thickness` | `svg` | +| `unicode` | `unicode` | `svg` | +| `unicodeBidi` | `unicode-bidi` | `svg` | +| `unicodeRange` | `unicode-range` | `svg` | +| `unitsPerEm` | `units-per-em` | `svg` | +| `unselectable` | `unselectable` | `html` | +| `useMap` | `usemap` | `html` | +| `vAlign` | `valign` | `html` | +| `vAlphabetic` | `v-alphabetic` | `svg` | +| `vHanging` | `v-hanging` | `svg` | +| `vIdeographic` | `v-ideographic` | `svg` | +| `vLink` | `vlink` | `html` | +| `vMathematical` | `v-mathematical` | `svg` | +| `vSpace` | `vspace` | `html` | +| `value` | `value` | `html` | +| `valueType` | `valuetype` | `html` | +| `values` | `values` | `svg` | +| `vectorEffect` | `vector-effect` | `svg` | +| `version` | `version` | `svg`, `html` | +| `vertAdvY` | `vert-adv-y` | `svg` | +| `vertOriginX` | `vert-origin-x` | `svg` | +| `vertOriginY` | `vert-origin-y` | `svg` | +| `viewBox` | `viewBox` | `svg` | +| `viewTarget` | `viewTarget` | `svg` | +| `visibility` | `visibility` | `svg` | +| `width` | `width` | `svg`, `html` | +| `widths` | `widths` | `svg` | +| `wordSpacing` | `word-spacing` | `svg` | +| `wrap` | `wrap` | `html` | +| `writingMode` | `writing-mode` | `svg` | +| `writingSuggestions` | `writingsuggestions` | `html` | +| `x` | `x` | `svg` | +| `x1` | `x1` | `svg` | +| `x2` | `x2` | `svg` | +| `xChannelSelector` | `xChannelSelector` | `svg` | +| `xHeight` | `x-height` | `svg` | +| `xLinkActuate` | `xlink:actuate` | `xlink` | +| `xLinkArcRole` | `xlink:arcrole` | `xlink` | +| `xLinkHref` | `xlink:href` | `xlink` | +| `xLinkRole` | `xlink:role` | `xlink` | +| `xLinkShow` | `xlink:show` | `xlink` | +| `xLinkTitle` | `xlink:title` | `xlink` | +| `xLinkType` | `xlink:type` | `xlink` | +| `xmlBase` | `xml:base` | `xml` | +| `xmlLang` | `xml:lang` | `xml` | +| `xmlSpace` | `xml:space` | `xml` | +| `xmlns` | `xmlns` | `xmlns` | +| `xmlnsXLink` | `xmlns:xlink` | `xmlns` | +| `y` | `y` | `svg` | +| `y1` | `y1` | `svg` | +| `y2` | `y2` | `svg` | +| `yChannelSelector` | `yChannelSelector` | `svg` | +| `z` | `z` | `svg` | +| `zoomAndPan` | `zoomAndPan` | `svg` | + +<!--list end--> + +## Security + +This package is safe. + +## Related + +* [`wooorm/web-namespaces`][github-web-namespaces] + — list of web namespaces +* [`wooorm/space-separated-tokens`](https://github.com/wooorm/space-separated-tokens) + — parse/stringify space separated tokens +* [`wooorm/comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens) + — parse/stringify comma separated tokens +* [`wooorm/html-tag-names`](https://github.com/wooorm/html-tag-names) + — list of HTML tag names +* [`wooorm/mathml-tag-names`](https://github.com/wooorm/mathml-tag-names) + — list of MathML tag names +* [`wooorm/svg-tag-names`](https://github.com/wooorm/svg-tag-names) + — list of SVG tag names +* [`wooorm/html-void-elements`](https://github.com/wooorm/html-void-elements) + — list of void HTML tag names +* [`wooorm/svg-element-attributes`](https://github.com/wooorm/svg-element-attributes) + — map of SVG elements to allowed attributes +* [`wooorm/html-element-attributes`](https://github.com/wooorm/html-element-attributes) + — map of HTML elements to allowed attributes +* [`wooorm/aria-attributes`](https://github.com/wooorm/aria-attributes) + — list of ARIA attributes + +## Contribute + +Yes please! +See [*How to Contribute to Open Source*][opensource-guide]. + +## License + +[MIT][file-license] © [Titus Wormer][wooorm] + +Derivative work based on [React][github-react-source] licensed under +[MIT][github-react-source-license] © Facebook, Inc. + +[api-find]: #findschema-name + +[api-hast-to-react]: #hasttoreact + +[api-html]: #html + +[api-info]: #info + +[api-normalize]: #normalizename + +[api-schema]: #schema + +[api-space]: #space + +[api-svg]: #svg + +[badge-build-image]: https://github.com/wooorm/property-information/workflows/main/badge.svg + +[badge-build-url]: https://github.com/wooorm/property-information/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/wooorm/property-information.svg + +[badge-coverage-url]: https://codecov.io/github/wooorm/property-information + +[badge-downloads-image]: https://img.shields.io/npm/dm/property-information.svg + +[badge-downloads-url]: https://www.npmjs.com/package/property-information + +[badge-size-image]: https://img.shields.io/bundlejs/size/property-information + +[badge-size-url]: https://bundlejs.com/?q=property-information + +[esmsh]: https://esm.sh + +[file-license]: license + +[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[github-hast]: https://github.com/syntax-tree/hast + +[github-hast-property-name]: https://github.com/syntax-tree/hast#propertyname + +[github-react]: https://github.com/facebook/react + +[github-react-source]: https://github.com/facebook/react/blob/4632e36/packages/react-dom-bindings/src/shared/possibleStandardNames.js + +[github-react-source-license]: https://github.com/facebook/react/blob/4632e36/LICENSE + +[github-web-namespaces]: https://github.com/wooorm/web-namespaces + +[mozilla-dataset]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset + +[npmjs-install]: https://docs.npmjs.com/cli/install + +[opensource-guide]: https://opensource.guide/how-to-contribute/ + +[section-support]: #support + +[typescript]: https://www.typescriptlang.org + +[wooorm]: https://wooorm.com diff --git a/node_modules/react-markdown/index.d.ts b/node_modules/react-markdown/index.d.ts new file mode 100644 index 00000000..8ccbbf0d --- /dev/null +++ b/node_modules/react-markdown/index.d.ts @@ -0,0 +1,7 @@ +export type AllowElement = import("./lib/index.js").AllowElement; +export type Components = import("./lib/index.js").Components; +export type ExtraProps = import("./lib/index.js").ExtraProps; +export type Options = import("./lib/index.js").Options; +export type UrlTransform = import("./lib/index.js").UrlTransform; +export { MarkdownAsync, MarkdownHooks, Markdown as default, defaultUrlTransform } from "./lib/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/react-markdown/index.d.ts.map b/node_modules/react-markdown/index.d.ts.map new file mode 100644 index 00000000..774ec64c --- /dev/null +++ b/node_modules/react-markdown/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"2BACa,OAAO,gBAAgB,EAAE,YAAY;yBACrC,OAAO,gBAAgB,EAAE,UAAU;yBACnC,OAAO,gBAAgB,EAAE,UAAU;sBACnC,OAAO,gBAAgB,EAAE,OAAO;2BAChC,OAAO,gBAAgB,EAAE,YAAY"} \ No newline at end of file diff --git a/node_modules/react-markdown/index.js b/node_modules/react-markdown/index.js new file mode 100644 index 00000000..629aec01 --- /dev/null +++ b/node_modules/react-markdown/index.js @@ -0,0 +1,14 @@ +/** + * @typedef {import('./lib/index.js').AllowElement} AllowElement + * @typedef {import('./lib/index.js').Components} Components + * @typedef {import('./lib/index.js').ExtraProps} ExtraProps + * @typedef {import('./lib/index.js').Options} Options + * @typedef {import('./lib/index.js').UrlTransform} UrlTransform + */ + +export { + MarkdownAsync, + MarkdownHooks, + Markdown as default, + defaultUrlTransform +} from './lib/index.js' diff --git a/node_modules/react-markdown/license b/node_modules/react-markdown/license new file mode 100644 index 00000000..f552fc95 --- /dev/null +++ b/node_modules/react-markdown/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Espen Hovlandsdal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/react-markdown/package.json b/node_modules/react-markdown/package.json new file mode 100644 index 00000000..8b5dce3c --- /dev/null +++ b/node_modules/react-markdown/package.json @@ -0,0 +1,167 @@ +{ + "author": "Espen Hovlandsdal <espen@hovlandsdal.com>", + "bugs": "https://github.com/remarkjs/react-markdown/issues", + "contributors": [ + "Alexander Wallin <office@alexanderwallin.com>", + "Alexander Wong <admin@alexander-wong.com>", + "André Staltz <andre@staltz.com>", + "Angus MacIsaac <angus.macisaac@busbud.com>", + "Beau Roberts <beau.roberts@autodesk.com>", + "Charlie Chen <doveccl@live.com>", + "Christian Murphy <christian.murphy.42@gmail.com>", + "Christoph Werner <christoph@codepunkt.de>", + "Danny <dannyharding10@gmail.com>", + "Dennis S <denis.s@svsg.co>", + "Espen Hovlandsdal <espen@hovlandsdal.com>", + "Evan Hensleigh <futuraprime@gmail.com>", + "Fabian Irsara <info@fabianirsara.com>", + "Florentin Luca Rieger <florentin.rieger@gmail.com>", + "Frank <frankieali4@gmail.com>", + "Igor Kamyshev <garik.novel@gmail.com>", + "Jack Williams <jsw547@gmail.com>", + "Jakub Chrzanowski <jakub@chrzanowski.info>", + "Jeremy Moseley <jeremy@jeremymoseley.net>", + "Jesse Pinho <jesse@jessepinho.com>", + "Kelvin Chan <kchan@securitycompass.com>", + "Kohei Asai <me@axross.io>", + "Linus Unnebäck <linus@folkdatorn.se>", + "Marshall Smith <marshall@radialdevgroup.com>", + "Nathan Bierema <nbierema@gmail.com>", + "Nicolas Venegas <nvenegas@atlassian.com>", + "Peng Guanwen <pg999w@outlook.com>", + "Petr Gazarov <petrgazarov@gmail.com>", + "Phil Rajchgot <tophil@outlook.com>", + "Rasmus Eneman <rasmus@eneman.eu>", + "René Kooi <renee@kooi.me>", + "Riku Rouvila <riku.rouvila@gmail.com>", + "Robin Wieruch <wrobin@gmx.net>", + "Rostyslav Melnychuk <blackswordgc@gmail.com>", + "Ted Piotrowski <tppiotrowski@gmail.com>", + "Thibaud Courtoison <do.not.press.enter@gmail.com>", + "Thomas Lindstrøm <t@hom.as>", + "Tiago Roldão <focus5.6@gmail.com>", + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "cerkiewny <mstarzycki@gmail.com>", + "evoye <rosej@gmx.net>", + "gRoberts84 <gavin@gav-roberts.co.uk>", + "mudrz <mudrz@outlook.com>", + "vanchagreen <vanchagreen@gmail.com>" + ], + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "description": "React component to render markdown", + "devDependencies": { + "@types/node": "^22.0.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "c8": "^10.0.0", + "concat-stream": "^2.0.0", + "esbuild": "^0.25.0", + "eslint-plugin-react": "^7.0.0", + "prettier": "^3.0.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "rehype-raw": "^7.0.0", + "rehype-starry-night": "^2.0.0", + "remark-cli": "^12.0.0", + "remark-gfm": "^4.0.0", + "remark-preset-wooorm": "^11.0.0", + "remark-toc": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "ast", + "commonmark", + "component", + "gfm", + "markdown", + "react", + "react-component", + "remark", + "unified" + ], + "license": "MIT", + "name": "react-markdown", + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + }, + "prettier": { + "bracketSpacing": false, + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm", + [ + "remark-lint-no-html", + false + ] + ] + }, + "repository": "remarkjs/react-markdown", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api": "node --conditions development --experimental-loader=./script/load-jsx.js --no-warnings test.jsx", + "test-coverage": "c8 --100 --exclude script/ --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "9.1.0", + "xo": { + "envs": [ + "shared-node-browser" + ], + "extends": "plugin:react/jsx-runtime", + "overrides": [ + { + "files": [ + "**/*.jsx" + ], + "rules": { + "no-unused-vars": "off" + } + } + ], + "prettier": true, + "rules": { + "complexity": "off", + "n/file-extension-in-import": "off", + "unicorn/prevent-abbreviations": "off" + } + } +} diff --git a/node_modules/react-markdown/readme.md b/node_modules/react-markdown/readme.md new file mode 100644 index 00000000..d1ff26ca --- /dev/null +++ b/node_modules/react-markdown/readme.md @@ -0,0 +1,932 @@ +<!-- + Notes for maintaining this document: + + * update the version of the link for `commonmark-html` once in a while +--> + +# react-markdown + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +React component to render markdown. + +## Feature highlights + +* [x] **[safe][section-security] by default** + (no `dangerouslySetInnerHTML` or XSS attacks) +* [x] **[components][section-components]** + (pass your own component to use instead of `<h2>` for `## hi`) +* [x] **[plugins][section-plugins]** + (many plugins you can pick and choose from) +* [x] **[compliant][section-syntax]** + (100% to CommonMark, 100% to GFM with a plugin) + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`Markdown`](#markdown) + * [`MarkdownAsync`](#markdownasync) + * [`MarkdownHooks`](#markdownhooks) + * [`defaultUrlTransform(url)`](#defaulturltransformurl) + * [`AllowElement`](#allowelement) + * [`Components`](#components) + * [`ExtraProps`](#extraprops) + * [`Options`](#options) + * [`UrlTransform`](#urltransform) +* [Examples](#examples) + * [Use a plugin](#use-a-plugin) + * [Use a plugin with options](#use-a-plugin-with-options) + * [Use custom components (syntax highlight)](#use-custom-components-syntax-highlight) + * [Use remark and rehype plugins (math)](#use-remark-and-rehype-plugins-math) +* [Plugins](#plugins) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Architecture](#architecture) +* [Appendix A: HTML in markdown](#appendix-a-html-in-markdown) +* [Appendix B: Components](#appendix-b-components) +* [Appendix C: line endings in markdown (and JSX)](#appendix-c-line-endings-in-markdown-and-jsx) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a [React][] component that can be given a string of markdown +that it’ll safely render to React elements. +You can pass plugins to change how markdown is transformed and pass components +that will be used instead of normal HTML elements. + +* to learn markdown, see this [cheatsheet and tutorial][commonmark-help] +* to try out `react-markdown`, see [our demo][github-io-react-markdown] + +## When should I use this? + +There are other ways to use markdown in React out there so why use this one? +The three main reasons are that they often rely on `dangerouslySetInnerHTML`, +have bugs with how they handle markdown, or don’t let you swap elements for +components. +`react-markdown` builds a virtual DOM, so React only replaces what changed, +from a syntax tree. +That’s supported because we use [unified][github-unified], +specifically [remark][github-remark] for markdown and [rehype][github-rehype] +for HTML, +which are popular tools to transform content with plugins. + +This package focusses on making it easy for beginners to safely use markdown in +React. +When you’re familiar with unified, you can use a modern hooks based alternative +[`react-remark`][github-react-remark] or [`rehype-react`][github-rehype-react] +manually. +If you instead want to use JavaScript and JSX *inside* markdown files, use +[MDX][github-mdx]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][npm-install]: + +```sh +npm install react-markdown +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import Markdown from 'https://esm.sh/react-markdown@9' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import Markdown from 'https://esm.sh/react-markdown@9?bundle' +</script> +``` + +## Use + +A basic hello world: + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' + +const markdown = '# Hi, *Pluto*!' + +createRoot(document.body).render(<Markdown>{markdown}</Markdown>) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<h1> + Hi, <em>Pluto</em>! +</h1> +``` + +</details> + +Here is an example that shows how to use a plugin +([`remark-gfm`][github-remark-gfm], +which adds support for footnotes, strikethrough, tables, tasklists and +URLs directly): + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import remarkGfm from 'remark-gfm' + +const markdown = `Just a link: www.nasa.gov.` + +createRoot(document.body).render( + <Markdown remarkPlugins={[remarkGfm]}>{markdown}</Markdown> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<p> + Just a link: <a href="http://www.nasa.gov">www.nasa.gov</a>. +</p> +``` + +</details> + +## API + +This package exports the identifiers +[`MarkdownAsync`][api-markdown-async], +[`MarkdownHooks`][api-markdown-hooks], +and +[`defaultUrlTransform`][api-default-url-transform]. +The default export is [`Markdown`][api-markdown]. + +### `Markdown` + +Component to render markdown. + +This is a synchronous component. +When using async plugins, +see [`MarkdownAsync`][api-markdown-async] or +[`MarkdownHooks`][api-markdown-hooks]. + +###### Parameters + +* `options` ([`Options`][api-options]) + — props + +###### Returns + +React element (`JSX.Element`). + +### `MarkdownAsync` + +Component to render markdown with support for async plugins +through async/await. + +Components returning promises are supported on the server. +For async support on the client, +see [`MarkdownHooks`][api-markdown-hooks]. + +###### Parameters + +* `options` ([`Options`][api-options]) + — props + +###### Returns + +Promise to a React element (`Promise<JSX.Element>`). + +### `MarkdownHooks` + +Component to render markdown with support for async plugins through hooks. + +This uses `useEffect` and `useState` hooks. +Hooks run on the client and do not immediately render something. +For async support on the server, +see [`MarkdownAsync`][api-markdown-async]. + +###### Parameters + +* `options` ([`Options`][api-options]) + — props + +###### Returns + +React element (`JSX.Element`). + +### `defaultUrlTransform(url)` + +Make a URL safe. + +###### Parameters + +* `url` (`string`) + — URL + +###### Returns + +Safe URL (`string`). + +### `AllowElement` + +Filter elements (TypeScript type). + +###### Parameters + +* `node` ([`Element` from `hast`][github-hast-element]) + — element to check +* `index` (`number | undefined`) + — index of `element` in `parent` +* `parent` ([`Node` from `hast`][github-hast-nodes]) + — parent of `element` + +###### Returns + +Whether to allow `element` (`boolean`, optional). + +### `Components` + +Map tag names to components (TypeScript type). + +###### Type + +```ts +import type {Element} from 'hast' + +type Components = Partial<{ + [TagName in keyof JSX.IntrinsicElements]: + // Class component: + | (new (props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.ElementClass) + // Function component: + | ((props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.Element | string | null | undefined) + // Tag name: + | keyof JSX.IntrinsicElements +}> +``` + +### `ExtraProps` + +Extra fields we pass to components (TypeScript type). + +###### Fields + +* `node` ([`Element` from `hast`][github-hast-element], optional) + — original node + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `allowElement` ([`AllowElement`][api-allow-element], optional) + — filter elements; + `allowedElements` / `disallowedElements` is used first +* `allowedElements` (`Array<string>`, default: all tag names) + — tag names to allow; + cannot combine w/ `disallowedElements` +* `children` (`string`, optional) + — markdown +* `className` (`string`, optional) + — wrap in a `div` with this class name +* `components` ([`Components`][api-components], optional) + — map tag names to components +* `disallowedElements` (`Array<string>`, default: `[]`) + — tag names to disallow; + cannot combine w/ `allowedElements` +* `rehypePlugins` (`Array<Plugin>`, optional) + — list of [rehype plugins][github-rehype-plugins] to use +* `remarkPlugins` (`Array<Plugin>`, optional) + — list of [remark plugins][github-remark-plugins] to use +* `remarkRehypeOptions` + ([`Options` from `remark-rehype`][github-remark-rehype-options], + optional) + — options to pass through to `remark-rehype` +* `skipHtml` (`boolean`, default: `false`) + — ignore HTML in markdown completely +* `unwrapDisallowed` (`boolean`, default: `false`) + — extract (unwrap) what’s in disallowed elements; + normally when say `strong` is not allowed, it and it’s children are dropped, + with `unwrapDisallowed` the element itself is replaced by its children +* `urlTransform` ([`UrlTransform`][api-url-transform], default: + [`defaultUrlTransform`][api-default-url-transform]) + — change URLs + +### `UrlTransform` + +Transform URLs (TypeScript type). + +###### Parameters + +* `url` (`string`) + — URL +* `key` (`string`, example: `'href'`) + — property name +* `node` ([`Element` from `hast`][github-hast-element]) + — element to check + +###### Returns + +Transformed URL (`string`, optional). + +## Examples + +### Use a plugin + +This example shows how to use a remark plugin. +In this case, [`remark-gfm`][github-remark-gfm], +which adds support for strikethrough, tables, tasklists and URLs directly: + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import remarkGfm from 'remark-gfm' + +const markdown = `A paragraph with *emphasis* and **strong importance**. + +> A block quote with ~strikethrough~ and a URL: https://reactjs.org. + +* Lists +* [ ] todo +* [x] done + +A table: + +| a | b | +| - | - | +` + +createRoot(document.body).render( + <Markdown remarkPlugins={[remarkGfm]}>{markdown}</Markdown> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<> + <p> + A paragraph with <em>emphasis</em> and <strong>strong importance</strong>. + </p> + <blockquote> + <p> + A block quote with <del>strikethrough</del> and a URL:{' '} + <a href="https://reactjs.org">https://reactjs.org</a>. + </p> + </blockquote> + <ul className="contains-task-list"> + <li>Lists</li> + <li className="task-list-item"> + <input type="checkbox" disabled /> todo + </li> + <li className="task-list-item"> + <input type="checkbox" disabled checked /> done + </li> + </ul> + <p>A table:</p> + <table> + <thead> + <tr> + <th>a</th> + <th>b</th> + </tr> + </thead> + </table> +</> +``` + +</details> + +### Use a plugin with options + +This example shows how to use a plugin and give it options. +To do that, use an array with the plugin at the first place, and the options +second. +[`remark-gfm`][github-remark-gfm] has an option to allow only double tildes for +strikethrough: + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import remarkGfm from 'remark-gfm' + +const markdown = 'This ~is not~ strikethrough, but ~~this is~~!' + +createRoot(document.body).render( + <Markdown remarkPlugins={[[remarkGfm, {singleTilde: false}]]}> + {markdown} + </Markdown> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<p> + This ~is not~ strikethrough, but <del>this is</del>! +</p> +``` + +</details> + +### Use custom components (syntax highlight) + +This example shows how you can overwrite the normal handling of an element by +passing a component. +In this case, we apply syntax highlighting with the seriously super amazing +[`react-syntax-highlighter`][github-react-syntax-highlighter] by +[**@conorhastings**][github-conorhastings]: + +<!-- To do: currently broken on actual ESM; let’s find an alternative? --> + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import {Prism as SyntaxHighlighter} from 'react-syntax-highlighter' +import {dark} from 'react-syntax-highlighter/dist/esm/styles/prism' + +// Did you know you can use tildes instead of backticks for code in markdown? ✨ +const markdown = `Here is some JavaScript code: + +~~~js +console.log('It works!') +~~~ +` + +createRoot(document.body).render( + <Markdown + children={markdown} + components={{ + code(props) { + const {children, className, node, ...rest} = props + const match = /language-(\w+)/.exec(className || '') + return match ? ( + <SyntaxHighlighter + {...rest} + PreTag="div" + children={String(children).replace(/\n$/, '')} + language={match[1]} + style={dark} + /> + ) : ( + <code {...rest} className={className}> + {children} + </code> + ) + } + }} + /> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<> + <p>Here is some JavaScript code:</p> + <pre> + <SyntaxHighlighter language="js" style={dark} PreTag="div" children="console.log('It works!')" /> + </pre> +</> +``` + +</details> + +### Use remark and rehype plugins (math) + +This example shows how a syntax extension +(through [`remark-math`][github-remark-math]) +is used to support math in markdown, and a transform plugin +([`rehype-katex`][github-rehype-katex]) to render that math. + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import rehypeKatex from 'rehype-katex' +import remarkMath from 'remark-math' +import 'katex/dist/katex.min.css' // `rehype-katex` does not import the CSS for you + +const markdown = `The lift coefficient ($C_L$) is a dimensionless coefficient.` + +createRoot(document.body).render( + <Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}> + {markdown} + </Markdown> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<p> + The lift coefficient ( + <span className="katex"> + <span className="katex-mathml"> + <math xmlns="http://www.w3.org/1998/Math/MathML">{/* … */}</math> + </span> + <span className="katex-html" aria-hidden="true"> + {/* … */} + </span> + </span> + ) is a dimensionless coefficient. +</p> +``` + +</details> + +## Plugins + +We use [unified][github-unified], +specifically [remark][github-remark] for markdown and +[rehype][github-rehype] for HTML, +which are tools to transform content with plugins. +Here are three good ways to find plugins: + +* [`awesome-remark`][github-awesome-remark] and + [`awesome-rehype`][github-awesome-rehype] + — selection of the most awesome projects +* [List of remark plugins][github-remark-plugins] and + [list of rehype plugins][github-rehype-plugins] + — list of all plugins +* [`remark-plugin`][github-topic-remark-plugin] and + [`rehype-plugin`][github-topic-rehype-plugin] topics + — any tagged repo on GitHub + +## Syntax + +`react-markdown` follows CommonMark, which standardizes the differences between +markdown implementations, by default. +Some syntax extensions are supported through plugins. + +We use [`micromark`][github-micromark] under the hood for our parsing. +See its documentation for more information on markdown, CommonMark, and +extensions. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types +[`AllowElement`][api-allow-element], +[`ExtraProps`][api-extra-props], +[`Components`][api-components], +[`Options`][api-options], and +[`UrlTransform`][api-url-transform]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `react-markdown@^9`, +compatible with Node.js 16. + +They work in all modern browsers (essentially: everything not IE 11). +You can use a bundler (such as esbuild, webpack, or Rollup) to use this package +in your project, and use its options (or plugins) to add support for legacy +browsers. + +## Architecture + +<pre><code> react-markdown + +----------------------------------------------------------------------------------------------------------------+ + | | + | +----------+ +----------------+ +---------------+ +----------------+ +------------+ | + | | | | | | | | | | | | +<a href="https://commonmark.org">markdown</a>-+->+ <a href="https://github.com/remarkjs/remark">remark</a> +-<a href="https://github.com/syntax-tree/mdast">mdast</a>->+ <a href="https://github.com/remarkjs/remark/blob/main/doc/plugins.md">remark plugins</a> +-<a href="https://github.com/syntax-tree/mdast">mdast</a>->+ <a href="https://github.com/remarkjs/remark-rehype">remark-rehype</a> +-<a href="https://github.com/syntax-tree/hast">hast</a>->+ <a href="https://github.com/rehypejs/rehype/blob/main/doc/plugins.md">rehype plugins</a> +-<a href="https://github.com/syntax-tree/hast">hast</a>->+ <a href="#appendix-b-components">components</a> +-+->react elements + | | | | | | | | | | | | + | +----------+ +----------------+ +---------------+ +----------------+ +------------+ | + | | + +----------------------------------------------------------------------------------------------------------------+ +</code></pre> + +To understand what this project does, it’s important to first understand what +unified does: please read through the [`unifiedjs/unified`][github-unified] +readme +(the part until you hit the API section is required reading). + +`react-markdown` is a unified pipeline — wrapped so that most folks don’t need +to directly interact with unified. +The processor goes through these steps: + +* parse markdown to mdast (markdown syntax tree) +* transform through remark (markdown ecosystem) +* transform mdast to hast (HTML syntax tree) +* transform through rehype (HTML ecosystem) +* render hast to React with components + +## Appendix A: HTML in markdown + +`react-markdown` typically escapes HTML (or ignores it, with `skipHtml`) +because it is dangerous and defeats the purpose of this library. + +However, if you are in a trusted environment (you trust the markdown), and +can spare the bundle size (±60kb minzipped), then you can use +[`rehype-raw`][github-rehype-raw]: + +```js +import React from 'react' +import {createRoot} from 'react-dom/client' +import Markdown from 'react-markdown' +import rehypeRaw from 'rehype-raw' + +const markdown = `<div class="note"> + +Some *emphasis* and <strong>strong</strong>! + +</div>` + +createRoot(document.body).render( + <Markdown rehypePlugins={[rehypeRaw]}>{markdown}</Markdown> +) +``` + +<details> +<summary>Show equivalent JSX</summary> + +```js +<div className="note"> + <p> + Some <em>emphasis</em> and <strong>strong</strong>! + </p> +</div> +``` + +</details> + +**Note**: HTML in markdown is still bound by how [HTML works in +CommonMark][commonmark-html]. +Make sure to use blank lines around block-level HTML that again contains +markdown! + +## Appendix B: Components + +You can also change the things that come from markdown: + +```js +<Markdown + components={{ + // Map `h1` (`# heading`) to use `h2`s. + h1: 'h2', + // Rewrite `em`s (`*like so*`) to `i` with a red foreground color. + em(props) { + const {node, ...rest} = props + return <i style={{color: 'red'}} {...rest} /> + } + }} +/> +``` + +The keys in components are HTML equivalents for the things you write with +markdown (such as `h1` for `# heading`). +Normally, in markdown, those are: `a`, `blockquote`, `br`, `code`, `em`, `h1`, +`h2`, `h3`, `h4`, `h5`, `h6`, `hr`, `img`, `li`, `ol`, `p`, `pre`, `strong`, and +`ul`. +With [`remark-gfm`][github-remark-gfm], +you can also use `del`, `input`, `table`, `tbody`, `td`, `th`, `thead`, and `tr`. +Other remark or rehype plugins that add support for new constructs will also +work with `react-markdown`. + +The props that are passed are what you probably would expect: an `a` (link) will +get `href` (and `title`) props, and `img` (image) an `src`, `alt` and `title`, +etc. + +Every component will receive a `node`. +This is the original [`Element` from `hast`][github-hast-element] element being +turned into a React element. + +## Appendix C: line endings in markdown (and JSX) + +You might have trouble with how line endings work in markdown and JSX. +We recommend the following, which solves all line ending problems: + +```js +// If you write actual markdown in your code, put your markdown in a variable; +// **do not indent markdown**: +const markdown = ` +# This is perfect! +` + +// Pass the value as an expression as an only child: +const result = <Markdown>{markdown}</Markdown> +``` + +👆 That works. +Read on for what doesn’t and why that is. + +You might try to write markdown directly in your JSX and find that it **does +not** work: + +```js +<Markdown> + # Hi + + This is **not** a paragraph. +</Markdown> +``` + +The is because in JSX the whitespace (including line endings) is collapsed to +a single space. +So the above example is equivalent to: + +```js +<Markdown> # Hi This is **not** a paragraph. </Markdown> +``` + +Instead, to pass markdown to `Markdown`, you can use an expression: +with a template literal: + +```js +<Markdown>{` +# Hi + +This is a paragraph. +`}</Markdown> +``` + +Template literals have another potential problem, because they keep whitespace +(including indentation) inside them. +That means that the following **does not** turn into a heading: + +```js +<Markdown>{` + # This is **not** a heading, it’s an indented code block +`}</Markdown> +``` + +## Security + +Use of `react-markdown` is secure by default. +Overwriting `urlTransform` to something insecure will open you up to XSS +vectors. +Furthermore, the `remarkPlugins`, `rehypePlugins`, and `components` you use may +be insecure. + +To make sure the content is completely safe, even after what plugins do, +use [`rehype-sanitize`][github-rehype-sanitize]. +It lets you define your own schema of what is and isn’t allowed. + +## Related + +* [`MDX`][github-mdx] + — JSX *in* markdown +* [`remark-gfm`][github-remark-gfm] + — add support for GitHub flavored markdown support +* [`react-remark`][github-react-remark] + — hook based alternative +* [`rehype-react`][github-rehype-react] + — turn HTML into React elements + +## Contribute + +See [`contributing.md`][health-contributing] in [`remarkjs/.github`][health] +for ways to get started. +See [`support.md`][health-support] for ways to get help. + +This project has a [code of conduct][health-coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][file-license] © [Espen Hovlandsdal][author] + +[api-allow-element]: #allowelement + +[api-components]: #components + +[api-default-url-transform]: #defaulturltransformurl + +[api-extra-props]: #extraprops + +[api-markdown]: #markdown + +[api-markdown-async]: #markdownasync + +[api-markdown-hooks]: #markdownhooks + +[api-options]: #options + +[api-url-transform]: #urltransform + +[author]: https://espen.codes/ + +[badge-build-image]: https://github.com/remarkjs/react-markdown/workflows/main/badge.svg + +[badge-build-url]: https://github.com/remarkjs/react-markdown/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/remarkjs/react-markdown.svg + +[badge-coverage-url]: https://codecov.io/github/remarkjs/react-markdown + +[badge-downloads-image]: https://img.shields.io/npm/dm/react-markdown.svg + +[badge-downloads-url]: https://www.npmjs.com/package/react-markdown + +[badge-size-image]: https://img.shields.io/bundlejs/size/react-markdown + +[badge-size-url]: https://bundlejs.com/?q=react-markdown + +[commonmark-help]: https://commonmark.org/help/ + +[commonmark-html]: https://spec.commonmark.org/0.31.2/#html-blocks + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[file-license]: license + +[github-awesome-rehype]: https://github.com/rehypejs/awesome-rehype + +[github-awesome-remark]: https://github.com/remarkjs/awesome-remark + +[github-conorhastings]: https://github.com/conorhastings + +[github-hast-element]: https://github.com/syntax-tree/hast#element + +[github-hast-nodes]: https://github.com/syntax-tree/hast#nodes + +[github-io-react-markdown]: https://remarkjs.github.io/react-markdown/ + +[github-mdx]: https://github.com/mdx-js/mdx/ + +[github-micromark]: https://github.com/micromark/micromark + +[github-react-remark]: https://github.com/remarkjs/react-remark + +[github-react-syntax-highlighter]: https://github.com/react-syntax-highlighter/react-syntax-highlighter + +[github-rehype]: https://github.com/rehypejs/rehype + +[github-rehype-katex]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-katex + +[github-rehype-plugins]: https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins + +[github-rehype-raw]: https://github.com/rehypejs/rehype-raw + +[github-rehype-react]: https://github.com/rehypejs/rehype-react + +[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[github-remark]: https://github.com/remarkjs/remark + +[github-remark-gfm]: https://github.com/remarkjs/remark-gfm + +[github-remark-math]: https://github.com/remarkjs/remark-math + +[github-remark-plugins]: https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins + +[github-remark-rehype-options]: https://github.com/remarkjs/remark-rehype#options + +[github-topic-rehype-plugin]: https://github.com/topics/rehype-plugin + +[github-topic-remark-plugin]: https://github.com/topics/remark-plugin + +[github-unified]: https://github.com/unifiedjs/unified + +[health]: https://github.com/remarkjs/.github + +[health-coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md + +[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md + +[health-support]: https://github.com/remarkjs/.github/blob/main/support.md + +[npm-install]: https://docs.npmjs.com/cli/install + +[react]: http://reactjs.org + +[section-components]: #appendix-b-components + +[section-plugins]: #plugins + +[section-security]: #security + +[section-syntax]: #syntax + +[typescript]: https://www.typescriptlang.org diff --git a/node_modules/react/LICENSE b/node_modules/react/LICENSE new file mode 100644 index 00000000..b93be905 --- /dev/null +++ b/node_modules/react/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/react/README.md b/node_modules/react/README.md new file mode 100644 index 00000000..20a855ef --- /dev/null +++ b/node_modules/react/README.md @@ -0,0 +1,37 @@ +# `react` + +React is a JavaScript library for creating user interfaces. + +The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments. + +**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application. + +## Usage + +```js +import { useState } from 'react'; +import { createRoot } from 'react-dom/client'; + +function Counter() { + const [count, setCount] = useState(0); + return ( + <> + <h1>{count}</h1> + <button onClick={() => setCount(count + 1)}> + Increment + </button> + </> + ); +} + +const root = createRoot(document.getElementById('root')); +root.render(<Counter />); +``` + +## Documentation + +See https://react.dev/ + +## API + +See https://react.dev/reference/react diff --git a/node_modules/react/cjs/react-compiler-runtime.development.js b/node_modules/react/cjs/react-compiler-runtime.development.js new file mode 100644 index 00000000..84ceaac6 --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.development.js @@ -0,0 +1,24 @@ +/** + * @license React + * react-compiler-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + exports.c = function (size) { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher.useMemoCache(size); + }; + })(); diff --git a/node_modules/react/cjs/react-compiler-runtime.production.js b/node_modules/react/cjs/react-compiler-runtime.production.js new file mode 100644 index 00000000..4d5ade38 --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.production.js @@ -0,0 +1,16 @@ +/** + * @license React + * react-compiler-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +exports.c = function (size) { + return ReactSharedInternals.H.useMemoCache(size); +}; diff --git a/node_modules/react/cjs/react-compiler-runtime.profiling.js b/node_modules/react/cjs/react-compiler-runtime.profiling.js new file mode 100644 index 00000000..9b93257e --- /dev/null +++ b/node_modules/react/cjs/react-compiler-runtime.profiling.js @@ -0,0 +1,16 @@ +/** + * @license React + * react-compiler-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = + require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +exports.c = function (size) { + return ReactSharedInternals.H.useMemoCache(size); +}; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.development.js b/node_modules/react/cjs/react-jsx-dev-runtime.development.js new file mode 100644 index 00000000..95f98774 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.development.js @@ -0,0 +1,338 @@ +/** + * @license React + * react-jsx-dev-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + maybeKey, + getOwner(), + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.production.js b/node_modules/react/cjs/react-jsx-dev-runtime.production.js new file mode 100644 index 00000000..22ad8864 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.production.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-jsx-dev-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsxDEV = void 0; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js b/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js new file mode 100644 index 00000000..f9e8942f --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js @@ -0,0 +1,14 @@ +/** + * @license React + * react-jsx-dev-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsxDEV = void 0; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js new file mode 100644 index 00000000..b79b7589 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js @@ -0,0 +1,370 @@ +/** + * @license React + * react-jsx-dev-runtime.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternalsServer.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + maybeKey, + getOwner(), + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternalsServer = + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + if (!ReactSharedInternalsServer) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); + var hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js new file mode 100644 index 00000000..06641219 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js @@ -0,0 +1,40 @@ +/** + * @license React + * react-jsx-dev-runtime.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxDEV = void 0; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.development.js b/node_modules/react/cjs/react-jsx-runtime.development.js new file mode 100644 index 00000000..35331a3c --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.development.js @@ -0,0 +1,352 @@ +/** + * @license React + * react-jsx-runtime.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + maybeKey, + getOwner(), + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-runtime.production.js b/node_modules/react/cjs/react-jsx-runtime.production.js new file mode 100644 index 00000000..12d60887 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.production.js @@ -0,0 +1,34 @@ +/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.profiling.js b/node_modules/react/cjs/react-jsx-runtime.profiling.js new file mode 100644 index 00000000..68a28d6a --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.profiling.js @@ -0,0 +1,34 @@ +/** + * @license React + * react-jsx-runtime.profiling.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react-jsx-runtime.react-server.development.js b/node_modules/react/cjs/react-jsx-runtime.react-server.development.js new file mode 100644 index 00000000..59ee4be6 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.react-server.development.js @@ -0,0 +1,370 @@ +/** + * @license React + * react-jsx-runtime.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternalsServer.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + debugStack, + debugTask + ) { + var children = config.children; + if (void 0 !== children) + if (isStaticChildren) + if (isArrayImpl(children)) { + for ( + isStaticChildren = 0; + isStaticChildren < children.length; + isStaticChildren++ + ) + validateChildKeys(children[isStaticChildren]); + Object.freeze && Object.freeze(children); + } else + console.error( + "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." + ); + else validateChildKeys(children); + if (hasOwnProperty.call(config, "key")) { + children = getComponentNameFromType(type); + var keys = Object.keys(config).filter(function (k) { + return "key" !== k; + }); + isStaticChildren = + 0 < keys.length + ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" + : "{key: someKey}"; + didWarnAboutKeySpread[children + isStaticChildren] || + ((keys = + 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"), + console.error( + 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', + isStaticChildren, + children, + keys, + children + ), + (didWarnAboutKeySpread[children + isStaticChildren] = !0)); + } + children = null; + void 0 !== maybeKey && + (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey)); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (children = "" + config.key)); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + children && + defineKeyPropWarningGetter( + maybeKey, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + return ReactElement( + type, + children, + maybeKey, + getOwner(), + debugStack, + debugTask + ); + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternalsServer = + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + if (!ReactSharedInternalsServer) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); + var hasOwnProperty = Object.prototype.hasOwnProperty, + isArrayImpl = Array.isArray, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + React = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind( + React, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutKeySpread = {}; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.jsx = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !1, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + isStaticChildren, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.jsxs = function (type, config, maybeKey) { + var trackActualOwner = + 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++; + return jsxDEVImpl( + type, + config, + maybeKey, + !0, + trackActualOwner + ? Error("react-stack-top-frame") + : unknownOwnerDebugStack, + trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + })(); diff --git a/node_modules/react/cjs/react-jsx-runtime.react-server.production.js b/node_modules/react/cjs/react-jsx-runtime.react-server.production.js new file mode 100644 index 00000000..486facb5 --- /dev/null +++ b/node_modules/react/cjs/react-jsx-runtime.react-server.production.js @@ -0,0 +1,40 @@ +/** + * @license React + * react-jsx-runtime.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var React = require("react"), + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) + throw Error( + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.' + ); +function jsxProd(type, config, maybeKey) { + var key = null; + void 0 !== maybeKey && (key = "" + maybeKey); + void 0 !== config.key && (key = "" + config.key); + if ("key" in config) { + maybeKey = {}; + for (var propName in config) + "key" !== propName && (maybeKey[propName] = config[propName]); + } else maybeKey = config; + config = maybeKey.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== config ? config : null, + props: maybeKey + }; +} +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsxProd; +exports.jsxDEV = void 0; +exports.jsxs = jsxProd; diff --git a/node_modules/react/cjs/react.development.js b/node_modules/react/cjs/react.development.js new file mode 100644 index 00000000..d640ac01 --- /dev/null +++ b/node_modules/react/cjs/react.development.js @@ -0,0 +1,1284 @@ +/** + * @license React + * react.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function defineDeprecationWarning(methodName, info) { + Object.defineProperty(Component.prototype, methodName, { + get: function () { + console.warn( + "%s(...) is deprecated in plain JavaScript React classes. %s", + info[0], + info[1] + ); + } + }); + } + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function warnNoop(publicInstance, callerName) { + publicInstance = + ((publicInstance = publicInstance.constructor) && + (publicInstance.displayName || publicInstance.name)) || + "ReactClass"; + var warningKey = publicInstance + "." + callerName; + didWarnStateUpdateForUnmountedComponent[warningKey] || + (console.error( + "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", + callerName, + publicInstance + ), + (didWarnStateUpdateForUnmountedComponent[warningKey] = !0)); + } + function Component(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + function ComponentDummy() {} + function PureComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + function noop() {} + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function cloneAndReplaceKey(oldElement, newKey) { + newKey = ReactElement( + oldElement.type, + newKey, + oldElement.props, + oldElement._owner, + oldElement._debugStack, + oldElement._debugTask + ); + oldElement._store && + (newKey._store.validated = oldElement._store.validated); + return newKey; + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); + } + function getElementKey(element, index) { + return "object" === typeof element && + null !== element && + null != element.key + ? (checkKeyStringCoercion(element.key), escape("" + element.key)) + : index.toString(36); + } + function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), + (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; + } + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) { + invokeCallback = children; + callback = callback(invokeCallback); + var childKey = + "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar; + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != childKey && + (escapedPrefix = + childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (null != callback.key && + ((invokeCallback && invokeCallback.key === callback.key) || + checkKeyStringCoercion(callback.key)), + (escapedPrefix = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (invokeCallback && invokeCallback.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + childKey + )), + "" !== nameSoFar && + null != invokeCallback && + isValidElement(invokeCallback) && + null == invokeCallback.key && + invokeCallback._store && + !invokeCallback._store.validated && + (escapedPrefix._store.validated = 2), + (callback = escapedPrefix)), + array.push(callback)); + return 1; + } + invokeCallback = 0; + childKey = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = childKey + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + i === children.entries && + (didWarnAboutMaps || + console.warn( + "Using Maps as children is not supported. Use an array of keyed ReactElements instead." + ), + (didWarnAboutMaps = !0)), + children = i.call(children), + i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = childKey + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; + } + function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; + } + function lazyInitializer(payload) { + if (-1 === payload._status) { + var ioInfo = payload._ioInfo; + null != ioInfo && (ioInfo.start = ioInfo.end = performance.now()); + ioInfo = payload._result; + var thenable = ioInfo(); + thenable.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) { + payload._status = 1; + payload._result = moduleObject; + var _ioInfo = payload._ioInfo; + null != _ioInfo && (_ioInfo.end = performance.now()); + void 0 === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = moduleObject)); + } + }, + function (error) { + if (0 === payload._status || -1 === payload._status) { + payload._status = 2; + payload._result = error; + var _ioInfo2 = payload._ioInfo; + null != _ioInfo2 && (_ioInfo2.end = performance.now()); + void 0 === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + } + ); + ioInfo = payload._ioInfo; + if (null != ioInfo) { + ioInfo.value = thenable; + var displayName = thenable.displayName; + "string" === typeof displayName && (ioInfo.name = displayName); + } + -1 === payload._status && + ((payload._status = 0), (payload._result = thenable)); + } + if (1 === payload._status) + return ( + (ioInfo = payload._result), + void 0 === ioInfo && + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", + ioInfo + ), + "default" in ioInfo || + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", + ioInfo + ), + ioInfo.default + ); + throw payload._result; + } + function resolveDispatcher() { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher; + } + function releaseAsyncTransition() { + ReactSharedInternals.asyncTransitions--; + } + function enqueueTask(task) { + if (null === enqueueTaskImpl) + try { + var requireString = ("require" + Math.random()).slice(0, 7); + enqueueTaskImpl = (module && module[requireString]).call( + module, + "timers" + ).setImmediate; + } catch (_err) { + enqueueTaskImpl = function (callback) { + !1 === didWarnAboutMessageChannel && + ((didWarnAboutMessageChannel = !0), + "undefined" === typeof MessageChannel && + console.error( + "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning." + )); + var channel = new MessageChannel(); + channel.port1.onmessage = callback; + channel.port2.postMessage(void 0); + }; + } + return enqueueTaskImpl(task); + } + function aggregateErrors(errors) { + return 1 < errors.length && "function" === typeof AggregateError + ? new AggregateError(errors) + : errors[0]; + } + function popActScope(prevActQueue, prevActScopeDepth) { + prevActScopeDepth !== actScopeDepth - 1 && + console.error( + "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. " + ); + actScopeDepth = prevActScopeDepth; + } + function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { + var queue = ReactSharedInternals.actQueue; + if (null !== queue) + if (0 !== queue.length) + try { + flushActQueue(queue); + enqueueTask(function () { + return recursivelyFlushAsyncActWork(returnValue, resolve, reject); + }); + return; + } catch (error) { + ReactSharedInternals.thrownErrors.push(error); + } + else ReactSharedInternals.actQueue = null; + 0 < ReactSharedInternals.thrownErrors.length + ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + reject(queue)) + : resolve(returnValue); + } + function flushActQueue(queue) { + if (!isFlushing) { + isFlushing = !0; + var i = 0; + try { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + ReactSharedInternals.didUsePromise = !1; + var continuation = callback(!1); + if (null !== continuation) { + if (ReactSharedInternals.didUsePromise) { + queue[i] = callback; + queue.splice(0, i); + return; + } + callback = continuation; + } else break; + } while (1); + } + queue.length = 0; + } catch (error) { + queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error); + } finally { + isFlushing = !1; + } + } + } + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && + "function" === + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); + var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + didWarnStateUpdateForUnmountedComponent = {}, + ReactNoopUpdateQueue = { + isMounted: function () { + return !1; + }, + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, "forceUpdate"); + }, + enqueueReplaceState: function (publicInstance) { + warnNoop(publicInstance, "replaceState"); + }, + enqueueSetState: function (publicInstance) { + warnNoop(publicInstance, "setState"); + } + }, + assign = Object.assign, + emptyObject = {}; + Object.freeze(emptyObject); + Component.prototype.isReactComponent = {}; + Component.prototype.setState = function (partialState, callback) { + if ( + "object" !== typeof partialState && + "function" !== typeof partialState && + null != partialState + ) + throw Error( + "takes an object of state variables to update or a function which returns an object of state variables." + ); + this.updater.enqueueSetState(this, partialState, callback, "setState"); + }; + Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); + }; + var deprecatedAPIs = { + isMounted: [ + "isMounted", + "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks." + ], + replaceState: [ + "replaceState", + "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)." + ] + }; + for (fnName in deprecatedAPIs) + deprecatedAPIs.hasOwnProperty(fnName) && + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + ComponentDummy.prototype = Component.prototype; + deprecatedAPIs = PureComponent.prototype = new ComponentDummy(); + deprecatedAPIs.constructor = PureComponent; + assign(deprecatedAPIs, Component.prototype); + deprecatedAPIs.isPureReactComponent = !0; + var isArrayImpl = Array.isArray, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + ReactSharedInternals = { + H: null, + A: null, + T: null, + S: null, + actQueue: null, + asyncTransitions: 0, + isBatchingLegacy: !1, + didScheduleLegacyUpdate: !1, + didUsePromise: !1, + thrownErrors: [], + getCurrentStack: null, + recentlyCreatedOwnerStacks: 0 + }, + hasOwnProperty = Object.prototype.hasOwnProperty, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }; + deprecatedAPIs = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }; + var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind( + deprecatedAPIs, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutMaps = !1, + userProvidedKeyEscapeRegex = /\/+/g, + reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }, + didWarnAboutMessageChannel = !1, + enqueueTaskImpl = null, + actScopeDepth = 0, + didWarnNoAwaitAct = !1, + isFlushing = !1, + queueSeveralMicrotasks = + "function" === typeof queueMicrotask + ? function (callback) { + queueMicrotask(function () { + return queueMicrotask(callback); + }); + } + : enqueueTask; + deprecatedAPIs = Object.freeze({ + __proto__: null, + c: function (size) { + return resolveDispatcher().useMemoCache(size); + } + }); + var fnName = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } + }; + exports.Activity = REACT_ACTIVITY_TYPE; + exports.Children = fnName; + exports.Component = Component; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.PureComponent = PureComponent; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; + exports.__COMPILER_RUNTIME = deprecatedAPIs; + exports.act = function (callback) { + var prevActQueue = ReactSharedInternals.actQueue, + prevActScopeDepth = actScopeDepth; + actScopeDepth++; + var queue = (ReactSharedInternals.actQueue = + null !== prevActQueue ? prevActQueue : []), + didAwaitActCall = !1; + try { + var result = callback(); + } catch (error) { + ReactSharedInternals.thrownErrors.push(error); + } + if (0 < ReactSharedInternals.thrownErrors.length) + throw ( + (popActScope(prevActQueue, prevActScopeDepth), + (callback = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + callback) + ); + if ( + null !== result && + "object" === typeof result && + "function" === typeof result.then + ) { + var thenable = result; + queueSeveralMicrotasks(function () { + didAwaitActCall || + didWarnNoAwaitAct || + ((didWarnNoAwaitAct = !0), + console.error( + "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);" + )); + }); + return { + then: function (resolve, reject) { + didAwaitActCall = !0; + thenable.then( + function (returnValue) { + popActScope(prevActQueue, prevActScopeDepth); + if (0 === prevActScopeDepth) { + try { + flushActQueue(queue), + enqueueTask(function () { + return recursivelyFlushAsyncActWork( + returnValue, + resolve, + reject + ); + }); + } catch (error$0) { + ReactSharedInternals.thrownErrors.push(error$0); + } + if (0 < ReactSharedInternals.thrownErrors.length) { + var _thrownError = aggregateErrors( + ReactSharedInternals.thrownErrors + ); + ReactSharedInternals.thrownErrors.length = 0; + reject(_thrownError); + } + } else resolve(returnValue); + }, + function (error) { + popActScope(prevActQueue, prevActScopeDepth); + 0 < ReactSharedInternals.thrownErrors.length + ? ((error = aggregateErrors( + ReactSharedInternals.thrownErrors + )), + (ReactSharedInternals.thrownErrors.length = 0), + reject(error)) + : reject(error); + } + ); + } + }; + } + var returnValue$jscomp$0 = result; + popActScope(prevActQueue, prevActScopeDepth); + 0 === prevActScopeDepth && + (flushActQueue(queue), + 0 !== queue.length && + queueSeveralMicrotasks(function () { + didAwaitActCall || + didWarnNoAwaitAct || + ((didWarnNoAwaitAct = !0), + console.error( + "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)" + )); + }), + (ReactSharedInternals.actQueue = null)); + if (0 < ReactSharedInternals.thrownErrors.length) + throw ( + ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)), + (ReactSharedInternals.thrownErrors.length = 0), + callback) + ); + return { + then: function (resolve, reject) { + didAwaitActCall = !0; + 0 === prevActScopeDepth + ? ((ReactSharedInternals.actQueue = queue), + enqueueTask(function () { + return recursivelyFlushAsyncActWork( + returnValue$jscomp$0, + resolve, + reject + ); + })) + : resolve(returnValue$jscomp$0); + } + }; + }; + exports.cache = function (fn) { + return function () { + return fn.apply(null, arguments); + }; + }; + exports.cacheSignal = function () { + return null; + }; + exports.captureOwnerStack = function () { + var getCurrentStack = ReactSharedInternals.getCurrentStack; + return null === getCurrentStack ? null : getCurrentStack(); + }; + exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + + element + + "." + ); + var props = assign({}, element.props), + key = element.key, + owner = element._owner; + if (null != config) { + var JSCompiler_inline_result; + a: { + if ( + hasOwnProperty.call(config, "ref") && + (JSCompiler_inline_result = Object.getOwnPropertyDescriptor( + config, + "ref" + ).get) && + JSCompiler_inline_result.isReactWarning + ) { + JSCompiler_inline_result = !1; + break a; + } + JSCompiler_inline_result = void 0 !== config.ref; + } + JSCompiler_inline_result && (owner = getOwner()); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)); + for (propName in config) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + } + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + JSCompiler_inline_result = Array(propName); + for (var i = 0; i < propName; i++) + JSCompiler_inline_result[i] = arguments[i + 2]; + props.children = JSCompiler_inline_result; + } + props = ReactElement( + element.type, + key, + props, + owner, + element._debugStack, + element._debugTask + ); + for (key = 2; key < arguments.length; key++) + validateChildKeys(arguments[key]); + return props; + }; + exports.createContext = function (defaultValue) { + defaultValue = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: defaultValue, + _currentValue2: defaultValue, + _threadCount: 0, + Provider: null, + Consumer: null + }; + defaultValue.Provider = defaultValue; + defaultValue.Consumer = { + $$typeof: REACT_CONSUMER_TYPE, + _context: defaultValue + }; + defaultValue._currentRenderer = null; + defaultValue._currentRenderer2 = null; + return defaultValue; + }; + exports.createElement = function (type, config, children) { + for (var i = 2; i < arguments.length; i++) + validateChildKeys(arguments[i]); + i = {}; + var key = null; + if (null != config) + for (propName in (didWarnAboutOldJSXRuntime || + !("__self" in config) || + "key" in config || + ((didWarnAboutOldJSXRuntime = !0), + console.warn( + "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform" + )), + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)), + config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (i[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) i.children = children; + else if (1 < childrenLength) { + for ( + var childArray = Array(childrenLength), _i = 0; + _i < childrenLength; + _i++ + ) + childArray[_i] = arguments[_i + 2]; + Object.freeze && Object.freeze(childArray); + i.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === i[propName] && (i[propName] = childrenLength[propName]); + key && + defineKeyPropWarningGetter( + i, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return ReactElement( + type, + key, + i, + getOwner(), + propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, + propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.createRef = function () { + var refObject = { current: null }; + Object.seal(refObject); + return refObject; + }; + exports.forwardRef = function (render) { + null != render && render.$$typeof === REACT_MEMO_TYPE + ? console.error( + "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." + ) + : "function" !== typeof render + ? console.error( + "forwardRef requires a render function but was given %s.", + null === render ? "null" : typeof render + ) + : 0 !== render.length && + 2 !== render.length && + console.error( + "forwardRef render functions accept exactly two parameters: props and ref. %s", + 1 === render.length + ? "Did you forget to use the ref parameter?" + : "Any additional parameter will be undefined." + ); + null != render && + null != render.defaultProps && + console.error( + "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?" + ); + var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }, + ownName; + Object.defineProperty(elementType, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + render.name || + render.displayName || + (Object.defineProperty(render, "name", { value: name }), + (render.displayName = name)); + } + }); + return elementType; + }; + exports.isValidElement = isValidElement; + exports.lazy = function (ctor) { + ctor = { _status: -1, _result: ctor }; + var lazyType = { + $$typeof: REACT_LAZY_TYPE, + _payload: ctor, + _init: lazyInitializer + }, + ioInfo = { + name: "lazy", + start: -1, + end: -1, + value: null, + owner: null, + debugStack: Error("react-stack-top-frame"), + debugTask: console.createTask ? console.createTask("lazy()") : null + }; + ctor._ioInfo = ioInfo; + lazyType._debugInfo = [{ awaited: ioInfo }]; + return lazyType; + }; + exports.memo = function (type, compare) { + null == type && + console.error( + "memo: The first argument must be a component. Instead received: %s", + null === type ? "null" : typeof type + ); + compare = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; + var ownName; + Object.defineProperty(compare, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + type.name || + type.displayName || + (Object.defineProperty(type, "name", { value: name }), + (type.displayName = name)); + } + }); + return compare; + }; + exports.startTransition = function (scope) { + var prevTransition = ReactSharedInternals.T, + currentTransition = {}; + currentTransition._updatedFibers = new Set(); + ReactSharedInternals.T = currentTransition; + try { + var returnValue = scope(), + onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && + onStartTransitionFinish(currentTransition, returnValue); + "object" === typeof returnValue && + null !== returnValue && + "function" === typeof returnValue.then && + (ReactSharedInternals.asyncTransitions++, + returnValue.then(releaseAsyncTransition, releaseAsyncTransition), + returnValue.then(noop, reportGlobalError)); + } catch (error) { + reportGlobalError(error); + } finally { + null === prevTransition && + currentTransition._updatedFibers && + ((scope = currentTransition._updatedFibers.size), + currentTransition._updatedFibers.clear(), + 10 < scope && + console.warn( + "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table." + )), + null !== prevTransition && + null !== currentTransition.types && + (null !== prevTransition.types && + prevTransition.types !== currentTransition.types && + console.error( + "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React." + ), + (prevTransition.types = currentTransition.types)), + (ReactSharedInternals.T = prevTransition); + } + }; + exports.unstable_useCacheRefresh = function () { + return resolveDispatcher().useCacheRefresh(); + }; + exports.use = function (usable) { + return resolveDispatcher().use(usable); + }; + exports.useActionState = function (action, initialState, permalink) { + return resolveDispatcher().useActionState( + action, + initialState, + permalink + ); + }; + exports.useCallback = function (callback, deps) { + return resolveDispatcher().useCallback(callback, deps); + }; + exports.useContext = function (Context) { + var dispatcher = resolveDispatcher(); + Context.$$typeof === REACT_CONSUMER_TYPE && + console.error( + "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?" + ); + return dispatcher.useContext(Context); + }; + exports.useDebugValue = function (value, formatterFn) { + return resolveDispatcher().useDebugValue(value, formatterFn); + }; + exports.useDeferredValue = function (value, initialValue) { + return resolveDispatcher().useDeferredValue(value, initialValue); + }; + exports.useEffect = function (create, deps) { + null == create && + console.warn( + "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + return resolveDispatcher().useEffect(create, deps); + }; + exports.useEffectEvent = function (callback) { + return resolveDispatcher().useEffectEvent(callback); + }; + exports.useId = function () { + return resolveDispatcher().useId(); + }; + exports.useImperativeHandle = function (ref, create, deps) { + return resolveDispatcher().useImperativeHandle(ref, create, deps); + }; + exports.useInsertionEffect = function (create, deps) { + null == create && + console.warn( + "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + return resolveDispatcher().useInsertionEffect(create, deps); + }; + exports.useLayoutEffect = function (create, deps) { + null == create && + console.warn( + "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?" + ); + return resolveDispatcher().useLayoutEffect(create, deps); + }; + exports.useMemo = function (create, deps) { + return resolveDispatcher().useMemo(create, deps); + }; + exports.useOptimistic = function (passthrough, reducer) { + return resolveDispatcher().useOptimistic(passthrough, reducer); + }; + exports.useReducer = function (reducer, initialArg, init) { + return resolveDispatcher().useReducer(reducer, initialArg, init); + }; + exports.useRef = function (initialValue) { + return resolveDispatcher().useRef(initialValue); + }; + exports.useState = function (initialState) { + return resolveDispatcher().useState(initialState); + }; + exports.useSyncExternalStore = function ( + subscribe, + getSnapshot, + getServerSnapshot + ) { + return resolveDispatcher().useSyncExternalStore( + subscribe, + getSnapshot, + getServerSnapshot + ); + }; + exports.useTransition = function () { + return resolveDispatcher().useTransition(); + }; + exports.version = "19.2.3"; + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && + "function" === + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); + })(); diff --git a/node_modules/react/cjs/react.production.js b/node_modules/react/cjs/react.production.js new file mode 100644 index 00000000..d3817b32 --- /dev/null +++ b/node_modules/react/cjs/react.production.js @@ -0,0 +1,542 @@ +/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +var ReactNoopUpdateQueue = { + isMounted: function () { + return !1; + }, + enqueueForceUpdate: function () {}, + enqueueReplaceState: function () {}, + enqueueSetState: function () {} + }, + assign = Object.assign, + emptyObject = {}; +function Component(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; +} +Component.prototype.isReactComponent = {}; +Component.prototype.setState = function (partialState, callback) { + if ( + "object" !== typeof partialState && + "function" !== typeof partialState && + null != partialState + ) + throw Error( + "takes an object of state variables to update or a function which returns an object of state variables." + ); + this.updater.enqueueSetState(this, partialState, callback, "setState"); +}; +Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); +}; +function ComponentDummy() {} +ComponentDummy.prototype = Component.prototype; +function PureComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; +} +var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy()); +pureComponentPrototype.constructor = PureComponent; +assign(pureComponentPrototype, Component.prototype); +pureComponentPrototype.isPureReactComponent = !0; +var isArrayImpl = Array.isArray; +function noop() {} +var ReactSharedInternals = { H: null, A: null, T: null, S: null }, + hasOwnProperty = Object.prototype.hasOwnProperty; +function ReactElement(type, key, props) { + var refProp = props.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== refProp ? refProp : null, + props: props + }; +} +function cloneAndReplaceKey(oldElement, newKey) { + return ReactElement(oldElement.type, newKey, oldElement.props); +} +function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); +} +function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); +} +var userProvidedKeyEscapeRegex = /\/+/g; +function getElementKey(element, index) { + return "object" === typeof element && null !== element && null != element.key + ? escape("" + element.key) + : index.toString(36); +} +function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; +} +function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) + return ( + (callback = callback(children)), + (invokeCallback = + "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar), + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != invokeCallback && + (escapedPrefix = + invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (callback = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (children && children.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + invokeCallback + )), + array.push(callback)), + 1 + ); + invokeCallback = 0; + var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = nextNamePrefix + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + children = i.call(children), i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = nextNamePrefix + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; +} +function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; +} +function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) return payload._result.default; + throw payload._result; +} +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }, + Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } + }; +exports.Activity = REACT_ACTIVITY_TYPE; +exports.Children = Children; +exports.Component = Component; +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.Profiler = REACT_PROFILER_TYPE; +exports.PureComponent = PureComponent; +exports.StrictMode = REACT_STRICT_MODE_TYPE; +exports.Suspense = REACT_SUSPENSE_TYPE; +exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; +exports.__COMPILER_RUNTIME = { + __proto__: null, + c: function (size) { + return ReactSharedInternals.H.useMemoCache(size); + } +}; +exports.cache = function (fn) { + return function () { + return fn.apply(null, arguments); + }; +}; +exports.cacheSignal = function () { + return null; +}; +exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + element + "." + ); + var props = assign({}, element.props), + key = element.key; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + for (var childArray = Array(propName), i = 0; i < propName; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + return ReactElement(element.type, key, props); +}; +exports.createContext = function (defaultValue) { + defaultValue = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: defaultValue, + _currentValue2: defaultValue, + _threadCount: 0, + Provider: null, + Consumer: null + }; + defaultValue.Provider = defaultValue; + defaultValue.Consumer = { + $$typeof: REACT_CONSUMER_TYPE, + _context: defaultValue + }; + return defaultValue; +}; +exports.createElement = function (type, config, children) { + var propName, + props = {}, + key = null; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (props[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) props.children = children; + else if (1 < childrenLength) { + for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === props[propName] && + (props[propName] = childrenLength[propName]); + return ReactElement(type, key, props); +}; +exports.createRef = function () { + return { current: null }; +}; +exports.forwardRef = function (render) { + return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; +}; +exports.isValidElement = isValidElement; +exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; +}; +exports.memo = function (type, compare) { + return { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; +}; +exports.startTransition = function (scope) { + var prevTransition = ReactSharedInternals.T, + currentTransition = {}; + ReactSharedInternals.T = currentTransition; + try { + var returnValue = scope(), + onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && + onStartTransitionFinish(currentTransition, returnValue); + "object" === typeof returnValue && + null !== returnValue && + "function" === typeof returnValue.then && + returnValue.then(noop, reportGlobalError); + } catch (error) { + reportGlobalError(error); + } finally { + null !== prevTransition && + null !== currentTransition.types && + (prevTransition.types = currentTransition.types), + (ReactSharedInternals.T = prevTransition); + } +}; +exports.unstable_useCacheRefresh = function () { + return ReactSharedInternals.H.useCacheRefresh(); +}; +exports.use = function (usable) { + return ReactSharedInternals.H.use(usable); +}; +exports.useActionState = function (action, initialState, permalink) { + return ReactSharedInternals.H.useActionState(action, initialState, permalink); +}; +exports.useCallback = function (callback, deps) { + return ReactSharedInternals.H.useCallback(callback, deps); +}; +exports.useContext = function (Context) { + return ReactSharedInternals.H.useContext(Context); +}; +exports.useDebugValue = function () {}; +exports.useDeferredValue = function (value, initialValue) { + return ReactSharedInternals.H.useDeferredValue(value, initialValue); +}; +exports.useEffect = function (create, deps) { + return ReactSharedInternals.H.useEffect(create, deps); +}; +exports.useEffectEvent = function (callback) { + return ReactSharedInternals.H.useEffectEvent(callback); +}; +exports.useId = function () { + return ReactSharedInternals.H.useId(); +}; +exports.useImperativeHandle = function (ref, create, deps) { + return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); +}; +exports.useInsertionEffect = function (create, deps) { + return ReactSharedInternals.H.useInsertionEffect(create, deps); +}; +exports.useLayoutEffect = function (create, deps) { + return ReactSharedInternals.H.useLayoutEffect(create, deps); +}; +exports.useMemo = function (create, deps) { + return ReactSharedInternals.H.useMemo(create, deps); +}; +exports.useOptimistic = function (passthrough, reducer) { + return ReactSharedInternals.H.useOptimistic(passthrough, reducer); +}; +exports.useReducer = function (reducer, initialArg, init) { + return ReactSharedInternals.H.useReducer(reducer, initialArg, init); +}; +exports.useRef = function (initialValue) { + return ReactSharedInternals.H.useRef(initialValue); +}; +exports.useState = function (initialState) { + return ReactSharedInternals.H.useState(initialState); +}; +exports.useSyncExternalStore = function ( + subscribe, + getSnapshot, + getServerSnapshot +) { + return ReactSharedInternals.H.useSyncExternalStore( + subscribe, + getSnapshot, + getServerSnapshot + ); +}; +exports.useTransition = function () { + return ReactSharedInternals.H.useTransition(); +}; +exports.version = "19.2.3"; diff --git a/node_modules/react/cjs/react.react-server.development.js b/node_modules/react/cjs/react.react-server.development.js new file mode 100644 index 00000000..2d458b2d --- /dev/null +++ b/node_modules/react/cjs/react.react-server.development.js @@ -0,0 +1,848 @@ +/** + * @license React + * react.react-server.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function noop() {} + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function testStringCoercion(value) { + return "" + value; + } + function checkKeyStringCoercion(value) { + try { + testStringCoercion(value); + var JSCompiler_inline_result = !1; + } catch (e) { + JSCompiler_inline_result = !0; + } + if (JSCompiler_inline_result) { + JSCompiler_inline_result = console; + var JSCompiler_temp_const = JSCompiler_inline_result.error; + var JSCompiler_inline_result$jscomp$0 = + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + JSCompiler_temp_const.call( + JSCompiler_inline_result, + "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", + JSCompiler_inline_result$jscomp$0 + ); + return testStringCoercion(value); + } + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function getTaskName(type) { + if (type === REACT_FRAGMENT_TYPE) return "<>"; + if ( + "object" === typeof type && + null !== type && + type.$$typeof === REACT_LAZY_TYPE + ) + return "<...>"; + try { + var name = getComponentNameFromType(type); + return name ? "<" + name + ">" : "<...>"; + } catch (x) { + return "<...>"; + } + } + function getOwner() { + var dispatcher = ReactSharedInternals.A; + return null === dispatcher ? null : dispatcher.getOwner(); + } + function UnknownOwner() { + return Error("react-stack-top-frame"); + } + function hasValidKey(config) { + if (hasOwnProperty.call(config, "key")) { + var getter = Object.getOwnPropertyDescriptor(config, "key").get; + if (getter && getter.isReactWarning) return !1; + } + return void 0 !== config.key; + } + function defineKeyPropWarningGetter(props, displayName) { + function warnAboutAccessingKey() { + specialPropKeyWarningShown || + ((specialPropKeyWarningShown = !0), + console.error( + "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", + displayName + )); + } + warnAboutAccessingKey.isReactWarning = !0; + Object.defineProperty(props, "key", { + get: warnAboutAccessingKey, + configurable: !0 + }); + } + function elementRefGetterWithDeprecationWarning() { + var componentName = getComponentNameFromType(this.type); + didWarnAboutElementRef[componentName] || + ((didWarnAboutElementRef[componentName] = !0), + console.error( + "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." + )); + componentName = this.props.ref; + return void 0 !== componentName ? componentName : null; + } + function ReactElement(type, key, props, owner, debugStack, debugTask) { + var refProp = props.ref; + type = { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + props: props, + _owner: owner + }; + null !== (void 0 !== refProp ? refProp : null) + ? Object.defineProperty(type, "ref", { + enumerable: !1, + get: elementRefGetterWithDeprecationWarning + }) + : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); + type._store = {}; + Object.defineProperty(type._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 0 + }); + Object.defineProperty(type, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }); + Object.defineProperty(type, "_debugStack", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugStack + }); + Object.defineProperty(type, "_debugTask", { + configurable: !1, + enumerable: !1, + writable: !0, + value: debugTask + }); + Object.freeze && (Object.freeze(type.props), Object.freeze(type)); + return type; + } + function cloneAndReplaceKey(oldElement, newKey) { + newKey = ReactElement( + oldElement.type, + newKey, + oldElement.props, + oldElement._owner, + oldElement._debugStack, + oldElement._debugTask + ); + oldElement._store && + (newKey._store.validated = oldElement._store.validated); + return newKey; + } + function validateChildKeys(node) { + isValidElement(node) + ? node._store && (node._store.validated = 1) + : "object" === typeof node && + null !== node && + node.$$typeof === REACT_LAZY_TYPE && + ("fulfilled" === node._payload.status + ? isValidElement(node._payload.value) && + node._payload.value._store && + (node._payload.value._store.validated = 1) + : node._store && (node._store.validated = 1)); + } + function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); + } + function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); + } + function getElementKey(element, index) { + return "object" === typeof element && + null !== element && + null != element.key + ? (checkKeyStringCoercion(element.key), escape("" + element.key)) + : index.toString(36); + } + function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), + (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; + } + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) { + invokeCallback = children; + callback = callback(invokeCallback); + var childKey = + "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar; + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != childKey && + (escapedPrefix = + childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (null != callback.key && + ((invokeCallback && invokeCallback.key === callback.key) || + checkKeyStringCoercion(callback.key)), + (escapedPrefix = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (invokeCallback && invokeCallback.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + childKey + )), + "" !== nameSoFar && + null != invokeCallback && + isValidElement(invokeCallback) && + null == invokeCallback.key && + invokeCallback._store && + !invokeCallback._store.validated && + (escapedPrefix._store.validated = 2), + (callback = escapedPrefix)), + array.push(callback)); + return 1; + } + invokeCallback = 0; + childKey = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = childKey + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + i === children.entries && + (didWarnAboutMaps || + console.warn( + "Using Maps as children is not supported. Use an array of keyed ReactElements instead." + ), + (didWarnAboutMaps = !0)), + children = i.call(children), + i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = childKey + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array) + + "). If you meant to render a collection of children, use an array instead." + ); + } + return invokeCallback; + } + function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; + } + function resolveDispatcher() { + var dispatcher = ReactSharedInternals.H; + null === dispatcher && + console.error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem." + ); + return dispatcher; + } + function lazyInitializer(payload) { + if (-1 === payload._status) { + var ioInfo = payload._ioInfo; + null != ioInfo && (ioInfo.start = ioInfo.end = performance.now()); + ioInfo = payload._result; + var thenable = ioInfo(); + thenable.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) { + payload._status = 1; + payload._result = moduleObject; + var _ioInfo = payload._ioInfo; + null != _ioInfo && (_ioInfo.end = performance.now()); + void 0 === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = moduleObject)); + } + }, + function (error) { + if (0 === payload._status || -1 === payload._status) { + payload._status = 2; + payload._result = error; + var _ioInfo2 = payload._ioInfo; + null != _ioInfo2 && (_ioInfo2.end = performance.now()); + void 0 === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + } + ); + ioInfo = payload._ioInfo; + if (null != ioInfo) { + ioInfo.value = thenable; + var displayName = thenable.displayName; + "string" === typeof displayName && (ioInfo.name = displayName); + } + -1 === payload._status && + ((payload._status = 0), (payload._result = thenable)); + } + if (1 === payload._status) + return ( + (ioInfo = payload._result), + void 0 === ioInfo && + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", + ioInfo + ), + "default" in ioInfo || + console.error( + "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", + ioInfo + ), + ioInfo.default + ); + throw payload._result; + } + function createCacheRoot() { + return new WeakMap(); + } + function createCacheNode() { + return { s: 0, v: void 0, o: null, p: null }; + } + var ReactSharedInternals = { + H: null, + A: null, + getCurrentStack: null, + recentlyCreatedOwnerStacks: 0 + }, + isArrayImpl = Array.isArray, + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), + hasOwnProperty = Object.prototype.hasOwnProperty, + assign = Object.assign, + createTask = console.createTask + ? console.createTask + : function () { + return null; + }, + createFakeCallStack = { + react_stack_bottom_frame: function (callStackForError) { + return callStackForError(); + } + }, + specialPropKeyWarningShown, + didWarnAboutOldJSXRuntime; + var didWarnAboutElementRef = {}; + var unknownOwnerDebugStack = + createFakeCallStack.react_stack_bottom_frame.bind( + createFakeCallStack, + UnknownOwner + )(); + var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); + var didWarnAboutMaps = !1, + userProvidedKeyEscapeRegex = /\/+/g; + exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) + throw Error( + "React.Children.only expected to receive a single React element child." + ); + return children; + } + }; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; + exports.cache = function (fn) { + return function () { + var dispatcher = ReactSharedInternals.A; + if (!dispatcher) return fn.apply(null, arguments); + var fnMap = dispatcher.getCacheForType(createCacheRoot); + dispatcher = fnMap.get(fn); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher)); + fnMap = 0; + for (var l = arguments.length; fnMap < l; fnMap++) { + var arg = arguments[fnMap]; + if ( + "function" === typeof arg || + ("object" === typeof arg && null !== arg) + ) { + var objectCache = dispatcher.o; + null === objectCache && + (dispatcher.o = objectCache = new WeakMap()); + dispatcher = objectCache.get(arg); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } else + (objectCache = dispatcher.p), + null === objectCache && (dispatcher.p = objectCache = new Map()), + (dispatcher = objectCache.get(arg)), + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } + if (1 === dispatcher.s) return dispatcher.v; + if (2 === dispatcher.s) throw dispatcher.v; + try { + var result = fn.apply(null, arguments); + fnMap = dispatcher; + fnMap.s = 1; + return (fnMap.v = result); + } catch (error) { + throw ( + ((result = dispatcher), (result.s = 2), (result.v = error), error) + ); + } + }; + }; + exports.cacheSignal = function () { + var dispatcher = ReactSharedInternals.A; + return dispatcher ? dispatcher.cacheSignal() : null; + }; + exports.captureOwnerStack = function () { + var getCurrentStack = ReactSharedInternals.getCurrentStack; + return null === getCurrentStack ? null : getCurrentStack(); + }; + exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error( + "The argument must be a React element, but you passed " + + element + + "." + ); + var props = assign({}, element.props), + key = element.key, + owner = element._owner; + if (null != config) { + var JSCompiler_inline_result; + a: { + if ( + hasOwnProperty.call(config, "ref") && + (JSCompiler_inline_result = Object.getOwnPropertyDescriptor( + config, + "ref" + ).get) && + JSCompiler_inline_result.isReactWarning + ) { + JSCompiler_inline_result = !1; + break a; + } + JSCompiler_inline_result = void 0 !== config.ref; + } + JSCompiler_inline_result && (owner = getOwner()); + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)); + for (propName in config) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + } + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + JSCompiler_inline_result = Array(propName); + for (var i = 0; i < propName; i++) + JSCompiler_inline_result[i] = arguments[i + 2]; + props.children = JSCompiler_inline_result; + } + props = ReactElement( + element.type, + key, + props, + owner, + element._debugStack, + element._debugTask + ); + for (key = 2; key < arguments.length; key++) + validateChildKeys(arguments[key]); + return props; + }; + exports.createElement = function (type, config, children) { + for (var i = 2; i < arguments.length; i++) + validateChildKeys(arguments[i]); + i = {}; + var key = null; + if (null != config) + for (propName in (didWarnAboutOldJSXRuntime || + !("__self" in config) || + "key" in config || + ((didWarnAboutOldJSXRuntime = !0), + console.warn( + "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform" + )), + hasValidKey(config) && + (checkKeyStringCoercion(config.key), (key = "" + config.key)), + config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (i[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) i.children = children; + else if (1 < childrenLength) { + for ( + var childArray = Array(childrenLength), _i = 0; + _i < childrenLength; + _i++ + ) + childArray[_i] = arguments[_i + 2]; + Object.freeze && Object.freeze(childArray); + i.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === i[propName] && (i[propName] = childrenLength[propName]); + key && + defineKeyPropWarningGetter( + i, + "function" === typeof type + ? type.displayName || type.name || "Unknown" + : type + ); + var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; + return ReactElement( + type, + key, + i, + getOwner(), + propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, + propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask + ); + }; + exports.createRef = function () { + var refObject = { current: null }; + Object.seal(refObject); + return refObject; + }; + exports.forwardRef = function (render) { + null != render && render.$$typeof === REACT_MEMO_TYPE + ? console.error( + "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." + ) + : "function" !== typeof render + ? console.error( + "forwardRef requires a render function but was given %s.", + null === render ? "null" : typeof render + ) + : 0 !== render.length && + 2 !== render.length && + console.error( + "forwardRef render functions accept exactly two parameters: props and ref. %s", + 1 === render.length + ? "Did you forget to use the ref parameter?" + : "Any additional parameter will be undefined." + ); + null != render && + null != render.defaultProps && + console.error( + "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?" + ); + var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }, + ownName; + Object.defineProperty(elementType, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + render.name || + render.displayName || + (Object.defineProperty(render, "name", { value: name }), + (render.displayName = name)); + } + }); + return elementType; + }; + exports.isValidElement = isValidElement; + exports.lazy = function (ctor) { + ctor = { _status: -1, _result: ctor }; + var lazyType = { + $$typeof: REACT_LAZY_TYPE, + _payload: ctor, + _init: lazyInitializer + }, + ioInfo = { + name: "lazy", + start: -1, + end: -1, + value: null, + owner: null, + debugStack: Error("react-stack-top-frame"), + debugTask: console.createTask ? console.createTask("lazy()") : null + }; + ctor._ioInfo = ioInfo; + lazyType._debugInfo = [{ awaited: ioInfo }]; + return lazyType; + }; + exports.memo = function (type, compare) { + null == type && + console.error( + "memo: The first argument must be a component. Instead received: %s", + null === type ? "null" : typeof type + ); + compare = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; + var ownName; + Object.defineProperty(compare, "displayName", { + enumerable: !1, + configurable: !0, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; + type.name || + type.displayName || + (Object.defineProperty(type, "name", { value: name }), + (type.displayName = name)); + } + }); + return compare; + }; + exports.use = function (usable) { + return resolveDispatcher().use(usable); + }; + exports.useCallback = function (callback, deps) { + return resolveDispatcher().useCallback(callback, deps); + }; + exports.useDebugValue = function (value, formatterFn) { + return resolveDispatcher().useDebugValue(value, formatterFn); + }; + exports.useId = function () { + return resolveDispatcher().useId(); + }; + exports.useMemo = function (create, deps) { + return resolveDispatcher().useMemo(create, deps); + }; + exports.version = "19.2.3"; + })(); diff --git a/node_modules/react/cjs/react.react-server.production.js b/node_modules/react/cjs/react.react-server.production.js new file mode 100644 index 00000000..d4b0b5c7 --- /dev/null +++ b/node_modules/react/cjs/react.react-server.production.js @@ -0,0 +1,423 @@ +/** + * @license React + * react.react-server.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +"use strict"; +var ReactSharedInternals = { H: null, A: null }; +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var isArrayImpl = Array.isArray; +function noop() {} +var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +var hasOwnProperty = Object.prototype.hasOwnProperty, + assign = Object.assign; +function ReactElement(type, key, props) { + var refProp = props.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type: type, + key: key, + ref: void 0 !== refProp ? refProp : null, + props: props + }; +} +function cloneAndReplaceKey(oldElement, newKey) { + return ReactElement(oldElement.type, newKey, oldElement.props); +} +function isValidElement(object) { + return ( + "object" === typeof object && + null !== object && + object.$$typeof === REACT_ELEMENT_TYPE + ); +} +function escape(key) { + var escaperLookup = { "=": "=0", ":": "=2" }; + return ( + "$" + + key.replace(/[=:]/g, function (match) { + return escaperLookup[match]; + }) + ); +} +var userProvidedKeyEscapeRegex = /\/+/g; +function getElementKey(element, index) { + return "object" === typeof element && null !== element && null != element.key + ? escape("" + element.key) + : index.toString(36); +} +function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + default: + switch ( + ("string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )), + thenable.status) + ) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } + } + throw thenable; +} +function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else + switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: + return ( + (invokeCallback = children._init), + mapIntoArray( + invokeCallback(children._payload), + array, + escapedPrefix, + nameSoFar, + callback + ) + ); + } + } + if (invokeCallback) + return ( + (callback = callback(children)), + (invokeCallback = + "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar), + isArrayImpl(callback) + ? ((escapedPrefix = ""), + null != invokeCallback && + (escapedPrefix = + invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), + mapIntoArray(callback, array, escapedPrefix, "", function (c) { + return c; + })) + : null != callback && + (isValidElement(callback) && + (callback = cloneAndReplaceKey( + callback, + escapedPrefix + + (null == callback.key || + (children && children.key === callback.key) + ? "" + : ("" + callback.key).replace( + userProvidedKeyEscapeRegex, + "$&/" + ) + "/") + + invokeCallback + )), + array.push(callback)), + 1 + ); + invokeCallback = 0; + var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) + for (var i = 0; i < children.length; i++) + (nameSoFar = children[i]), + (type = nextNamePrefix + getElementKey(nameSoFar, i)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if (((i = getIteratorFn(children)), "function" === typeof i)) + for ( + children = i.call(children), i = 0; + !(nameSoFar = children.next()).done; + + ) + (nameSoFar = nameSoFar.value), + (type = nextNamePrefix + getElementKey(nameSoFar, i++)), + (invokeCallback += mapIntoArray( + nameSoFar, + array, + escapedPrefix, + type, + callback + )); + else if ("object" === type) { + if ("function" === typeof children.then) + return mapIntoArray( + resolveThenable(children), + array, + escapedPrefix, + nameSoFar, + callback + ); + array = String(children); + throw Error( + formatProdErrorMessage( + 31, + "[object Object]" === array + ? "object with keys {" + Object.keys(children).join(", ") + "}" + : array + ) + ); + } + return invokeCallback; +} +function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], + count = 0; + mapIntoArray(children, result, "", "", function (child) { + return func.call(context, child, count++); + }); + return result; +} +function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then( + function (moduleObject) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 1), (payload._result = moduleObject); + }, + function (error) { + if (0 === payload._status || -1 === payload._status) + (payload._status = 2), (payload._result = error); + } + ); + -1 === payload._status && ((payload._status = 0), (payload._result = ctor)); + } + if (1 === payload._status) return payload._result.default; + throw payload._result; +} +function createCacheRoot() { + return new WeakMap(); +} +function createCacheNode() { + return { s: 0, v: void 0, o: null, p: null }; +} +exports.Children = { + map: mapChildren, + forEach: function (children, forEachFunc, forEachContext) { + mapChildren( + children, + function () { + forEachFunc.apply(this, arguments); + }, + forEachContext + ); + }, + count: function (children) { + var n = 0; + mapChildren(children, function () { + n++; + }); + return n; + }, + toArray: function (children) { + return ( + mapChildren(children, function (child) { + return child; + }) || [] + ); + }, + only: function (children) { + if (!isValidElement(children)) throw Error(formatProdErrorMessage(143)); + return children; + } +}; +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.Profiler = REACT_PROFILER_TYPE; +exports.StrictMode = REACT_STRICT_MODE_TYPE; +exports.Suspense = REACT_SUSPENSE_TYPE; +exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = + ReactSharedInternals; +exports.cache = function (fn) { + return function () { + var dispatcher = ReactSharedInternals.A; + if (!dispatcher) return fn.apply(null, arguments); + var fnMap = dispatcher.getCacheForType(createCacheRoot); + dispatcher = fnMap.get(fn); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher)); + fnMap = 0; + for (var l = arguments.length; fnMap < l; fnMap++) { + var arg = arguments[fnMap]; + if ( + "function" === typeof arg || + ("object" === typeof arg && null !== arg) + ) { + var objectCache = dispatcher.o; + null === objectCache && (dispatcher.o = objectCache = new WeakMap()); + dispatcher = objectCache.get(arg); + void 0 === dispatcher && + ((dispatcher = createCacheNode()), objectCache.set(arg, dispatcher)); + } else + (objectCache = dispatcher.p), + null === objectCache && (dispatcher.p = objectCache = new Map()), + (dispatcher = objectCache.get(arg)), + void 0 === dispatcher && + ((dispatcher = createCacheNode()), + objectCache.set(arg, dispatcher)); + } + if (1 === dispatcher.s) return dispatcher.v; + if (2 === dispatcher.s) throw dispatcher.v; + try { + var result = fn.apply(null, arguments); + fnMap = dispatcher; + fnMap.s = 1; + return (fnMap.v = result); + } catch (error) { + throw ((result = dispatcher), (result.s = 2), (result.v = error), error); + } + }; +}; +exports.cacheSignal = function () { + var dispatcher = ReactSharedInternals.A; + return dispatcher ? dispatcher.cacheSignal() : null; +}; +exports.captureOwnerStack = function () { + return null; +}; +exports.cloneElement = function (element, config, children) { + if (null === element || void 0 === element) + throw Error(formatProdErrorMessage(267, element)); + var props = assign({}, element.props), + key = element.key; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + !hasOwnProperty.call(config, propName) || + "key" === propName || + "__self" === propName || + "__source" === propName || + ("ref" === propName && void 0 === config.ref) || + (props[propName] = config[propName]); + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + for (var childArray = Array(propName), i = 0; i < propName; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + return ReactElement(element.type, key, props); +}; +exports.createElement = function (type, config, children) { + var propName, + props = {}, + key = null; + if (null != config) + for (propName in (void 0 !== config.key && (key = "" + config.key), config)) + hasOwnProperty.call(config, propName) && + "key" !== propName && + "__self" !== propName && + "__source" !== propName && + (props[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) props.children = children; + else if (1 < childrenLength) { + for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) + childArray[i] = arguments[i + 2]; + props.children = childArray; + } + if (type && type.defaultProps) + for (propName in ((childrenLength = type.defaultProps), childrenLength)) + void 0 === props[propName] && + (props[propName] = childrenLength[propName]); + return ReactElement(type, key, props); +}; +exports.createRef = function () { + return { current: null }; +}; +exports.forwardRef = function (render) { + return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; +}; +exports.isValidElement = isValidElement; +exports.lazy = function (ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { _status: -1, _result: ctor }, + _init: lazyInitializer + }; +}; +exports.memo = function (type, compare) { + return { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: void 0 === compare ? null : compare + }; +}; +exports.use = function (usable) { + return ReactSharedInternals.H.use(usable); +}; +exports.useCallback = function (callback, deps) { + return ReactSharedInternals.H.useCallback(callback, deps); +}; +exports.useDebugValue = function () {}; +exports.useId = function () { + return ReactSharedInternals.H.useId(); +}; +exports.useMemo = function (create, deps) { + return ReactSharedInternals.H.useMemo(create, deps); +}; +exports.version = "19.2.3"; diff --git a/node_modules/react/compiler-runtime.js b/node_modules/react/compiler-runtime.js new file mode 100644 index 00000000..ab6aabb0 --- /dev/null +++ b/node_modules/react/compiler-runtime.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-compiler-runtime.production.js'); +} else { + module.exports = require('./cjs/react-compiler-runtime.development.js'); +} diff --git a/node_modules/react/index.js b/node_modules/react/index.js new file mode 100644 index 00000000..d830d7a2 --- /dev/null +++ b/node_modules/react/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react.production.js'); +} else { + module.exports = require('./cjs/react.development.js'); +} diff --git a/node_modules/react/jsx-dev-runtime.js b/node_modules/react/jsx-dev-runtime.js new file mode 100644 index 00000000..0a80857d --- /dev/null +++ b/node_modules/react/jsx-dev-runtime.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-dev-runtime.production.js'); +} else { + module.exports = require('./cjs/react-jsx-dev-runtime.development.js'); +} diff --git a/node_modules/react/jsx-dev-runtime.react-server.js b/node_modules/react/jsx-dev-runtime.react-server.js new file mode 100644 index 00000000..d11e6e82 --- /dev/null +++ b/node_modules/react/jsx-dev-runtime.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-dev-runtime.react-server.production.js'); +} else { + module.exports = require('./cjs/react-jsx-dev-runtime.react-server.development.js'); +} diff --git a/node_modules/react/jsx-runtime.js b/node_modules/react/jsx-runtime.js new file mode 100644 index 00000000..8679b721 --- /dev/null +++ b/node_modules/react/jsx-runtime.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-runtime.production.js'); +} else { + module.exports = require('./cjs/react-jsx-runtime.development.js'); +} diff --git a/node_modules/react/jsx-runtime.react-server.js b/node_modules/react/jsx-runtime.react-server.js new file mode 100644 index 00000000..2d23c8c3 --- /dev/null +++ b/node_modules/react/jsx-runtime.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-jsx-runtime.react-server.production.js'); +} else { + module.exports = require('./cjs/react-jsx-runtime.react-server.development.js'); +} diff --git a/node_modules/react/package.json b/node_modules/react/package.json new file mode 100644 index 00000000..517b9d38 --- /dev/null +++ b/node_modules/react/package.json @@ -0,0 +1,51 @@ +{ + "name": "react", + "description": "React is a JavaScript library for building user interfaces.", + "keywords": [ + "react" + ], + "version": "19.2.3", + "homepage": "https://react.dev/", + "bugs": "https://github.com/facebook/react/issues", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "index.js", + "cjs/", + "compiler-runtime.js", + "jsx-runtime.js", + "jsx-runtime.react-server.js", + "jsx-dev-runtime.js", + "jsx-dev-runtime.react-server.js", + "react.react-server.js" + ], + "main": "index.js", + "exports": { + ".": { + "react-server": "./react.react-server.js", + "default": "./index.js" + }, + "./package.json": "./package.json", + "./jsx-runtime": { + "react-server": "./jsx-runtime.react-server.js", + "default": "./jsx-runtime.js" + }, + "./jsx-dev-runtime": { + "react-server": "./jsx-dev-runtime.react-server.js", + "default": "./jsx-dev-runtime.js" + }, + "./compiler-runtime": { + "react-server": "./compiler-runtime.js", + "default": "./compiler-runtime.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react" + }, + "engines": { + "node": ">=0.10.0" + } +} \ No newline at end of file diff --git a/node_modules/react/react.react-server.js b/node_modules/react/react.react-server.js new file mode 100644 index 00000000..c66e3b76 --- /dev/null +++ b/node_modules/react/react.react-server.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react.react-server.production.js'); +} else { + module.exports = require('./cjs/react.react-server.development.js'); +} diff --git a/node_modules/remark-gfm/index.d.ts b/node_modules/remark-gfm/index.d.ts new file mode 100644 index 00000000..094e9ae9 --- /dev/null +++ b/node_modules/remark-gfm/index.d.ts @@ -0,0 +1,13 @@ +import type {Options as MicromarkOptions} from 'micromark-extension-gfm' +import type {Options as MdastOptions} from 'mdast-util-gfm' + +export {default} from './lib/index.js' + +/** + * Configuration for `remark-gfm`. + * + * Currently supports `singleTilde` as a parse option and + * `firstLineBlank`, `stringLength`, `tableCellPadding`, and `tablePipeAlign` + * as serialization options. + */ +export interface Options extends MicromarkOptions, MdastOptions {} diff --git a/node_modules/remark-gfm/index.js b/node_modules/remark-gfm/index.js new file mode 100644 index 00000000..6a4c25d6 --- /dev/null +++ b/node_modules/remark-gfm/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {default} from './lib/index.js' diff --git a/node_modules/remark-gfm/license b/node_modules/remark-gfm/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/remark-gfm/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/remark-gfm/package.json b/node_modules/remark-gfm/package.json new file mode 100644 index 00000000..bb536e51 --- /dev/null +++ b/node_modules/remark-gfm/package.json @@ -0,0 +1,125 @@ +{ + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "bugs": "https://github.com/remarkjs/remark-gfm/issues", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "description": "remark plugin to support GFM (autolink literals, footnotes, strikethrough, tables, tasklists)", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "is-hidden": "^2.0.0", + "prettier": "^3.0.0", + "remark": "^15.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "string-width": "^6.0.0", + "to-vfile": "^8.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "autolink", + "footnote", + "gfm", + "github", + "markdown", + "mdast", + "plugin", + "remark", + "remark-plugin", + "strikethrough", + "table", + "tasklist", + "unified" + ], + "license": "MIT", + "name": "remark-gfm", + "prettier": { + "bracketSpacing": false, + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "remarkjs/remark-gfm", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix", + "prepack": "npm run build && npm run format", + "test": "npm run build && npm run format && npm run test-coverage", + "test-api": "node --conditions development test/index.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "4.0.1", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off" + } + } +} diff --git a/node_modules/remark-gfm/readme.md b/node_modules/remark-gfm/readme.md new file mode 100644 index 00000000..98ca7de7 --- /dev/null +++ b/node_modules/remark-gfm/readme.md @@ -0,0 +1,518 @@ +# remark-gfm + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**[remark][]** plugin to support [GFM][] (autolink literals, footnotes, +strikethrough, tables, tasklists). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`unified().use(remarkGfm[, options])`](#unifieduseremarkgfm-options) + * [`Options`](#options) +* [Examples](#examples) + * [Example: `singleTilde`](#example-singletilde) + * [Example: `stringLength`](#example-stringlength) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a [unified][] ([remark][]) plugin to enable the extensions to +markdown that GitHub adds with GFM: autolink literals (`www.x.com`), footnotes +(`[^1]`), strikethrough (`~~stuff~~`), tables (`| cell |…`), and tasklists +(`* [x]`). +You can use this plugin to add support for parsing and serializing them. +These extensions by GitHub to CommonMark are called [GFM][] (GitHub Flavored +Markdown). + +This plugin does not handle how markdown is turned to HTML. +That’s done by [`remark-rehype`][remark-rehype]. +If your content is not in English and uses footnotes, you should configure that +plugin. +When generating HTML, you might also want to enable [`rehype-slug`][rehype-slug] +to add `id`s on headings. + +A different plugin, [`remark-frontmatter`][remark-frontmatter], adds support for +frontmatter. +GitHub supports YAML frontmatter for files in repos and Gists but they don’t +treat it as part of GFM. + +Another plugin, [`remark-github`][remark-github], adds support for how markdown +works in relation to a certain GitHub repo in comments, issues, PRs, and +releases, by linking references to commits, issues, and users. + +Yet another plugin, [`remark-breaks`][remark-breaks], turns soft line endings +(enters) into hard breaks (`<br>`s). +GitHub does this in a few places (comments, issues, PRs, and releases). + +## When should I use this? + +This project is useful when you want to support the same features that GitHub +does in files in a repo, Gists, and several other places. +Users frequently believe that some of these extensions, specifically autolink +literals and tables, are part of normal markdown, so using `remark-gfm` will +help match your implementation to their understanding of markdown. +There are several edge cases where GitHub’s implementation works in unexpected +ways or even different than described in their spec, so *writing* in GFM is not +always the best choice. + +If you *just* want to turn markdown into HTML (with maybe a few extensions such +as GFM), we recommend [`micromark`][micromark] with +[`micromark-extension-gfm`][micromark-extension-gfm] instead. +If you don’t use plugins and want to access the syntax tree, you can use +[`mdast-util-from-markdown`][mdast-util-from-markdown] with +[`mdast-util-gfm`][mdast-util-gfm]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install remark-gfm +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import remarkGfm from 'https://esm.sh/remark-gfm@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import remarkGfm from 'https://esm.sh/remark-gfm@4?bundle' +</script> +``` + +## Use + +Say our document `example.md` contains: + +```markdown +# GFM + +## Autolink literals + +www.example.com, https://example.com, and contact@example.com. + +## Footnote + +A note[^1] + +[^1]: Big note. + +## Strikethrough + +~one~ or ~~two~~ tildes. + +## Table + +| a | b | c | d | +| - | :- | -: | :-: | + +## Tasklist + +* [ ] to do +* [x] done +``` + +…and our module `example.js` contains: + +```js +import rehypeStringify from 'rehype-stringify' +import remarkGfm from 'remark-gfm' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {read} from 'to-vfile' +import {unified} from 'unified' + +const file = await unified() + .use(remarkParse) + .use(remarkGfm) + .use(remarkRehype) + .use(rehypeStringify) + .process(await read('example.md')) + +console.log(String(file)) +``` + +…then running `node example.js` yields: + +```html +<h1>GFM</h1> +<h2>Autolink literals</h2> +<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:contact@example.com">contact@example.com</a>.</p> +<h2>Footnote</h2> +<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p> +<h2>Strikethrough</h2> +<p><del>one</del> or <del>two</del> tildes.</p> +<h2>Table</h2> +<table> +<thead> +<tr> +<th>a</th> +<th align="left">b</th> +<th align="right">c</th> +<th align="center">d</th> +</tr> +</thead> +</table> +<h2>Tasklist</h2> +<ul class="contains-task-list"> +<li class="task-list-item"><input type="checkbox" disabled> to do</li> +<li class="task-list-item"><input type="checkbox" checked disabled> done</li> +</ul> +<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2> +<ol> +<li id="user-content-fn-1"> +<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p> +</li> +</ol> +</section> +``` + +## API + +This package exports no identifiers. +The default export is [`remarkGfm`][api-remark-gfm]. + +### `unified().use(remarkGfm[, options])` + +Add support GFM (autolink literals, footnotes, strikethrough, tables, +tasklists). + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Nothing (`undefined`). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `firstLineBlank` (`boolean`, default: `false`) + — serialize with a blank line for the first line of footnote definitions +* `stringLength` (`((value: string) => number)`, default: `d => d.length`) + — detect the size of table cells, used when aligning cells +* `singleTilde` (`boolean`, default: `true`) + — whether to support strikethrough with a single tilde; + single tildes work on github.com, but are technically prohibited by GFM; + you can always use 2 or more tildes for strikethrough +* `tablePipeAlign` (`boolean`, default: `true`) + — whether to align table pipes +* `tableCellPadding` (`boolean`, default: `true`) + — whether to add a space of padding between table pipes and cells + +## Examples + +### Example: `singleTilde` + +To turn off support for parsing strikethrough with single tildes, pass +`singleTilde: false`: + +```js +// … + +const file = await unified() + .use(remarkParse) + .use(remarkGfm, {singleTilde: false}) + .use(remarkRehype) + .use(rehypeStringify) + .process('~one~ and ~~two~~') + +console.log(String(file)) +``` + +Yields: + +```html +<p>~one~ and <del>two</del></p> +``` + +### Example: `stringLength` + +It’s possible to align tables based on the visual width of cells. +First, let’s show the problem: + +```js +import {remark} from 'remark' +import remarkGfm from 'remark-gfm' + +const input = `| Alpha | Bravo | +| - | - | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta |` + +const file = await remark().use(remarkGfm).process(input) + +console.log(String(file)) +``` + +The above code shows how remark can be used to format markdown. +The output is as follows: + +```markdown +| Alpha | Bravo | +| -------- | ------- | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +To improve the alignment of these full-width characters and emoji, pass a +`stringLength` function that calculates the visual width of cells. +One such algorithm is [`string-width`][string-width]. +It can be used like so: + +```diff +@@ -1,5 +1,6 @@ + import {remark} from 'remark' + import remarkGfm from 'remark-gfm' ++import stringWidth from 'string-width' + +@@ -10,7 +11,7 @@ async function main() { + | 👩‍❤️‍👩 | Delta |` + +-const file = await remark().use(remarkGfm).process(input) ++const file = await remark() ++ .use(remarkGfm, {stringLength: stringWidth}) ++ .process(input) + + console.log(String(file)) +``` + +The output of our code with these changes is as follows: + +```markdown +| Alpha | Bravo | +| ----- | ------- | +| 中文 | Charlie | +| 👩‍❤️‍👩 | Delta | +``` + +## Bugs + +For bugs present in GFM but not here, or other peculiarities that are +supported, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#bugs) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#bugs) +* strikethrough: n/a +* [table](https://github.com/micromark/micromark-extension-gfm-table#bugs) +* tasklists: n/a + +## Authoring + +For recommendations on how to author GFM, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#authoring) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#authoring) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#authoring) +* [table](https://github.com/micromark/micromark-extension-gfm-table#authoring) +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#authoring) + +## HTML + +This plugin does not handle how markdown is turned to HTML. +See [`remark-rehype`][remark-rehype] for how that happens and how to change it. + +## CSS + +For info on how GitHub styles these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#css) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#css) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#css) +* [table](https://github.com/micromark/micromark-extension-gfm-table#css) +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#css) + +## Syntax + +For info on the syntax of these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#syntax) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax) +* [table](https://github.com/micromark/micromark-extension-gfm-table#syntax) +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax) + +## Syntax tree + +For info on the syntax tree of these features, see each corresponding readme: + +* [autolink literal](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal#syntax-tree) +* [footnote](https://github.com/syntax-tree/mdast-util-gfm-footnote#syntax-tree) +* [strikethrough](https://github.com/syntax-tree/mdast-util-gfm-strikethrough#syntax-tree) +* [table](https://github.com/syntax-tree/mdast-util-gfm-table#syntax-tree) +* [tasklists](https://github.com/syntax-tree/mdast-util-gfm-task-list-item#syntax-tree) + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +The node types are supported in `@types/mdast` by default. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `remark-gfm@^4`, compatible +with Node.js 16. + +This plugin works with `remark-parse` version 11+ (`remark` version 15+). +The previous version (v3) worked with `remark-parse` version 10 (`remark` +version 14). +Before that, v2 worked with `remark-parse` version 9 (`remark` version 13). +Earlier versions of `remark-parse` and `remark` had a `gfm` option that enabled +this functionality, which defaulted to true. + +## Security + +Use of `remark-gfm` does not involve **[rehype][]** ([hast][]) or user +content so there are no openings for [cross-site scripting (XSS)][wiki-xss] +attacks. + +## Related + +* [`remark-github`][remark-github] + — link references to commits, issues, PRs, and users +* [`remark-breaks`][remark-breaks] + — support breaks without needing spaces or escapes (enters to `<br>`) +* [`remark-frontmatter`][remark-frontmatter] + — support frontmatter (YAML, TOML, and more) +* [`remark-directive`](https://github.com/remarkjs/remark-directive) + — support directives +* [`remark-math`](https://github.com/remarkjs/remark-math) + — support math +* [`remark-mdx`](https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx) + — support MDX (ESM, JSX, expressions) + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-options]: #options + +[api-remark-gfm]: #unifieduseremarkgfm-options + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/remarkjs/remark-gfm/actions + +[build-badge]: https://github.com/remarkjs/remark-gfm/workflows/main/badge.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[collective]: https://opencollective.com/unified + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[coverage]: https://codecov.io/github/remarkjs/remark-gfm + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-gfm.svg + +[downloads]: https://www.npmjs.com/package/remark-gfm + +[downloads-badge]: https://img.shields.io/npm/dm/remark-gfm.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[gfm]: https://github.github.com/gfm/ + +[hast]: https://github.com/syntax-tree/hast + +[health]: https://github.com/remarkjs/.github + +[license]: license + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[npm]: https://docs.npmjs.com/cli/install + +[rehype]: https://github.com/rehypejs/rehype + +[rehype-slug]: https://github.com/rehypejs/rehype-slug + +[remark]: https://github.com/remarkjs/remark + +[remark-breaks]: https://github.com/remarkjs/remark-breaks + +[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter + +[remark-github]: https://github.com/remarkjs/remark-github + +[remark-rehype]: https://github.com/remarkjs/remark-rehype + +[size]: https://bundlejs.com/?q=remark-gfm + +[size-badge]: https://img.shields.io/bundlejs/size/remark-gfm + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[string-width]: https://github.com/sindresorhus/string-width + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting diff --git a/node_modules/remark-parse/index.d.ts b/node_modules/remark-parse/index.d.ts new file mode 100644 index 00000000..c74ec656 --- /dev/null +++ b/node_modules/remark-parse/index.d.ts @@ -0,0 +1,55 @@ +import type {Root} from 'mdast' +import type {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown' +import type {Extension as MicromarkExtension} from 'micromark-util-types' +import type {Plugin} from 'unified' +import type {Options} from './lib/index.js' + +export type {Options} from './lib/index.js' + +/** + * Add support for parsing from markdown. + * + * @this + * Unified processor. + * @param + * Configuration (optional). + * @returns + * Nothing. + */ +declare const remarkParse: Plugin< + [(Readonly<Options> | null | undefined)?], + string, + Root +> +export default remarkParse + +// Add custom settings supported when `remark-parse` is added. +declare module 'unified' { + interface Settings extends Options {} + + interface Data { + /** + * List of `micromark` extensions to use. + * + * This type is registered by `remark-parse`. + * Values can be registered by remark plugins that extend `micromark` and + * `mdast-util-from-markdown`. + * See {@link MicromarkExtension | `Extension`} from + * {@link https://github.com/micromark/micromark/tree/main/packages/micromark-util-types | `micromark-util-types`}. + */ + micromarkExtensions?: MicromarkExtension[] + + /** + * List of `mdast-util-from-markdown` extensions to use. + * + * This type is registered by `remark-parse`. + * Values can be registered by remark plugins that extend `micromark` and + * `mdast-util-from-markdown`. + * See {@link FromMarkdownExtension | `Extension`} from + * {@link https://github.com/syntax-tree/mdast-util-from-markdown#extension | `mdast-util-from-markdown`}. + */ + fromMarkdownExtensions?: Array< + FromMarkdownExtension[] | FromMarkdownExtension + > + } +} diff --git a/node_modules/remark-parse/index.js b/node_modules/remark-parse/index.js new file mode 100644 index 00000000..6a4c25d6 --- /dev/null +++ b/node_modules/remark-parse/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {default} from './lib/index.js' diff --git a/node_modules/remark-parse/license b/node_modules/remark-parse/license new file mode 100644 index 00000000..51b54306 --- /dev/null +++ b/node_modules/remark-parse/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2014 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/remark-parse/package.json b/node_modules/remark-parse/package.json new file mode 100644 index 00000000..8383b21b --- /dev/null +++ b/node_modules/remark-parse/package.json @@ -0,0 +1,72 @@ +{ + "name": "remark-parse", + "version": "11.0.0", + "description": "remark plugin to add support for parsing markdown input", + "license": "MIT", + "keywords": [ + "abstract", + "ast", + "markdown", + "mdast", + "parse", + "plugin", + "remark", + "remark-plugin", + "syntax", + "tree", + "unified" + ], + "homepage": "https://remark.js.org", + "repository": "https://github.com/remarkjs/remark/tree/main/packages/remark-parse", + "bugs": "https://github.com/remarkjs/remark/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Eugene Sharygin <eush77@gmail.com>", + "Junyoung Choi <fluke8259@gmail.com>", + "Elijah Hamovitz <elijahhamovitz@gmail.com>", + "Ika <ikatyang@gmail.com>" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "scripts": {}, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/no-this-assignment": "off" + } + } +} diff --git a/node_modules/remark-parse/readme.md b/node_modules/remark-parse/readme.md new file mode 100644 index 00000000..b0977ab5 --- /dev/null +++ b/node_modules/remark-parse/readme.md @@ -0,0 +1,428 @@ +# remark-parse + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**[remark][]** plugin to add support for parsing from markdown. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`unified().use(remarkParse)`](#unifieduseremarkparse) +* [Examples](#examples) + * [Example: support GFM and frontmatter](#example-support-gfm-and-frontmatter) + * [Example: turning markdown into a man page](#example-turning-markdown-into-a-man-page) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [License](#license) + +## What is this? + +This package is a [unified][] ([remark][]) plugin that defines how to take +markdown as input and turn it into a syntax tree. + +See [the monorepo readme][remark] for info on what the remark ecosystem is. + +## When should I use this? + +This plugin adds support to unified for parsing markdown. +If you also need to serialize markdown, you can alternatively use +[`remark`][remark-core], which combines unified, this plugin, and +[`remark-stringify`][remark-stringify]. + +If you *just* want to turn markdown into HTML (with maybe a few extensions), +we recommend [`micromark`][micromark] instead. +If you don’t use plugins and want to access the syntax tree, you can directly +use [`mdast-util-from-markdown`][mdast-util-from-markdown]. +remark focusses on making it easier to transform content by abstracting these +internals away. + +You can combine this plugin with other plugins to add syntax extensions. +Notable examples that deeply integrate with it are +[`remark-gfm`][remark-gfm], +[`remark-mdx`][remark-mdx], +[`remark-frontmatter`][remark-frontmatter], +[`remark-math`][remark-math], and +[`remark-directive`][remark-directive]. +You can also use any other [remark plugin][remark-plugin] after `remark-parse`. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install remark-parse +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import remarkParse from 'https://esm.sh/remark-parse@11' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import remarkParse from 'https://esm.sh/remark-parse@11?bundle' +</script> +``` + +## Use + +Say we have the following module `example.js`: + +```js +import rehypeStringify from 'rehype-stringify' +import remarkGfm from 'remark-gfm' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const doc = ` +# Mercury + +**Mercury** is the first planet from the [Sun](https://en.wikipedia.org/wiki/Sun) +and the smallest planet in the Solar System. +` + +const file = await unified() + .use(remarkParse) + .use(remarkGfm) + .use(remarkRehype) + .use(rehypeStringify) + .process(doc) + +console.log(String(file)) +``` + +…then running `node example.js` yields: + +```html +<h1>Mercury</h1> +<p><strong>Mercury</strong> is the first planet from the <a href="https://en.wikipedia.org/wiki/Sun">Sun</a> +and the smallest planet in the Solar System.</p> +``` + +## API + +This package exports no identifiers. +The default export is [`remarkParse`][api-remark-parse]. + +### `unified().use(remarkParse)` + +Add support for parsing from markdown. + +###### Parameters + +There are no parameters. + +###### Returns + +Nothing (`undefined`). + +## Examples + +### Example: support GFM and frontmatter + +We support CommonMark by default. +Non-standard markdown extensions can be enabled with plugins. + +This example shows how to support GFM features (autolink literals, +footnotes, strikethrough, tables, tasklists) and frontmatter (YAML): + +```js +import rehypeStringify from 'rehype-stringify' +import remarkFrontmatter from 'remark-frontmatter' +import remarkGfm from 'remark-gfm' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const doc = `--- +layout: solar-system +--- + +# Hi ~~Mars~~Venus! +` + +const file = await unified() + .use(remarkParse) + .use(remarkFrontmatter) + .use(remarkGfm) + .use(remarkRehype) + .use(rehypeStringify) + .process(doc) + +console.log(String(file)) +``` + +Yields: + +```html +<h1>Hi <del>Mars</del>Venus!</h1> +``` + +### Example: turning markdown into a man page + +Man pages (short for manual pages) are a way to document CLIs (example: type +`man git-log` in your terminal). +They use an old markup format called roff. +There’s a remark plugin, [`remark-man`][remark-man], that can serialize as +roff. + +This example shows how to turn markdown into man pages by using unified with +`remark-parse` and `remark-man`: + +```js +import remarkMan from 'remark-man' +import remarkParse from 'remark-parse' +import {unified} from 'unified' + +const doc = ` +# titan(7) -- largest moon of saturn + +Titan is the largest moon… +` + +const file = await unified().use(remarkParse).use(remarkMan).process(doc) + +console.log(String(file)) +``` + +Yields: + +```roff +.TH "TITAN" "7" "September 2023" "" "" +.SH "NAME" +\fBtitan\fR - largest moon of saturn +.P +Titan is the largest moon… +``` + +## Syntax + +Markdown is parsed according to CommonMark. +Other plugins can add support for syntax extensions. +If you’re interested in extending markdown, +[more information is available in micromark’s readme][micromark-extend]. + +## Syntax tree + +The syntax tree used in remark is [mdast][]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type `Options` (which is currently empty). + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `remark-parse@^11`, +compatible with Node.js 16. + +## Security + +As markdown can be turned into HTML and improper use of HTML can open you up to +[cross-site scripting (XSS)][xss] attacks, use of remark can be unsafe. +When going to HTML, you will combine remark with **[rehype][]**, in which case +you should use [`rehype-sanitize`][rehype-sanitize]. + +Use of remark plugins could also open you up to other attacks. +Carefully assess each plugin and the risks involved in using them. + +For info on how to submit a report, see our [security policy][security]. + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. +Join us in [Discussions][chat] to chat with the community and contributors. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## Sponsor + +Support this effort and give back by sponsoring on [OpenCollective][collective]! + +<table> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +<td width="10%"></td> +<td width="10%"></td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="8"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/remarkjs/remark/workflows/main/badge.svg + +[build]: https://github.com/remarkjs/remark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage]: https://codecov.io/github/remarkjs/remark + +[downloads-badge]: https://img.shields.io/npm/dm/remark-parse.svg + +[downloads]: https://www.npmjs.com/package/remark-parse + +[size-badge]: https://img.shields.io/bundlejs/size/remark-parse + +[size]: https://bundlejs.com/?q=remark-parse + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[security]: https://github.com/remarkjs/.github/blob/main/security.md + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/main/support.md + +[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark/blob/main/license + +[author]: https://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown + +[micromark]: https://github.com/micromark/micromark + +[micromark-extend]: https://github.com/micromark/micromark#extensions + +[rehype]: https://github.com/rehypejs/rehype + +[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[remark]: https://github.com/remarkjs/remark + +[remark-core]: ../remark/ + +[remark-directive]: https://github.com/remarkjs/remark-directive + +[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[remark-mdx]: https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx + +[remark-man]: https://github.com/remarkjs/remark-man + +[remark-math]: https://github.com/remarkjs/remark-math + +[remark-plugin]: https://github.com/remarkjs/remark#plugin + +[remark-stringify]: ../remark-stringify/ + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[api-remark-parse]: #unifieduseremarkparse diff --git a/node_modules/remark-rehype/index.d.ts b/node_modules/remark-rehype/index.d.ts new file mode 100644 index 00000000..d493d939 --- /dev/null +++ b/node_modules/remark-rehype/index.d.ts @@ -0,0 +1,4 @@ +export { default } from "./lib/index.js"; +export type Options = import("./lib/index.js").Options; +export { defaultFootnoteBackContent, defaultFootnoteBackLabel, defaultHandlers } from "mdast-util-to-hast"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/remark-rehype/index.d.ts.map b/node_modules/remark-rehype/index.d.ts.map new file mode 100644 index 00000000..43cfb3e4 --- /dev/null +++ b/node_modules/remark-rehype/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";sBACa,OAAO,gBAAgB,EAAE,OAAO"} \ No newline at end of file diff --git a/node_modules/remark-rehype/index.js b/node_modules/remark-rehype/index.js new file mode 100644 index 00000000..c574dd0f --- /dev/null +++ b/node_modules/remark-rehype/index.js @@ -0,0 +1,10 @@ +/** + * @typedef {import('./lib/index.js').Options} Options + */ + +export { + defaultFootnoteBackContent, + defaultFootnoteBackLabel, + defaultHandlers +} from 'mdast-util-to-hast' +export {default} from './lib/index.js' diff --git a/node_modules/remark-rehype/license b/node_modules/remark-rehype/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/remark-rehype/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/remark-rehype/package.json b/node_modules/remark-rehype/package.json new file mode 100644 index 00000000..605c2ef2 --- /dev/null +++ b/node_modules/remark-rehype/package.json @@ -0,0 +1,86 @@ +{ + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "bugs": "https://github.com/remarkjs/remark-rehype/issues", + "contributors": [ + "John Otander <johnotander@gmail.com> (https://johno.com)", + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "description": "remark plugin that turns markdown into HTML to support rehype", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "rehype-slug": "^6.0.0", + "rehype-stringify": "^10.0.0", + "remark-cli": "^12.0.0", + "remark-parse": "^11.0.0", + "remark-preset-wooorm": "^11.0.0", + "remark-stringify": "^11.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "hast", + "html", + "markdown", + "mdast", + "plugin", + "rehype-plugin", + "rehype", + "remark-plugin", + "remark", + "unified" + ], + "license": "MIT", + "name": "remark-rehype", + "prettier": { + "bracketSpacing": false, + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "remarkjs/remark-rehype", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "11.1.2", + "xo": { + "prettier": true + } +} diff --git a/node_modules/remark-rehype/readme.md b/node_modules/remark-rehype/readme.md new file mode 100644 index 00000000..ad203287 --- /dev/null +++ b/node_modules/remark-rehype/readme.md @@ -0,0 +1,802 @@ +# remark-rehype + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +**[remark][github-remark]** plugin that turns markdown into HTML to support +**[rehype][github-rehype]**. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`](#defaultfootnotebackcontentreferenceindex-rereferenceindex) + * [`defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`](#defaultfootnotebacklabelreferenceindex-rereferenceindex) + * [`defaultHandlers`](#defaulthandlers) + * [`unified().use(remarkRehype[, destination][, options])`](#unifieduseremarkrehype-destination-options) + * [`Options`](#options) +* [Examples](#examples) + * [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely) + * [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly) + * [Example: footnotes in languages other than English](#example-footnotes-in-languages-other-than-english) +* [HTML](#html-1) +* [CSS](#css) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a [unified][github-unified] ([remark][github-remark]) +plugin that switches from remark (the markdown ecosystem) +to rehype (the HTML ecosystem). +It does this by transforming the current markdown (mdast) syntax tree into an +HTML (hast) syntax tree. +remark plugins deal with mdast and rehype plugins deal with hast, +so plugins used after `remark-rehype` have to be rehype plugins. + +The reason that there are different ecosystems for markdown and HTML is that +turning markdown into HTML is, +while frequently needed, +not the only purpose of markdown. +Checking (linting) and formatting markdown are also common use cases for +remark and markdown. +There are several aspects of markdown that do not translate 1-to-1 to HTML. +In some cases markdown contains more information than HTML: +for example, +there are several ways to add a link in markdown +(as in, +autolinks: `<https://url>`, +resource links: `[label](url)`, +and reference links with definitions: +`[label][id]` and `[id]: url`). +In other cases HTML contains more information than markdown: +there are many tags, +which add new meaning (semantics), +available in HTML that aren’t available in markdown. +If there was just one AST, +it would be quite hard to perform the tasks that several remark and rehype +plugins currently do. + +## When should I use this? + +This project is useful when you want to turn markdown to HTML. +It opens up a whole new ecosystem with tons of plugins to do all kinds of +things. +You can [minify HTML][github-rehype-minify], +[format HTML][github-rehype-format], +[make sure it’s safe][github-rehype-sanitize], +[highlight code][github-rehype-starry-night], +[add metadata][github-rehype-meta], +and a lot more. + +A different plugin, +[`rehype-raw`][github-rehype-raw], +adds support for raw HTML written inside markdown. +This is a separate plugin because supporting HTML inside markdown is a heavy +task (performance and bundle size) and not always needed. +To use both together, +you also have to configure `remark-rehype` with `allowDangerousHtml: true` and +then use `rehype-raw`. + +The rehype plugin [`rehype-remark`][github-rehype-remark] does the inverse of +this plugin. +It turns HTML into markdown. + +If you don’t use plugins and want to access syntax trees, +you can use +[`mdast-util-to-hast`][github-mdast-util-to-hast]. + +## Install + +This package is [ESM only][github-gist-esm]. +In Node.js (version 16+), +install with [npm][npmjs-install]: + +```sh +npm install remark-rehype +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import remarkRehype from 'https://esm.sh/remark-rehype@11' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import remarkRehype from 'https://esm.sh/remark-rehype@11?bundle' +</script> +``` + +## Use + +Say our document `example.md` contains: + +```markdown +# Pluto + +**Pluto** (minor-planet designation: **134340 Pluto**) is a +[dwarf planet](https://en.wikipedia.org/wiki/Dwarf_planet) in the +[Kuiper belt](https://en.wikipedia.org/wiki/Kuiper_belt). +``` + +…and our module `example.js` contains: + +```js +import rehypeDocument from 'rehype-document' +import rehypeFormat from 'rehype-format' +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {read} from 'to-vfile' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeDocument) + .use(rehypeFormat) + .use(rehypeStringify) + .process(await read('example.md')) + +console.error(reporter(file)) +console.log(String(file)) +``` + +…then running `node example.js` yields: + +```text +example.md: no issues found +``` + +```html +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>example</title> + <meta content="width=device-width, initial-scale=1" name="viewport"> + </head> + <body> + <h1>Pluto</h1> + <p> + <strong>Pluto</strong> (minor-planet designation: <strong>134340 Pluto</strong>) is a + <a href="https://en.wikipedia.org/wiki/Dwarf_planet">dwarf planet</a> in the + <a href="https://en.wikipedia.org/wiki/Kuiper_belt">Kuiper belt</a>. + </p> + </body> +</html> +``` + +## API + +This package exports the identifiers +[`defaultFootnoteBackContent`][api-default-footnote-back-content], +[`defaultFootnoteBackLabel`][api-default-footnote-back-label], +and +[`defaultHandlers`][api-default-handlers]. +The default export is [`remarkRehype`][api-remark-rehype]. + +### `defaultFootnoteBackContent(referenceIndex, rereferenceIndex)` + +See [`defaultFootnoteBackContent` from +`mdast-util-to-hast`][github-mdast-util-to-hast-default-back-content]. + +### `defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)` + +See [`defaultFootnoteBackLabel` from +`mdast-util-to-hast`][github-mdast-util-to-hast-default-back-label]. + +### `defaultHandlers` + +See [`defaultHandlers` from +`mdast-util-to-hast`][github-mdast-util-to-hast-default-handlers]. + +### `unified().use(remarkRehype[, destination][, options])` + +Turn markdown into HTML. + +###### Parameters + +* `destination` + ([`Processor`][github-unified-processor], optional) + — processor +* `options` + ([`Options`][api-options], optional) + — configuration + +###### Returns + +Transform ([`Transformer`][github-unified-transformer]). + +##### Notes + +###### Signature + +* if a [processor][github-unified-processor] is given, + runs the (rehype) plugins used on it with a hast tree, + then discards the result + ([*bridge mode*][github-unified-mode]) +* otherwise, + returns a hast tree, + the plugins used after `remarkRehype` are rehype plugins + ([*mutate mode*][github-unified-mode]) + +> 👉 **Note**: +> it’s highly unlikely that you want to pass a `processor`. + +###### HTML + +Raw HTML is available in mdast as [`html`][github-mdast-html] nodes and can be +embedded in hast as semistandard `raw` nodes. +Most plugins ignore `raw` nodes but two notable ones don’t: + +* [`rehype-stringify`][github-rehype-stringify] also has an option + `allowDangerousHtml` which will output the raw HTML; + this is typically discouraged as noted by the option name but is useful if + you completely trust authors +* [`rehype-raw`][github-rehype-raw] can handle the raw embedded HTML strings by + parsing them into standard hast nodes + (`element`, `text`, etc); + This is a heavy task as it needs a full HTML parser, + but it is the only way to support untrusted content + +###### Footnotes + +Many options supported here relate to footnotes. +Footnotes are not specified by CommonMark, +which we follow by default. +They are supported by GitHub, +so footnotes can be enabled in markdown with [`remark-gfm`][github-remark-gfm]. + +The options `footnoteBackLabel` and `footnoteLabel` define natural language +that explains footnotes, +which is hidden for sighted users but shown to assistive technology. +When your page is not in English, +you must define translated values. + +Back references use ARIA attributes, +but the section label itself uses a heading that is hidden with an +`sr-only` class. +To show it to sighted users, +define different attributes in `footnoteLabelProperties`. + +###### Clobbering + +Footnotes introduces a problem, +as it links footnote calls to footnote definitions on the page through `id` +attributes generated from user content, +which results in DOM clobbering. + +DOM clobbering is this: + +```html +<p id=x></p> +<script>alert(x) // `x` now refers to the DOM `p#x` element</script> +``` + +Elements by their ID are made available by browsers on the `window` object, +which is a security risk. +Using a prefix solves this problem. + +More information on how to handle clobbering and the prefix is explained in +[*Example: headings (DOM clobbering)* in +`rehype-sanitize`][github-rehype-sanitize-clobber]. + +###### Unknown nodes + +Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`. +The default behavior for unknown nodes is: + +* when the node has a `value` + (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`, + see later), + create a hast `text` node +* otherwise, + create a `<div>` element + (which could be changed with `data.hName`), + with its children mapped from mdast to hast as well + +This behavior can be changed by passing an `unknownHandler`. + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `allowDangerousHtml` + (`boolean`, default: `false`) + — whether to persist raw HTML in markdown in the hast tree +* `clobberPrefix` + (`string`, default: `'user-content-'`) + — prefix to use before the `id` property on footnotes to prevent them from + *clobbering* +* `footnoteBackContent` + ([`FootnoteBackContentTemplate` from + `mdast-util-to-hast`][github-mdast-util-to-hast-back-content-template] + or `string`, default: + [`defaultFootnoteBackContent` from + `mdast-util-to-hast`][github-mdast-util-to-hast-default-back-content]) + — content of the backreference back to references +* `footnoteBackLabel` + ([`FootnoteBackLabelTemplate` from + `mdast-util-to-hast`][github-mdast-util-to-hast-back-label-template] + or `string`, default: + [`defaultFootnoteBackLabel` from + `mdast-util-to-hast`][github-mdast-util-to-hast-default-back-label]) + — label to describe the backreference back to references +* `footnoteLabel` + (`string`, default: `'Footnotes'`) + — label to use for the footnotes section (affects screen readers) +* `footnoteLabelProperties` + ([`Properties` from `@types/hast`][github-hast-properties], default: + `{className: ['sr-only']}`) + — properties to use on the footnote label + (note that `id: 'footnote-label'` is always added as footnote calls use it + with `aria-describedby` to provide an accessible label) +* `footnoteLabelTagName` + (`string`, default: `h2`) + — tag name to use for the footnote label +* `handlers` + ([`Handlers` from + `mdast-util-to-hast`][github-mdast-util-to-hast-handlers], optional) + — extra handlers for nodes +* `passThrough` + (`Array<Nodes['type']>`, optional) + — list of custom mdast node types to pass through (keep) in hast (note that + the node itself is passed, but eventual children are transformed) +* `unknownHandler` + ([`Handler` from + `mdast-util-to-hast`][github-mdast-util-to-hast-handler], optional) + — handle all unknown nodes + +## Examples + +### Example: supporting HTML in markdown naïvely + +If you completely trust the authors of the input markdown and want to allow them +to write HTML inside markdown, +you can pass `allowDangerousHtml` to `remark-rehype` and `rehype-stringify`: + +```js +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype, {allowDangerousHtml: true}) + .use(rehypeStringify, {allowDangerousHtml: true}) + .process('<a href="/wiki/Dysnomia_(moon)" onclick="alert(1)">Dysnomia</a>') + +console.log(String(file)) +``` + +Yields: + +```html +<p><a href="/wiki/Dysnomia_(moon)" onclick="alert(1)">Dysnomia</a></p> +``` + +> ⚠️ **Danger**: +> observe that the XSS attack through `onclick` is present. + +### Example: supporting HTML in markdown properly + +If you do not trust the authors of the input markdown, +or if you want to make sure that rehype plugins can see HTML embedded in +markdown, +use [`rehype-raw`][github-rehype-raw]. +The following example passes `allowDangerousHtml` to `remark-rehype`, +then turns the raw embedded HTML into proper HTML nodes with `rehype-raw`, +and finally sanitizes the HTML by only allowing safe things with +`rehype-sanitize`: + +```js +import rehypeSanitize from 'rehype-sanitize' +import rehypeStringify from 'rehype-stringify' +import rehypeRaw from 'rehype-raw' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype, {allowDangerousHtml: true}) + .use(rehypeRaw) + .use(rehypeSanitize) + .use(rehypeStringify) + .process('<a href="/wiki/Dysnomia_(moon)" onclick="alert(1)">Dysnomia</a>') + +console.log(String(file)) +``` + +Running that code yields: + +```html +<p><a href="/wiki/Dysnomia_(moon)">Dysnomia</a></p> +``` + +> ⚠️ **Danger**: +> observe that the XSS attack through `onclick` is **not** present. + +### Example: footnotes in languages other than English + +If you know that the markdown is authored in a language other than English, +and you’re using `remark-gfm` to match how GitHub renders markdown, +and you know that footnotes are (or can?) be used, +you should translate the labels associated with them. + +Let’s first set the stage: + +```js +import {unified} from 'unified' +import remarkParse from 'remark-parse' +import remarkGfm from 'remark-gfm' +import remarkRehype from 'remark-rehype' +import rehypeStringify from 'rehype-stringify' + +const doc = ` +Ceres ist nach der römischen Göttin des Ackerbaus benannt; +ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.[^nasa-2015] + +[^nasa-2015]: JPL/NASA: + [*What is a Dwarf Planet?*](https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet) + In: Jet Propulsion Laboratory. + 22. April 2015, + abgerufen am 19. Januar 2022 (englisch). +` + +const file = await unified() + .use(remarkParse) + .use(remarkGfm) + .use(remarkRehype) + .use(rehypeStringify) + .process(doc) + +console.log(String(file)) +``` + +Yields: + +```html +<p>Ceres ist nach der römischen Göttin des Ackerbaus benannt; +ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.<sup><a href="#user-content-fn-nasa-2015" id="user-content-fnref-nasa-2015" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p> +<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2> +<ol> +<li id="user-content-fn-nasa-2015"> +<p>JPL/NASA: +<a href="https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet"><em>What is a Dwarf Planet?</em></a> +In: Jet Propulsion Laboratory. +22. April 2015, +abgerufen am 19. Januar 2022 (englisch). <a href="#user-content-fnref-nasa-2015" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a></p> +</li> +</ol> +</section> +``` + +This is a mix of English and German that isn’t very accessible, +such as that screen readers can’t handle it nicely. +Let’s say our program *does* know that the markdown is in German. +In that case, +it’s important to translate and define the labels relating to footnotes so that +screen reader users can properly pronounce the page: + +```diff +@@ -18,7 +18,16 @@ ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.[^nasa-2015] + const file = await unified() + .use(remarkParse) + .use(remarkGfm) +- .use(remarkRehype) ++ .use(remarkRehype, { ++ footnoteBackLabel(referenceIndex, rereferenceIndex) { ++ return ( ++ 'Hochspringen nach: ' + ++ (referenceIndex + 1) + ++ (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') ++ ) ++ }, ++ footnoteLabel: 'Fußnoten' ++ }) + .use(rehypeStringify) + .process(doc) +``` + +Running the code with the above patch applied, +yields: + +```diff +@@ -1,13 +1,13 @@ + <p>Ceres ist nach der römischen Göttin des Ackerbaus benannt; + ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.<sup><a href="#user-content-fn-nasa-2015" id="user-content-fnref-nasa-2015" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p> +-<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2> ++<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Fußnoten</h2> + <ol> + <li id="user-content-fn-nasa-2015"> + <p>JPL/NASA: + <a href="https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet"><em>What is a Dwarf Planet?</em></a> + In: Jet Propulsion Laboratory. + 22. April 2015, +-abgerufen am 19. Januar 2022 (englisch). <a href="#user-content-fnref-nasa-2015" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a></p> ++abgerufen am 19. Januar 2022 (englisch). <a href="#user-content-fnref-nasa-2015" data-footnote-backref="" aria-label="Hochspringen nach: 1" class="data-footnote-backref">↩</a></p> + </li> + </ol> + </section> +``` + +## HTML + +See [*Algorithm* in +`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast#algorithm) +for info on how mdast (markdown) nodes are transformed to hast (HTML). + +## CSS + +Assuming you know how to use (semantic) HTML and CSS, +then it should generally be straightforward to style the HTML produced by this +plugin. +With CSS, +you can get creative and style the results as you please. + +Some semistandard features, +notably GFMs tasklists and footnotes, +generate HTML that be unintuitive, +as it matches exactly what GitHub produces for their website. +There is a project, +[`sindresorhus/github-markdown-css`][github-markdown-css], +that exposes the stylesheet that GitHub uses for rendered markdown, +which might either be inspirational for more complex features, +or can be used as-is to exactly match how GitHub styles rendered markdown. + +The following CSS is needed to make footnotes look a bit like GitHub: + +```css +/* Style the footnotes section. */ +.footnotes { + font-size: smaller; + color: #8b949e; + border-top: 1px solid #30363d; +} + +/* Hide the section label for visual users. */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + word-wrap: normal; + border: 0; +} + +/* Place `[` and `]` around footnote calls. */ +[data-footnote-ref]::before { + content: '['; +} + +[data-footnote-ref]::after { + content: ']'; +} +``` + +## Syntax tree + +This projects turns [mdast][github-mdast] (markdown) into [hast][github-hast] +(HTML). + +It extends mdast by supporting `data` fields on mdast nodes to specify how they +should be transformed. +See [*Fields on nodes* in +`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast#fields-on-nodes) +for info on how these fields work. + +It extends hast by using a semistandard raw nodes for raw HTML. +See the [*HTML* note above](#html) for more info. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the types +[`Options`][api-options]. + +The types of `mdast-util-to-hast` can be referenced to register data fields +with `@types/mdast` and `Raw` nodes with `@types/hast`. + +```js +/** + * @import {Root as HastRoot} from 'hast' + * @import {Root as MdastRoot} from 'mdast' + * @import {} from 'mdast-util-to-hast' + */ + +import {visit} from 'unist-util-visit' + +const mdastNode = /** @type {MdastRoot} */ ({/* … */}) +console.log(mdastNode.data?.hName) // Typed as `string | undefined`. + +const hastNode = /** @type {HastRoot} */ ({/* … */}) + +visit(hastNode, function (node) { + // `node` can now be `raw`. +}) +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, +we drop support for unmaintained versions of Node. +This means we try to keep the current release line, +`remark-rehype@11`, +compatible with Node.js 16. + +This plugin works with `unified` version 6+, +`remark-parse` version 3+ +(used in `remark` version 7), +and `rehype-stringify` version 3+ +(used in `rehype` version 5). + +## Security + +Use of `remark-rehype` can open you up to a +[cross-site scripting (XSS)][wikipedia-xss] attack. +Embedded **[hast][github-hast]** properties +(`hName`, `hProperties`, `hChildren`) +in [mdast][github-mdast], +custom handlers, +and the `allowDangerousHtml` option all provide openings. +Use [`rehype-sanitize`][github-rehype-sanitize] to make the tree safe. + +## Related + +* [`rehype-raw`][github-rehype-raw] + — rehype plugin to parse the tree again and support `raw` nodes +* [`rehype-sanitize`][github-rehype-sanitize] + — rehype plugin to sanitize HTML +* [`rehype-remark`][github-rehype-remark] + — rehype plugin to turn HTML into markdown +* [`rehype-retext`](https://github.com/rehypejs/rehype-retext) + — rehype plugin to support retext +* [`remark-retext`](https://github.com/remarkjs/remark-retext) + — remark plugin to support retext + +## Contribute + +See [`contributing.md`][health-contributing] in [`remarkjs/.github`][health] +for ways to get started. +See [`support.md`][health-support] for ways to get help. + +This project has a [code of conduct][health-coc]. +By interacting with this repository, +organization, +or community you agree to abide by its terms. + +## License + +[MIT][file-license] © [Titus Wormer][wooorm] + +<!-- Definitions --> + +[api-default-footnote-back-content]: #defaultfootnotebackcontentreferenceindex-rereferenceindex + +[api-default-footnote-back-label]: #defaultfootnotebacklabelreferenceindex-rereferenceindex + +[api-default-handlers]: #defaulthandlers + +[api-options]: #options + +[api-remark-rehype]: #unifieduseremarkrehype-destination-options + +[badge-build-image]: https://github.com/remarkjs/remark-rehype/workflows/main/badge.svg + +[badge-build-url]: https://github.com/remarkjs/remark-rehype/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/remarkjs/remark-rehype.svg + +[badge-coverage-url]: https://codecov.io/github/remarkjs/remark-rehype + +[badge-downloads-image]: https://img.shields.io/npm/dm/remark-rehype.svg + +[badge-downloads-url]: https://www.npmjs.com/package/remark-rehype + +[badge-size-image]: https://img.shields.io/bundlejs/size/remark-rehype + +[badge-size-url]: https://bundlejs.com/?q=remark-rehype + +[esmsh]: https://esm.sh + +[file-license]: license + +[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[github-hast]: https://github.com/syntax-tree/hast + +[github-hast-properties]: https://github.com/syntax-tree/hast#properties + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[github-mdast]: https://github.com/syntax-tree/mdast + +[github-mdast-html]: https://github.com/syntax-tree/mdast#html + +[github-mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast + +[github-mdast-util-to-hast-back-content-template]: https://github.com/syntax-tree/mdast-util-to-hast#footnotebackcontenttemplate + +[github-mdast-util-to-hast-back-label-template]: https://github.com/syntax-tree/mdast-util-to-hast#footnotebacklabeltemplate + +[github-mdast-util-to-hast-default-back-content]: https://github.com/syntax-tree/mdast-util-to-hast#defaultfootnotebackcontentreferenceindex-rereferenceindex + +[github-mdast-util-to-hast-default-back-label]: https://github.com/syntax-tree/mdast-util-to-hast#defaultfootnotebacklabelreferenceindex-rereferenceindex + +[github-mdast-util-to-hast-default-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#defaulthandlers + +[github-mdast-util-to-hast-handler]: https://github.com/syntax-tree/mdast-util-to-hast#handler + +[github-mdast-util-to-hast-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#handlers + +[github-rehype]: https://github.com/rehypejs/rehype + +[github-rehype-format]: https://github.com/rehypejs/rehype-format + +[github-rehype-meta]: https://github.com/rehypejs/rehype-meta + +[github-rehype-minify]: https://github.com/rehypejs/rehype-minify + +[github-rehype-raw]: https://github.com/rehypejs/rehype-raw + +[github-rehype-remark]: https://github.com/rehypejs/rehype-remark + +[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[github-rehype-sanitize-clobber]: https://github.com/rehypejs/rehype-sanitize#example-headings-dom-clobbering + +[github-rehype-starry-night]: https://github.com/rehypejs/rehype-starry-night + +[github-rehype-stringify]: https://github.com/rehypejs/rehype/tree/main/packages/rehype-stringify + +[github-remark]: https://github.com/remarkjs/remark + +[github-remark-gfm]: https://github.com/remarkjs/remark-gfm + +[github-unified]: https://github.com/unifiedjs/unified + +[github-unified-mode]: https://github.com/unifiedjs/unified#transforming-between-ecosystems + +[github-unified-processor]: https://github.com/unifiedjs/unified#processor + +[github-unified-transformer]: https://github.com/unifiedjs/unified#transformer + +[health]: https://github.com/remarkjs/.github + +[health-coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md + +[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md + +[health-support]: https://github.com/remarkjs/.github/blob/main/support.md + +[npmjs-install]: https://docs.npmjs.com/cli/install + +[typescript]: https://www.typescriptlang.org + +[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[wooorm]: https://wooorm.com diff --git a/node_modules/remark-stringify/index.d.ts b/node_modules/remark-stringify/index.d.ts new file mode 100644 index 00000000..0b266fce --- /dev/null +++ b/node_modules/remark-stringify/index.d.ts @@ -0,0 +1,41 @@ +import type {Root} from 'mdast' +import type {Options as ToMarkdownExtension} from 'mdast-util-to-markdown' +import type {Plugin} from 'unified' +import type {Options} from './lib/index.js' + +export type {Options} from './lib/index.js' + +/** + * Add support for serializing to markdown. + * + * @this + * Unified processor. + * @param + * Configuration (optional). + * @returns + * Nothing. + */ +declare const remarkStringify: Plugin< + [(Readonly<Options> | null | undefined)?], + Root, + string +> +export default remarkStringify + +// Add custom settings supported when `remark-stringify` is added. +declare module 'unified' { + interface Settings extends Options {} + + interface Data { + /** + * List of `mdast-util-to-markdown` extensions to use. + * + * This type is registered by `remark-stringify`. + * Values can be registered by remark plugins that extend + * `mdast-util-to-markdown`. + * See {@link ToMarkdownExtension | `Options`} from + * {@link https://github.com/syntax-tree/mdast-util-to-markdown#options | `mdast-util-to-markdown`}. + */ + toMarkdownExtensions?: ToMarkdownExtension[] + } +} diff --git a/node_modules/remark-stringify/index.js b/node_modules/remark-stringify/index.js new file mode 100644 index 00000000..6a4c25d6 --- /dev/null +++ b/node_modules/remark-stringify/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {default} from './lib/index.js' diff --git a/node_modules/remark-stringify/license b/node_modules/remark-stringify/license new file mode 100644 index 00000000..51b54306 --- /dev/null +++ b/node_modules/remark-stringify/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2014 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/remark-stringify/package.json b/node_modules/remark-stringify/package.json new file mode 100644 index 00000000..e152a656 --- /dev/null +++ b/node_modules/remark-stringify/package.json @@ -0,0 +1,71 @@ +{ + "name": "remark-stringify", + "version": "11.0.0", + "description": "remark plugin to add support for serializing markdown", + "license": "MIT", + "keywords": [ + "abstract", + "ast", + "compile", + "markdown", + "markdown", + "mdast", + "plugin", + "remark", + "remark-plugin", + "serialize", + "stringify", + "syntax", + "tree", + "unified" + ], + "homepage": "https://remark.js.org", + "repository": "https://github.com/remarkjs/remark/tree/main/packages/remark-stringify", + "bugs": "https://github.com/remarkjs/remark/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Eugene Sharygin <eush77@gmail.com>" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "scripts": {}, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/no-this-assignment": "off" + } + } +} diff --git a/node_modules/remark-stringify/readme.md b/node_modules/remark-stringify/readme.md new file mode 100644 index 00000000..fee71da4 --- /dev/null +++ b/node_modules/remark-stringify/readme.md @@ -0,0 +1,407 @@ +# remark-stringify + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**[remark][]** plugin to add support for serializing to markdown. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`unified().use(remarkStringify[, options])`](#unifieduseremarkstringify-options) +* [Syntax](#syntax) +* [Syntax tree](#syntax-tree) +* [Types](#types) +* [Security](#security) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [License](#license) + +## What is this? + +This package is a [unified][] ([remark][]) plugin that defines how to take a +syntax tree as input and turn it into serialized markdown. +When it’s used, markdown is serialized as the final result. + +See [the monorepo readme][remark] for info on what the remark ecosystem is. + +## When should I use this? + +This plugin adds support to unified for serializing markdown. +If you also need to parse markdown, you can alternatively use +[`remark`][remark-core], which combines unified, +[`remark-parse`][remark-parse], and this plugin. + +If you don’t use plugins and have access to a syntax tree, you can directly use +[`mdast-util-to-markdown`][mdast-util-to-markdown], which is used inside this +plugin. +remark focusses on making it easier to transform content by abstracting these +internals away. + +You can combine this plugin with other plugins to add syntax extensions. +Notable examples that deeply integrate with it are +[`remark-gfm`][remark-gfm], +[`remark-mdx`][remark-mdx], +[`remark-frontmatter`][remark-frontmatter], +[`remark-math`][remark-math], and +[`remark-directive`][remark-directive]. +You can also use any other [remark plugin][remark-plugin] before +`remark-stringify`. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install remark-stringify +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import remarkStringify from 'https://esm.sh/remark-stringify@11' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import remarkStringify from 'https://esm.sh/remark-stringify@11?bundle' +</script> +``` + +## Use + +Say we have the following module `example.js`: + +```js +import rehypeParse from 'rehype-parse' +import rehypeRemark from 'rehype-remark' +import remarkStringify from 'remark-stringify' +import {unified} from 'unified' + +const doc = ` +<h1>Uranus</h1> +<p><b>Uranus</b> is the seventh +<a href="/wiki/Planet" title="Planet">planet</a> from the Sun and is a gaseous +cyan <a href="/wiki/Ice_giant" title="Ice giant">ice giant</a>.</p> +` + +const file = await unified() + .use(rehypeParse) + .use(rehypeRemark) + .use(remarkStringify) + .process(doc) + +console.log(String(file)) +``` + +…then running `node example.js` yields: + +```markdown +# Uranus + +**Uranus** is the seventh [planet](/wiki/Planet "Planet") from the Sun and is a gaseous cyan [ice giant](/wiki/Ice_giant "Ice giant"). +``` + +## API + +This package exports no identifiers. +The default export is [`remarkStringify`][api-remark-stringify]. + +### `unified().use(remarkStringify[, options])` + +Add support for serializing to markdown. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Nothing (`undefined`). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `bullet` (`'*'`, `'+'`, or `'-'`, default: `'*'`) + — marker to use for bullets of items in unordered lists +* `bulletOther` (`'*'`, `'+'`, or `'-'`, default: `'-'` when `bullet` is + `'*'`, `'*'` otherwise) + — marker to use in certain cases where the primary bullet doesn’t work; + cannot be equal to `bullet` +* `bulletOrdered` (`'.'` or `')'`, default: `'.'`) + — marker to use for bullets of items in ordered lists +* `closeAtx` (`boolean`, default: `false`) + — add the same number of number signs (`#`) at the end of an ATX heading as + the opening sequence +* `emphasis` (`'*'` or `'_'`, default: `'*'`) + — marker to use for emphasis +* `fence` (``'`'`` or `'~'`, default: ``'`'``) + — marker to use for fenced code +* `fences` (`boolean`, default: `true`) + — use fenced code always; when `false`, uses fenced code if there is a + language defined, if the code is empty, or if it starts or ends in blank + lines +* `handlers` (`Handlers`, optional) + — handle particular nodes; + see [`mdast-util-to-markdown`][mdast-util-to-markdown] for more info +* `incrementListMarker` (`boolean`, default: `true`) + — increment the counter of ordered lists items +* `join` (`Array<Join>`, optional) + — how to join blocks; + see [`mdast-util-to-markdown`][mdast-util-to-markdown] for more info +* `listItemIndent` (`'mixed'`, `'one'`, or `'tab'`, default: `'one'`) + — how to indent the content of list items; + either with the size of the bullet plus one space (when `'one'`), a tab + stop (`'tab'`), or depending on the item and its parent list: `'mixed'` + uses `'one'` if the item and list are tight and `'tab'` otherwise +* `quote` (`'"'` or `"'"`, default: `'"'`) + — marker to use for titles +* `resourceLink` (`boolean`, default: `false`) + — always use resource links (`[text](url)`); + when `false`, uses autolinks (`<https://example.com>`) when possible +* `rule` (`'*'`, `'-'`, or `'_'`, default: `'*'`) + — marker to use for thematic breaks +* `ruleRepetition` (`number`, default: `3`, min: `3`) + — number of markers to use for thematic breaks +* `ruleSpaces` (`boolean`, default: `false`) + — add spaces between markers in thematic breaks +* `setext` (`boolean`, default: `false`) + — use setext headings when possible; + when `true`, uses setext headings (`heading\n=======`) for non-empty rank 1 + or 2 headings +* `strong` (`'*'` or `'_'`, default: `'*'`) + — marker to use for strong +* `tightDefinitions` (`boolean`, default: `false`) + — join definitions without a blank line +* `unsafe` (`Array<Unsafe>`, optional) + — schemas that define when characters cannot occur; + see [`mdast-util-to-markdown`][mdast-util-to-markdown] for more info + +<!-- Note: `extensions` intentionally not supported/documented. --> + +## Syntax + +Markdown is serialized according to CommonMark but care is taken to format in a +way that works with most markdown parsers. +Other plugins can add support for syntax extensions. + +## Syntax tree + +The syntax tree used in remark is [mdast][]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +It also registers `Settings` with `unified`. +If you’re passing options with `.data('settings', …)`, make sure to import this +package somewhere in your types, as that registers the fields. + +```js +/// <reference types="remark-stringify" /> + +import {unified} from 'unified' + +// @ts-expect-error: `thisDoesNotExist` is not a valid option. +unified().data('settings', {thisDoesNotExist: false}) +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `remark-stringify@^11`, +compatible with Node.js 16. + +## Security + +Use of `remark-stringify` is safe. + +Use of remark plugins can open you up to attacks. +Carefully assess each plugin and the risks involved in using them. + +For info on how to submit a report, see our [security policy][security]. + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. +Join us in [Discussions][chat] to chat with the community and contributors. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## Sponsor + +Support this effort and give back by sponsoring on [OpenCollective][collective]! + +<table> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +<td width="10%"></td> +<td width="10%"></td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="8"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/remarkjs/remark/workflows/main/badge.svg + +[build]: https://github.com/remarkjs/remark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage]: https://codecov.io/github/remarkjs/remark + +[downloads-badge]: https://img.shields.io/npm/dm/remark-stringify.svg + +[downloads]: https://www.npmjs.com/package/remark-stringify + +[size-badge]: https://img.shields.io/bundlejs/size/remark-stringify + +[size]: https://bundlejs.com/?q=remark-stringify + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[security]: https://github.com/remarkjs/.github/blob/main/security.md + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/main/support.md + +[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark/blob/main/license + +[author]: https://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[mdast]: https://github.com/syntax-tree/mdast + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[remark]: https://github.com/remarkjs/remark + +[remark-core]: ../remark/ + +[remark-directive]: https://github.com/remarkjs/remark-directive + +[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[remark-math]: https://github.com/remarkjs/remark-math + +[remark-mdx]: https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx + +[remark-parse]: ../remark-parse/ + +[remark-plugin]: https://github.com/remarkjs/remark#plugin + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[api-options]: #options + +[api-remark-stringify]: #unifieduseremarkstringify-options diff --git a/node_modules/space-separated-tokens/index.d.ts b/node_modules/space-separated-tokens/index.d.ts new file mode 100644 index 00000000..fe504d81 --- /dev/null +++ b/node_modules/space-separated-tokens/index.d.ts @@ -0,0 +1,18 @@ +/** + * Parse space-separated tokens to an array of strings. + * + * @param {string} value + * Space-separated tokens. + * @returns {Array<string>} + * List of tokens. + */ +export function parse(value: string): Array<string> +/** + * Serialize an array of strings as space separated-tokens. + * + * @param {Array<string|number>} values + * List of tokens. + * @returns {string} + * Space-separated tokens. + */ +export function stringify(values: Array<string | number>): string diff --git a/node_modules/space-separated-tokens/index.js b/node_modules/space-separated-tokens/index.js new file mode 100644 index 00000000..18810b1a --- /dev/null +++ b/node_modules/space-separated-tokens/index.js @@ -0,0 +1,24 @@ +/** + * Parse space-separated tokens to an array of strings. + * + * @param {string} value + * Space-separated tokens. + * @returns {Array<string>} + * List of tokens. + */ +export function parse(value) { + const input = String(value || '').trim() + return input ? input.split(/[ \t\n\r\f]+/g) : [] +} + +/** + * Serialize an array of strings as space separated-tokens. + * + * @param {Array<string|number>} values + * List of tokens. + * @returns {string} + * Space-separated tokens. + */ +export function stringify(values) { + return values.join(' ').trim() +} diff --git a/node_modules/space-separated-tokens/license b/node_modules/space-separated-tokens/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/space-separated-tokens/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/space-separated-tokens/package.json b/node_modules/space-separated-tokens/package.json new file mode 100644 index 00000000..f0c5c9bb --- /dev/null +++ b/node_modules/space-separated-tokens/package.json @@ -0,0 +1,67 @@ +{ + "name": "space-separated-tokens", + "version": "2.0.2", + "description": "Parse and stringify space separated tokens", + "license": "MIT", + "keywords": [ + "dom", + "html", + "space", + "separated", + "tokens", + "parse", + "stringify" + ], + "repository": "wooorm/space-separated-tokens", + "bugs": "https://github.com/wooorm/space-separated-tokens/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^18.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.52.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + } +} diff --git a/node_modules/space-separated-tokens/readme.md b/node_modules/space-separated-tokens/readme.md new file mode 100644 index 00000000..eb187d36 --- /dev/null +++ b/node_modules/space-separated-tokens/readme.md @@ -0,0 +1,156 @@ +# space-separated-tokens + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Parse and stringify space-separated tokens. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`parse(value)`](#parsevalue) + * [`stringify(values)`](#stringifyvalues) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [Security](#security) +* [License](#license) + +## What is this? + +This is a tiny package that can parse and stringify space-separated tokens, as +used for example in the HTML `class` attribute, according to the +[WHATWG spec][spec]. + +## When should I use this? + +This package is rather niche, it’s low-level and particularly useful when +working with [hast][]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install space-separated-tokens +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {parse, stringify} from 'https://esm.sh/space-separated-tokens@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {parse, stringify} from 'https://esm.sh/space-separated-tokens@2?bundle' +</script> +``` + +## Use + +```js +import {parse, stringify} from 'space-separated-tokens' + +parse(' foo\tbar\nbaz ') +//=> ['foo', 'bar', 'baz'] + +stringify(['foo', 'bar', 'baz']) +//=> 'foo bar baz' +``` + +## API + +This package exports the identifiers `parse` and `stringify`. +There is no default export. + +### `parse(value)` + +Parse space-separated tokens (`string`) to an array of strings +(`Array<string>`), according to the [WHATWG spec][spec]. + +### `stringify(values)` + +Serialize an array of strings or numbers (`Array<string|number>`) to +space-separated tokens (`string`). + +> 👉 **Note**: it’s not possible to specify empty or whitespace only values. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Related + +* [`comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens) + — parse/stringify comma-separated tokens +* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space) + — replace multiple white-space characters with a single space +* [`property-information`](https://github.com/wooorm/property-information) + — info on HTML properties + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## Security + +This package is safe. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definition --> + +[build-badge]: https://github.com/wooorm/space-separated-tokens/workflows/main/badge.svg + +[build]: https://github.com/wooorm/space-separated-tokens/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/space-separated-tokens.svg + +[coverage]: https://codecov.io/github/wooorm/space-separated-tokens + +[downloads-badge]: https://img.shields.io/npm/dm/space-separated-tokens.svg + +[downloads]: https://www.npmjs.com/package/space-separated-tokens + +[size-badge]: https://img.shields.io/bundlephobia/minzip/space-separated-tokens.svg + +[size]: https://bundlephobia.com/result?p=space-separated-tokens + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[license]: license + +[author]: https://wooorm.com + +[spec]: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#space-separated-tokens + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/stringify-entities/index.d.ts b/node_modules/stringify-entities/index.d.ts new file mode 100644 index 00000000..512bf89b --- /dev/null +++ b/node_modules/stringify-entities/index.d.ts @@ -0,0 +1,3 @@ +export * from "./lib/index.js"; +export type LightOptions = import('./lib/index.js').LightOptions; +export type Options = import('./lib/index.js').Options; diff --git a/node_modules/stringify-entities/index.js b/node_modules/stringify-entities/index.js new file mode 100644 index 00000000..2834f13d --- /dev/null +++ b/node_modules/stringify-entities/index.js @@ -0,0 +1,6 @@ +/** + * @typedef {import('./lib/index.js').LightOptions} LightOptions + * @typedef {import('./lib/index.js').Options} Options + */ + +export * from './lib/index.js' diff --git a/node_modules/stringify-entities/license b/node_modules/stringify-entities/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/stringify-entities/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <mailto:tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/stringify-entities/package.json b/node_modules/stringify-entities/package.json new file mode 100644 index 00000000..ba14d0c3 --- /dev/null +++ b/node_modules/stringify-entities/package.json @@ -0,0 +1,86 @@ +{ + "name": "stringify-entities", + "version": "4.0.4", + "description": "Serialize (encode) HTML character references", + "license": "MIT", + "keywords": [ + "stringify", + "encode", + "escape", + "html", + "character", + "reference", + "entity", + "entities" + ], + "repository": "wooorm/stringify-entities", + "bugs": "https://github.com/wooorm/stringify-entities/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^9.0.0", + "character-entities": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "generate": "node --conditions development build.js", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off", + "unicorn/prefer-string-replace-all": "off", + "unicorn/numeric-separators-style": "off" + } + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true + } +} diff --git a/node_modules/stringify-entities/readme.md b/node_modules/stringify-entities/readme.md new file mode 100644 index 00000000..3c319091 --- /dev/null +++ b/node_modules/stringify-entities/readme.md @@ -0,0 +1,233 @@ +# stringify-entities + +[![Build Status][build-badge]][build] +[![Coverage Status][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Serialize (encode) HTML character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`stringifyEntities(value[, options])`](#stringifyentitiesvalue-options) +* [Algorithm](#algorithm) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a small and powerful encoder of HTML character references (often called +entities). +This one has either all the options you need for a minifier/formatter, or a +tiny size when using `stringifyEntitiesLight`. + +## When should I use this? + +You can use this for spec-compliant encoding of character references. +It’s small and fast enough to do that well. +You can also use this when making an HTML formatter or minifier, because there +are different ways to produce pretty or tiny output. +This package is reliable: ``'`'`` characters are encoded to ensure no scripts +run in Internet Explorer 6 to 8. +Additionally, only named references recognized by HTML 4 are encoded, meaning +the infamous `&apos;` (which people think is a [virus][]) won’t show up. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install stringify-entities +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {stringifyEntities} from 'https://esm.sh/stringify-entities@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {stringifyEntities} from 'https://esm.sh/stringify-entities@4?bundle' +</script> +``` + +## Use + +```js +import {stringifyEntities} from 'stringify-entities' + +stringifyEntities('alpha © bravo ≠ charlie 𝌆 delta') +// => 'alpha &#xA9; bravo &#x2260; charlie &#x1D306; delta' + +stringifyEntities('alpha © bravo ≠ charlie 𝌆 delta', {useNamedReferences: true}) +// => 'alpha &copy; bravo &ne; charlie &#x1D306; delta' +``` + +## API + +This package exports the identifiers `stringifyEntities` and +`stringifyEntitiesLight`. +There is no default export. + +### `stringifyEntities(value[, options])` + +Encode special characters in `value`. + +##### Core options + +###### `options.escapeOnly` + +Whether to only escape possibly dangerous characters (`boolean`, default: +`false`). +Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``. + +###### `options.subset` + +Whether to only escape the given subset of characters (`Array<string>`). +Note that only BMP characters are supported here (so no emoji). + +##### Formatting options + +If you do not care about the following options, use `stringifyEntitiesLight`, +which always outputs hexadecimal character references. + +###### `options.useNamedReferences` + +Prefer named character references (`&amp;`) where possible (`boolean?`, default: +`false`). + +###### `options.useShortestReferences` + +Prefer the shortest possible reference, if that results in less bytes +(`boolean?`, default: `false`). + +> ⚠️ **Note**: `useNamedReferences` can be omitted when using +> `useShortestReferences`. + +###### `options.omitOptionalSemicolons` + +Whether to omit semicolons when possible (`boolean?`, default: `false`). + +> ⚠️ **Note**: This creates what HTML calls “parse errors” but is otherwise +> still valid HTML — don’t use this except when building a minifier. +> Omitting semicolons is possible for certain named and numeric references in +> some cases. + +###### `options.attribute` + +Create character references which don’t fail in attributes (`boolean?`, default: +`false`). + +> ⚠️ **Note**: `attribute` only applies when operating dangerously with +> `omitOptionalSemicolons: true`. + +#### Returns + +Encoded value (`string`). + +## Algorithm + +By default, all dangerous, non-ASCII, and non-printable ASCII characters are +encoded. +A [subset][] of characters can be given to encode just those characters. +Alternatively, pass [`escapeOnly`][escapeonly] to escape just the dangerous +characters (`"`, `'`, `<`, `>`, `&`, `` ` ``). +By default, hexadecimal character references are used. +Pass [`useNamedReferences`][named] to use named character references when +possible, or [`useShortestReferences`][short] to use whichever is shortest: +decimal, hexadecimal, or named. +There is also a `stringifyEntitiesLight` export, which works just like +`stringifyEntities` but without the formatting options: it’s much smaller but +always outputs hexadecimal character references. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types `Options` and `LightOptions` types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Related + +* [`parse-entities`](https://github.com/wooorm/parse-entities) + — parse (decode) HTML character references +* [`wooorm/character-entities`](https://github.com/wooorm/character-entities) + — info on character references +* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — info on HTML 4 character references +* [`wooorm/character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — info on legacy character references +* [`wooorm/character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — info on invalid numeric character references + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/wooorm/stringify-entities/workflows/main/badge.svg + +[build]: https://github.com/wooorm/stringify-entities/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/stringify-entities.svg + +[coverage]: https://codecov.io/github/wooorm/stringify-entities + +[downloads-badge]: https://img.shields.io/npm/dm/stringify-entities.svg + +[downloads]: https://www.npmjs.com/package/stringify-entities + +[size-badge]: https://img.shields.io/bundlephobia/minzip/stringify-entities.svg + +[size]: https://bundlephobia.com/result?p=stringify-entities + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[virus]: https://www.telegraph.co.uk/technology/advice/10516839/Why-do-some-apostrophes-get-replaced-with-andapos.html + +[subset]: #optionssubset + +[escapeonly]: #optionsescapeonly + +[named]: #optionsusenamedreferences + +[short]: #optionsuseshortestreferences diff --git a/node_modules/style-to-js/LICENSE b/node_modules/style-to-js/LICENSE new file mode 100644 index 00000000..09562a52 --- /dev/null +++ b/node_modules/style-to-js/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2020 Menglin "Mark" Xu <mark@remarkablemark.org> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/style-to-js/README.md b/node_modules/style-to-js/README.md new file mode 100644 index 00000000..210ce8a6 --- /dev/null +++ b/node_modules/style-to-js/README.md @@ -0,0 +1,271 @@ +# style-to-js + +[![NPM](https://nodei.co/npm/style-to-js.png)](https://nodei.co/npm/style-to-js/) + +[![NPM version](https://img.shields.io/npm/v/style-to-js)](https://www.npmjs.com/package/style-to-js) +[![BNPM bundle size](https://img.shields.io/bundlephobia/minzip/style-to-js)](https://bundlephobia.com/package/style-to-js) +[![build](https://github.com/remarkablemark/style-to-js/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/style-to-js/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/remarkablemark/style-to-js/branch/master/graph/badge.svg?token=JWKUKTFT3E)](https://codecov.io/gh/remarkablemark/style-to-js) +[![NPM downloads](https://img.shields.io/npm/dm/style-to-js)](https://www.npmjs.com/package/style-to-js) + +Parses CSS inline style to JavaScript object (camelCased): + +``` +StyleToJS(string) +``` + +## Example + +```js +import parse from 'style-to-js'; + +parse('background-color: #BADA55;'); +``` + +Output: + +```json +{ "backgroundColor": "#BADA55" } +``` + +[JSFiddle](https://jsfiddle.net/remarkablemark/04nob1y7/) | [Examples](https://github.com/remarkablemark/style-to-js/tree/master/examples) + +## Install + +[NPM](https://www.npmjs.com/package/style-to-js): + +```sh +npm install style-to-js --save +``` + +[Yarn](https://yarnpkg.com/package/style-to-js): + +```sh +yarn add style-to-js +``` + +[CDN](https://unpkg.com/style-to-js/): + +```html +<script src="https://unpkg.com/style-to-js@latest/umd/style-to-js.min.js"></script> +<script> + window.StyleToJS(/* string */); +</script> +``` + +## Usage + +### Import + +Import with ES Modules: + +```js +import parse from 'style-to-js'; +``` + +Require with CommonJS: + +```js +const parse = require('style-to-js'); +``` + +### Parse style + +Parse single declaration: + +```js +parse('line-height: 42'); +``` + +Output: + +```json +{ "lineHeight": "42" } +``` + +> [!NOTE] +> Notice that the CSS property is camelCased. + +Parse multiple declarations: + +```js +parse(` + border-color: #ACE; + z-index: 1337; +`); +``` + +Output: + +```json +{ + "borderColor": "#ACE", + "zIndex": "1337" +} +``` + +### Vendor prefix + +Parse [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix): + +```js +parse(` + -webkit-transition: all 4s ease; + -moz-transition: all 4s ease; + -ms-transition: all 4s ease; + -o-transition: all 4s ease; + -khtml-transition: all 4s ease; +`); +``` + +Output: + +```json +{ + "webkitTransition": "all 4s ease", + "mozTransition": "all 4s ease", + "msTransition": "all 4s ease", + "oTransition": "all 4s ease", + "khtmlTransition": "all 4s ease" +} +``` + +### Custom property + +Parse [custom property](https://developer.mozilla.org/en-US/docs/Web/CSS/--*): + +```js +parse('--custom-property: #f00'); +``` + +Output: + +```json +{ "--custom-property": "#f00" } +``` + +### Unknown declaration + +This library does not validate declarations, so unknown declarations can be parsed: + +```js +parse('the-answer: 42;'); +``` + +Output: + +```json +{ "theAnswer": "42" } +``` + +### Invalid declaration + +Declarations with missing value are removed: + +```js +parse(` + margin-top: ; + margin-right: 1em; +`); +``` + +Output: + +```json +{ "marginRight": "1em" } +``` + +Other invalid declarations or arguments: + +```js +parse(); // {} +parse(null); // {} +parse(1); // {} +parse(true); // {} +parse('top:'); // {} +parse(':12px'); // {} +parse(':'); // {} +parse(';'); // {} +``` + +The following values will throw an error: + +```js +parse('top'); // Uncaught Error: property missing ':' +parse('/*'); // Uncaught Error: End of comment missing +``` + +### Options + +#### reactCompat + +When option `reactCompat` is true, the [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) will be capitalized: + +```js +parse( + ` + -webkit-transition: all 4s ease; + -moz-transition: all 4s ease; + -ms-transition: all 4s ease; + -o-transition: all 4s ease; + -khtml-transition: all 4s ease; + `, + { reactCompat: true }, +); +``` + +Output: + +```json +{ + "WebkitTransition": "all 4s ease", + "MozTransition": "all 4s ease", + "msTransition": "all 4s ease", + "OTransition": "all 4s ease", + "KhtmlTransition": "all 4s ease" +} +``` + +This removes the React warning: + +``` +Warning: Unsupported vendor-prefixed style property %s. Did you mean %s?%s", "oTransition", "OTransition" +``` + +## Testing + +Run tests with coverage: + +```sh +npm test +``` + +Run tests in watch mode: + +```sh +npm run test:watch +``` + +Lint files: + +```sh +npm run lint +``` + +Fix lint errors: + +```sh +npm run lint:fix +``` + +## Release + +Release and publish are automated by [Release Please](https://github.com/googleapis/release-please). + +## Special Thanks + +- [style-to-object](https://github.com/remarkablemark/style-to-object) + +## License + +[MIT](https://github.com/remarkablemark/style-to-js/blob/master/LICENSE) diff --git a/node_modules/style-to-js/cjs/index.d.ts b/node_modules/style-to-js/cjs/index.d.ts new file mode 100644 index 00000000..dc864a60 --- /dev/null +++ b/node_modules/style-to-js/cjs/index.d.ts @@ -0,0 +1,14 @@ +import { CamelCaseOptions } from './utilities'; +type StyleObject = Record<string, string>; +interface StyleToJSOptions extends CamelCaseOptions { +} +/** + * Parses CSS inline style to JavaScript object (camelCased). + */ +declare function StyleToJS(style: string, options?: StyleToJSOptions): StyleObject; +declare namespace StyleToJS { + var _a: typeof StyleToJS; + export { _a as default }; +} +export = StyleToJS; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/index.d.ts.map b/node_modules/style-to-js/cjs/index.d.ts.map new file mode 100644 index 00000000..fd882d60 --- /dev/null +++ b/node_modules/style-to-js/cjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,UAAU,gBAAiB,SAAQ,gBAAgB;CAAG;AAEtD;;GAEG;AACH,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAezE;kBAfQ,SAAS;;;;AAmBlB,SAAS,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/index.js b/node_modules/style-to-js/cjs/index.js new file mode 100644 index 00000000..557407e5 --- /dev/null +++ b/node_modules/style-to-js/cjs/index.js @@ -0,0 +1,25 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var style_to_object_1 = __importDefault(require("style-to-object")); +var utilities_1 = require("./utilities"); +/** + * Parses CSS inline style to JavaScript object (camelCased). + */ +function StyleToJS(style, options) { + var output = {}; + if (!style || typeof style !== 'string') { + return output; + } + (0, style_to_object_1.default)(style, function (property, value) { + // skip CSS comment + if (property && value) { + output[(0, utilities_1.camelCase)(property, options)] = value; + } + }); + return output; +} +StyleToJS.default = StyleToJS; +module.exports = StyleToJS; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/index.js.map b/node_modules/style-to-js/cjs/index.js.map new file mode 100644 index 00000000..1a9b2992 --- /dev/null +++ b/node_modules/style-to-js/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oEAA4C;AAE5C,yCAA0D;AAM1D;;GAEG;AACH,SAAS,SAAS,CAAC,KAAa,EAAE,OAA0B;IAC1D,IAAM,MAAM,GAAgB,EAAE,CAAC;IAE/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAA,yBAAa,EAAC,KAAK,EAAE,UAAC,QAAQ,EAAE,KAAK;QACnC,mBAAmB;QACnB,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC;AAE9B,iBAAS,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/utilities.d.ts b/node_modules/style-to-js/cjs/utilities.d.ts new file mode 100644 index 00000000..6743592d --- /dev/null +++ b/node_modules/style-to-js/cjs/utilities.d.ts @@ -0,0 +1,11 @@ +/** + * CamelCase options. + */ +export interface CamelCaseOptions { + reactCompat?: boolean; +} +/** + * CamelCases a CSS property. + */ +export declare const camelCase: (property: string, options?: CamelCaseOptions) => string; +//# sourceMappingURL=utilities.d.ts.map \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/utilities.d.ts.map b/node_modules/style-to-js/cjs/utilities.d.ts.map new file mode 100644 index 00000000..783a74c4 --- /dev/null +++ b/node_modules/style-to-js/cjs/utilities.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAyBA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,EAAE,UAAS,gBAAqB,WAgBzE,CAAC"} \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/utilities.js b/node_modules/style-to-js/cjs/utilities.js new file mode 100644 index 00000000..10ad55ad --- /dev/null +++ b/node_modules/style-to-js/cjs/utilities.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.camelCase = void 0; +var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/; +var HYPHEN_REGEX = /-([a-z])/g; +var NO_HYPHEN_REGEX = /^[^-]+$/; +var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/; +var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/; +/** + * Checks whether to skip camelCase. + */ +var skipCamelCase = function (property) { + return !property || + NO_HYPHEN_REGEX.test(property) || + CUSTOM_PROPERTY_REGEX.test(property); +}; +/** + * Replacer that capitalizes first character. + */ +var capitalize = function (match, character) { + return character.toUpperCase(); +}; +/** + * Replacer that removes beginning hyphen of vendor prefix property. + */ +var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); }; +/** + * CamelCases a CSS property. + */ +var camelCase = function (property, options) { + if (options === void 0) { options = {}; } + if (skipCamelCase(property)) { + return property; + } + property = property.toLowerCase(); + if (options.reactCompat) { + // `-ms` vendor prefix should not be capitalized + property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen); + } + else { + // for non-React, remove first hyphen so vendor prefix is not capitalized + property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen); + } + return property.replace(HYPHEN_REGEX, capitalize); +}; +exports.camelCase = camelCase; +//# sourceMappingURL=utilities.js.map \ No newline at end of file diff --git a/node_modules/style-to-js/cjs/utilities.js.map b/node_modules/style-to-js/cjs/utilities.js.map new file mode 100644 index 00000000..111ab54b --- /dev/null +++ b/node_modules/style-to-js/cjs/utilities.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":";;;AAAA,IAAM,qBAAqB,GAAG,oBAAoB,CAAC;AACnD,IAAM,YAAY,GAAG,WAAW,CAAC;AACjC,IAAM,eAAe,GAAG,SAAS,CAAC;AAClC,IAAM,mBAAmB,GAAG,4BAA4B,CAAC;AACzD,IAAM,sBAAsB,GAAG,SAAS,CAAC;AAEzC;;GAEG;AACH,IAAM,aAAa,GAAG,UAAC,QAAgB;IACrC,OAAA,CAAC,QAAQ;QACT,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC9B,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC;AAFpC,CAEoC,CAAC;AAEvC;;GAEG;AACH,IAAM,UAAU,GAAG,UAAC,KAAa,EAAE,SAAiB;IAClD,OAAA,SAAS,CAAC,WAAW,EAAE;AAAvB,CAAuB,CAAC;AAE1B;;GAEG;AACH,IAAM,UAAU,GAAG,UAAC,KAAa,EAAE,MAAc,IAAK,OAAA,UAAG,MAAM,MAAG,EAAZ,CAAY,CAAC;AASnE;;GAEG;AACI,IAAM,SAAS,GAAG,UAAC,QAAgB,EAAE,OAA8B;IAA9B,wBAAA,EAAA,YAA8B;IACxE,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAElC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,gDAAgD;QAChD,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,yEAAyE;QACzE,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACpD,CAAC,CAAC;AAhBW,QAAA,SAAS,aAgBpB"} \ No newline at end of file diff --git a/node_modules/style-to-js/package.json b/node_modules/style-to-js/package.json new file mode 100644 index 00000000..896f04d5 --- /dev/null +++ b/node_modules/style-to-js/package.json @@ -0,0 +1,70 @@ +{ + "name": "style-to-js", + "version": "1.1.21", + "description": "Parses CSS inline style to JavaScript object (camelCased).", + "author": "Mark <mark@remarkablemark.org>", + "main": "cjs/index.js", + "scripts": { + "build": "npm run build:cjs && npm run build:umd", + "build:cjs": "tsc --declaration --outDir cjs", + "build:umd": "rollup --config --failAfterWarnings", + "clean": "rm -rf cjs umd", + "lint": "eslint .", + "lint:tsc": "tsc --noEmit", + "lint:fix": "npm run lint -- --fix", + "prepare": "husky", + "prepublishOnly": "npm run lint && npm run lint:tsc && npm run test:ci && npm run clean && npm run build", + "test": "jest", + "test:ci": "CI=true jest --ci --colors --coverage", + "test:watch": "jest --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/remarkablemark/style-to-js.git" + }, + "bugs": { + "url": "https://github.com/remarkablemark/style-to-js/issues" + }, + "keywords": [ + "style-to-js", + "css", + "style", + "javascript", + "object", + "pojo" + ], + "dependencies": { + "style-to-object": "1.0.14" + }, + "devDependencies": { + "@commitlint/cli": "20.1.0", + "@commitlint/config-conventional": "20.0.0", + "@eslint/compat": "2.0.0", + "@eslint/eslintrc": "3.3.1", + "@eslint/js": "9.39.1", + "@rollup/plugin-commonjs": "29.0.0", + "@rollup/plugin-node-resolve": "16.0.3", + "@rollup/plugin-terser": "0.4.4", + "@types/jest": "30.0.0", + "@typescript-eslint/eslint-plugin": "8.46.4", + "@typescript-eslint/parser": "8.46.4", + "eslint": "9.39.1", + "eslint-plugin-prettier": "5.5.4", + "eslint-plugin-simple-import-sort": "12.1.1", + "globals": "16.5.0", + "husky": "9.1.7", + "jest": "30.2.0", + "lint-staged": "16.2.6", + "prettier": "3.6.2", + "rollup": "4.53.2", + "ts-jest": "29.4.5", + "ts-node": "10.9.2", + "typescript": "5.9.3" + }, + "files": [ + "cjs/", + "src/", + "umd/" + ], + "license": "MIT" +} diff --git a/node_modules/style-to-js/src/index.test.ts b/node_modules/style-to-js/src/index.test.ts new file mode 100644 index 00000000..169eba36 --- /dev/null +++ b/node_modules/style-to-js/src/index.test.ts @@ -0,0 +1,129 @@ +import styleToJS = require('.'); + +it('exposes itself as default', () => { + expect(styleToJS).toBe(styleToJS.default); +}); + +it('parses empty style to object', () => { + expect(styleToJS('')).toEqual({}); +}); + +it('does not parse CSS comment', () => { + expect(styleToJS('/* comment */')).toEqual({}); +}); + +// invalid argument +it.each([undefined, null, 0, 1, true, false, {}, [], () => {}, new Date()])( + 'parses "%s" to empty object', + (text) => { + expect(styleToJS(text as string)).toEqual({}); + }, +); + +it.each(['top:', ':12px', ':', ';'])('parses "%s" to empty object', (text) => { + expect(styleToJS(text)).toEqual({}); +}); + +it('parses common styles to object', () => { + const style = ` + color: #f00; + font-size: 42px; + z-index: -1; + `; + expect(styleToJS(style)).toMatchInlineSnapshot(` + { + "color": "#f00", + "fontSize": "42px", + "zIndex": "-1", + } + `); +}); + +it('parses style with vendor prefix to object', () => { + const style = ` + display: -ms-grid; + display: grid; + -webkit-transition: all .5s; + -o-transition: all .5s; + transition: all .5s; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background: -webkit-gradient(linear, left top, left bottom, from(white), to(black)); + background: -o-linear-gradient(top, white, black); + background: linear-gradient(to bottom, white, black); + `; + expect(styleToJS(style)).toMatchInlineSnapshot(` + { + "background": "linear-gradient(to bottom, white, black)", + "display": "grid", + "mozUserSelect": "none", + "msUserSelect": "none", + "oTransition": "all .5s", + "transition": "all .5s", + "userSelect": "none", + "webkitTransition": "all .5s", + "webkitUserSelect": "none", + } + `); +}); + +it('parses background style to object', () => { + const style = + 'background: url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif)'; + expect(styleToJS(style)).toMatchInlineSnapshot(` + { + "background": "url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif)", + } + `); +}); + +it('parses style with no spaces to object', () => { + const style = + 'border-bottom-left-radius:1em;border-right-style:solid;Z-Index:-1;-moz-border-radius-bottomleft:20px'; + expect(styleToJS(style)).toMatchInlineSnapshot(` + { + "borderBottomLeftRadius": "1em", + "borderRightStyle": "solid", + "mozBorderRadiusBottomleft": "20px", + "zIndex": "-1", + } + `); +}); + +describe('when option reactCompat is true', () => { + const options = { reactCompat: true }; + + it('capitalizes vendor prefixes', () => { + const style = ` + -khtml-user-select: none; + -moz-user-select: -moz-none; + -o-user-select: none; + -webkit-user-select: none; + user-select: none; + `; + expect(styleToJS(style, options)).toMatchInlineSnapshot(` + { + "KhtmlUserSelect": "none", + "MozUserSelect": "-moz-none", + "OUserSelect": "none", + "WebkitUserSelect": "none", + "userSelect": "none", + } + `); + }); + + it('does not capitalize ms prefixes', () => { + const style = ` + -ms-transform: none; + -ms-user-select: none; + `; + expect(styleToJS(style, options)).toMatchInlineSnapshot(` + { + "msTransform": "none", + "msUserSelect": "none", + } + `); + }); +}); diff --git a/node_modules/style-to-js/src/index.ts b/node_modules/style-to-js/src/index.ts new file mode 100644 index 00000000..9e53ded3 --- /dev/null +++ b/node_modules/style-to-js/src/index.ts @@ -0,0 +1,31 @@ +import StyleToObject from 'style-to-object'; + +import { camelCase, CamelCaseOptions } from './utilities'; + +type StyleObject = Record<string, string>; + +interface StyleToJSOptions extends CamelCaseOptions {} + +/** + * Parses CSS inline style to JavaScript object (camelCased). + */ +function StyleToJS(style: string, options?: StyleToJSOptions): StyleObject { + const output: StyleObject = {}; + + if (!style || typeof style !== 'string') { + return output; + } + + StyleToObject(style, (property, value) => { + // skip CSS comment + if (property && value) { + output[camelCase(property, options)] = value; + } + }); + + return output; +} + +StyleToJS.default = StyleToJS; + +export = StyleToJS; diff --git a/node_modules/style-to-js/src/utilities.test.ts b/node_modules/style-to-js/src/utilities.test.ts new file mode 100644 index 00000000..adbcdc9b --- /dev/null +++ b/node_modules/style-to-js/src/utilities.test.ts @@ -0,0 +1,62 @@ +import { camelCase } from './utilities'; + +describe('camelCase', () => { + it('returns "" for empty string', () => { + expect(camelCase('')).toBe(''); + }); + + // no hyphen + it.each([ + ['foo', 'foo'], + ['fooBar', 'fooBar'], + ])('does not transform "%s"', (property, expected) => { + expect(camelCase(property)).toBe(expected); + }); + + // custom property + it.each([ + ['--fooBar', '--fooBar'], + ['--foo-bar', '--foo-bar'], + ['--foo-100', '--foo-100'], + ['--test_ing', '--test_ing'], + ])('does not transform custom property "%s"', (property, expected) => { + expect(camelCase(property)).toBe(expected); + }); + + // vendor prefix + it.each([ + ['-khtml-transition', 'khtmlTransition'], + ['-moz-user-select', 'mozUserSelect'], + ['-ms-transform', 'msTransform'], + ['-ms-user-select', 'msUserSelect'], + ['-o-transition', 'oTransition'], + ['-webkit-transition', 'webkitTransition'], + ['-webkit-user-select', 'webkitUserSelect'], + ])('transforms vendor prefix "%s" to "%s"', (property, expected) => { + expect(camelCase(property)).toBe(expected); + }); + + it.each([ + ['foo-bar', 'fooBar'], + ['foo-bar-baz', 'fooBarBaz'], + ['CAMEL-CASE', 'camelCase'], + ])('transforms "%s" to "%s"', (property, expected) => { + expect(camelCase(property)).toBe(expected); + }); + + describe('option reactCompat is true', () => { + const options = { reactCompat: true }; + + it.each([ + ['-khtml-transition', 'KhtmlTransition'], + ['-o-transition', 'OTransition'], + ['-moz-user-select', 'MozUserSelect'], + ['-ms-transform', 'msTransform'], + ['-ms-user-select', 'msUserSelect'], + ['-webkit-transition', 'WebkitTransition'], + ['-webkit-user-select', 'WebkitUserSelect'], + ])('capitalizes vendor prefix "%s" to "%s"', (property, expected) => { + expect(camelCase(property, options)).toBe(expected); + }); + }); +}); diff --git a/node_modules/style-to-js/src/utilities.ts b/node_modules/style-to-js/src/utilities.ts new file mode 100644 index 00000000..a5bd6027 --- /dev/null +++ b/node_modules/style-to-js/src/utilities.ts @@ -0,0 +1,52 @@ +const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/; +const HYPHEN_REGEX = /-([a-z])/g; +const NO_HYPHEN_REGEX = /^[^-]+$/; +const VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/; +const MS_VENDOR_PREFIX_REGEX = /^-(ms)-/; + +/** + * Checks whether to skip camelCase. + */ +const skipCamelCase = (property: string) => + !property || + NO_HYPHEN_REGEX.test(property) || + CUSTOM_PROPERTY_REGEX.test(property); + +/** + * Replacer that capitalizes first character. + */ +const capitalize = (match: string, character: string) => + character.toUpperCase(); + +/** + * Replacer that removes beginning hyphen of vendor prefix property. + */ +const trimHyphen = (match: string, prefix: string) => `${prefix}-`; + +/** + * CamelCase options. + */ +export interface CamelCaseOptions { + reactCompat?: boolean; +} + +/** + * CamelCases a CSS property. + */ +export const camelCase = (property: string, options: CamelCaseOptions = {}) => { + if (skipCamelCase(property)) { + return property; + } + + property = property.toLowerCase(); + + if (options.reactCompat) { + // `-ms` vendor prefix should not be capitalized + property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen); + } else { + // for non-React, remove first hyphen so vendor prefix is not capitalized + property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen); + } + + return property.replace(HYPHEN_REGEX, capitalize); +}; diff --git a/node_modules/style-to-js/umd/style-to-js.js b/node_modules/style-to-js/umd/style-to-js.js new file mode 100644 index 00000000..e2d7fd5e --- /dev/null +++ b/node_modules/style-to-js/umd/style-to-js.js @@ -0,0 +1,429 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.StyleToJS = factory()); +})(this, (function () { 'use strict'; + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + var cjs$2 = {}; + + var cjs$1; + var hasRequiredCjs$2; + + function requireCjs$2 () { + if (hasRequiredCjs$2) return cjs$1; + hasRequiredCjs$2 = 1; + + // http://www.w3.org/TR/CSS21/grammar.html + // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 + var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; + + var NEWLINE_REGEX = /\n/g; + var WHITESPACE_REGEX = /^\s*/; + + // declaration + var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; + var COLON_REGEX = /^:\s*/; + var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; + var SEMICOLON_REGEX = /^[;\s]*/; + + // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill + var TRIM_REGEX = /^\s+|\s+$/g; + + // strings + var NEWLINE = '\n'; + var FORWARD_SLASH = '/'; + var ASTERISK = '*'; + var EMPTY_STRING = ''; + + // types + var TYPE_COMMENT = 'comment'; + var TYPE_DECLARATION = 'declaration'; + + /** + * @param {String} style + * @param {Object} [options] + * @return {Object[]} + * @throws {TypeError} + * @throws {Error} + */ + function index (style, options) { + if (typeof style !== 'string') { + throw new TypeError('First argument must be a string'); + } + + if (!style) return []; + + options = options || {}; + + /** + * Positional. + */ + var lineno = 1; + var column = 1; + + /** + * Update lineno and column based on `str`. + * + * @param {String} str + */ + function updatePosition(str) { + var lines = str.match(NEWLINE_REGEX); + if (lines) lineno += lines.length; + var i = str.lastIndexOf(NEWLINE); + column = ~i ? str.length - i : column + str.length; + } + + /** + * Mark position and patch `node.position`. + * + * @return {Function} + */ + function position() { + var start = { line: lineno, column: column }; + return function (node) { + node.position = new Position(start); + whitespace(); + return node; + }; + } + + /** + * Store position information for a node. + * + * @constructor + * @property {Object} start + * @property {Object} end + * @property {undefined|String} source + */ + function Position(start) { + this.start = start; + this.end = { line: lineno, column: column }; + this.source = options.source; + } + + /** + * Non-enumerable source string. + */ + Position.prototype.content = style; + + /** + * Error `msg`. + * + * @param {String} msg + * @throws {Error} + */ + function error(msg) { + var err = new Error( + options.source + ':' + lineno + ':' + column + ': ' + msg + ); + err.reason = msg; + err.filename = options.source; + err.line = lineno; + err.column = column; + err.source = style; + + if (options.silent) ; else { + throw err; + } + } + + /** + * Match `re` and return captures. + * + * @param {RegExp} re + * @return {undefined|Array} + */ + function match(re) { + var m = re.exec(style); + if (!m) return; + var str = m[0]; + updatePosition(str); + style = style.slice(str.length); + return m; + } + + /** + * Parse whitespace. + */ + function whitespace() { + match(WHITESPACE_REGEX); + } + + /** + * Parse comments. + * + * @param {Object[]} [rules] + * @return {Object[]} + */ + function comments(rules) { + var c; + rules = rules || []; + while ((c = comment())) { + if (c !== false) { + rules.push(c); + } + } + return rules; + } + + /** + * Parse comment. + * + * @return {Object} + * @throws {Error} + */ + function comment() { + var pos = position(); + if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; + + var i = 2; + while ( + EMPTY_STRING != style.charAt(i) && + (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1)) + ) { + ++i; + } + i += 2; + + if (EMPTY_STRING === style.charAt(i - 1)) { + return error('End of comment missing'); + } + + var str = style.slice(2, i - 2); + column += 2; + updatePosition(str); + style = style.slice(i); + column += 2; + + return pos({ + type: TYPE_COMMENT, + comment: str + }); + } + + /** + * Parse declaration. + * + * @return {Object} + * @throws {Error} + */ + function declaration() { + var pos = position(); + + // prop + var prop = match(PROPERTY_REGEX); + if (!prop) return; + comment(); + + // : + if (!match(COLON_REGEX)) return error("property missing ':'"); + + // val + var val = match(VALUE_REGEX); + + var ret = pos({ + type: TYPE_DECLARATION, + property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), + value: val + ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) + : EMPTY_STRING + }); + + // ; + match(SEMICOLON_REGEX); + + return ret; + } + + /** + * Parse declarations. + * + * @return {Object[]} + */ + function declarations() { + var decls = []; + + comments(decls); + + // declarations + var decl; + while ((decl = declaration())) { + if (decl !== false) { + decls.push(decl); + comments(decls); + } + } + + return decls; + } + + whitespace(); + return declarations(); + } + + /** + * Trim `str`. + * + * @param {String} str + * @return {String} + */ + function trim(str) { + return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; + } + + cjs$1 = index; + + return cjs$1; + } + + var hasRequiredCjs$1; + + function requireCjs$1 () { + if (hasRequiredCjs$1) return cjs$2; + hasRequiredCjs$1 = 1; + var __importDefault = (cjs$2 && cjs$2.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + Object.defineProperty(cjs$2, "__esModule", { value: true }); + cjs$2.default = StyleToObject; + const inline_style_parser_1 = __importDefault(requireCjs$2()); + /** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ + function StyleToObject(style, iterator) { + let styleObject = null; + if (!style || typeof style !== 'string') { + return styleObject; + } + const declarations = (0, inline_style_parser_1.default)(style); + const hasIterator = typeof iterator === 'function'; + declarations.forEach((declaration) => { + if (declaration.type !== 'declaration') { + return; + } + const { property, value } = declaration; + if (hasIterator) { + iterator(property, value, declaration); + } + else if (value) { + styleObject = styleObject || {}; + styleObject[property] = value; + } + }); + return styleObject; + } + + return cjs$2; + } + + var utilities = {}; + + var hasRequiredUtilities; + + function requireUtilities () { + if (hasRequiredUtilities) return utilities; + hasRequiredUtilities = 1; + Object.defineProperty(utilities, "__esModule", { value: true }); + utilities.camelCase = void 0; + var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/; + var HYPHEN_REGEX = /-([a-z])/g; + var NO_HYPHEN_REGEX = /^[^-]+$/; + var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/; + var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/; + /** + * Checks whether to skip camelCase. + */ + var skipCamelCase = function (property) { + return !property || + NO_HYPHEN_REGEX.test(property) || + CUSTOM_PROPERTY_REGEX.test(property); + }; + /** + * Replacer that capitalizes first character. + */ + var capitalize = function (match, character) { + return character.toUpperCase(); + }; + /** + * Replacer that removes beginning hyphen of vendor prefix property. + */ + var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); }; + /** + * CamelCases a CSS property. + */ + var camelCase = function (property, options) { + if (options === void 0) { options = {}; } + if (skipCamelCase(property)) { + return property; + } + property = property.toLowerCase(); + if (options.reactCompat) { + // `-ms` vendor prefix should not be capitalized + property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen); + } + else { + // for non-React, remove first hyphen so vendor prefix is not capitalized + property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen); + } + return property.replace(HYPHEN_REGEX, capitalize); + }; + utilities.camelCase = camelCase; + + return utilities; + } + + var cjs; + var hasRequiredCjs; + + function requireCjs () { + if (hasRequiredCjs) return cjs; + hasRequiredCjs = 1; + var __importDefault = (cjs && cjs.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + var style_to_object_1 = __importDefault(requireCjs$1()); + var utilities_1 = requireUtilities(); + /** + * Parses CSS inline style to JavaScript object (camelCased). + */ + function StyleToJS(style, options) { + var output = {}; + if (!style || typeof style !== 'string') { + return output; + } + (0, style_to_object_1.default)(style, function (property, value) { + // skip CSS comment + if (property && value) { + output[(0, utilities_1.camelCase)(property, options)] = value; + } + }); + return output; + } + StyleToJS.default = StyleToJS; + cjs = StyleToJS; + + return cjs; + } + + var cjsExports = requireCjs(); + var index = /*@__PURE__*/getDefaultExportFromCjs(cjsExports); + + return index; + +})); +//# sourceMappingURL=style-to-js.js.map diff --git a/node_modules/style-to-js/umd/style-to-js.js.map b/node_modules/style-to-js/umd/style-to-js.js.map new file mode 100644 index 00000000..8e7de56d --- /dev/null +++ b/node_modules/style-to-js/umd/style-to-js.js.map @@ -0,0 +1 @@ +{"version":3,"file":"style-to-js.js","sources":["../node_modules/inline-style-parser/cjs/index.js","../node_modules/style-to-object/cjs/index.js","../cjs/utilities.js","../cjs/index.js","../cjs/index.js?commonjs-entry"],"sourcesContent":["'use strict';\n\n// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nfunction index (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) ; else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n\nmodule.exports = index;\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = StyleToObject;\nconst inline_style_parser_1 = __importDefault(require(\"inline-style-parser\"));\n/**\n * Parses inline style to object.\n *\n * @param style - Inline style.\n * @param iterator - Iterator.\n * @returns - Style object or null.\n *\n * @example Parsing inline style to object:\n *\n * ```js\n * import parse from 'style-to-object';\n * parse('line-height: 42;'); // { 'line-height': '42' }\n * ```\n */\nfunction StyleToObject(style, iterator) {\n let styleObject = null;\n if (!style || typeof style !== 'string') {\n return styleObject;\n }\n const declarations = (0, inline_style_parser_1.default)(style);\n const hasIterator = typeof iterator === 'function';\n declarations.forEach((declaration) => {\n if (declaration.type !== 'declaration') {\n return;\n }\n const { property, value } = declaration;\n if (hasIterator) {\n iterator(property, value, declaration);\n }\n else if (value) {\n styleObject = styleObject || {};\n styleObject[property] = value;\n }\n });\n return styleObject;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.camelCase = void 0;\nvar CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;\nvar HYPHEN_REGEX = /-([a-z])/g;\nvar NO_HYPHEN_REGEX = /^[^-]+$/;\nvar VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;\nvar MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;\n/**\n * Checks whether to skip camelCase.\n */\nvar skipCamelCase = function (property) {\n return !property ||\n NO_HYPHEN_REGEX.test(property) ||\n CUSTOM_PROPERTY_REGEX.test(property);\n};\n/**\n * Replacer that capitalizes first character.\n */\nvar capitalize = function (match, character) {\n return character.toUpperCase();\n};\n/**\n * Replacer that removes beginning hyphen of vendor prefix property.\n */\nvar trimHyphen = function (match, prefix) { return \"\".concat(prefix, \"-\"); };\n/**\n * CamelCases a CSS property.\n */\nvar camelCase = function (property, options) {\n if (options === void 0) { options = {}; }\n if (skipCamelCase(property)) {\n return property;\n }\n property = property.toLowerCase();\n if (options.reactCompat) {\n // `-ms` vendor prefix should not be capitalized\n property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);\n }\n else {\n // for non-React, remove first hyphen so vendor prefix is not capitalized\n property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);\n }\n return property.replace(HYPHEN_REGEX, capitalize);\n};\nexports.camelCase = camelCase;\n//# sourceMappingURL=utilities.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar style_to_object_1 = __importDefault(require(\"style-to-object\"));\nvar utilities_1 = require(\"./utilities\");\n/**\n * Parses CSS inline style to JavaScript object (camelCased).\n */\nfunction StyleToJS(style, options) {\n var output = {};\n if (!style || typeof style !== 'string') {\n return output;\n }\n (0, style_to_object_1.default)(style, function (property, value) {\n // skip CSS comment\n if (property && value) {\n output[(0, utilities_1.camelCase)(property, options)] = value;\n }\n });\n return output;\n}\nStyleToJS.default = StyleToJS;\nmodule.exports = StyleToJS;\n//# sourceMappingURL=index.js.map","import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireCjs } from \"/home/runner/work/style-to-js/style-to-js/cjs/index.js\";\nvar cjsExports = requireCjs();\nexport { cjsExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(cjsExports);"],"names":["cjs","this","require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;;;;CAEA;CACA;EACA,IAAI,aAAa,GAAG,iCAAiC;;EAErD,IAAI,aAAa,GAAG,KAAK;EACzB,IAAI,gBAAgB,GAAG,MAAM;;CAE7B;EACA,IAAI,cAAc,GAAG,wCAAwC;EAC7D,IAAI,WAAW,GAAG,OAAO;EACzB,IAAI,WAAW,GAAG,sDAAsD;EACxE,IAAI,eAAe,GAAG,SAAS;;CAE/B;EACA,IAAI,UAAU,GAAG,YAAY;;CAE7B;EACA,IAAI,OAAO,GAAG,IAAI;EAClB,IAAI,aAAa,GAAG,GAAG;EACvB,IAAI,QAAQ,GAAG,GAAG;EAClB,IAAI,YAAY,GAAG,EAAE;;CAErB;EACA,IAAI,YAAY,GAAG,SAAS;EAC5B,IAAI,gBAAgB,GAAG,aAAa;;CAEpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAA,SAAS,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;CAChC,GAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CACjC,KAAI,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC;CAC1D,GAAA;;CAEA,GAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;;CAEvB,GAAE,OAAO,GAAG,OAAO,IAAI,EAAE;;CAEzB;CACA;CACA;IACE,IAAI,MAAM,GAAG,CAAC;IACd,IAAI,MAAM,GAAG,CAAC;;CAEhB;CACA;CACA;CACA;CACA;CACA,GAAE,SAAS,cAAc,CAAC,GAAG,EAAE;MAC3B,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;CACxC,KAAI,IAAI,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM;MACjC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;CACpC,KAAI,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM;CACtD,GAAA;;CAEA;CACA;CACA;CACA;CACA;IACE,SAAS,QAAQ,GAAG;MAClB,IAAI,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;MAC5C,OAAO,UAAU,IAAI,EAAE;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC;CACzC,OAAM,UAAU,EAAE;CAClB,OAAM,OAAO,IAAI;MACjB,CAAK;CACL,GAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;CAC3B,KAAI,IAAI,CAAC,KAAK,GAAG,KAAK;CACtB,KAAI,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;CAC/C,KAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;CAChC,GAAA;;CAEA;CACA;CACA;CACA,GAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK;;CAEpC;CACA;CACA;CACA;CACA;CACA;CACA,GAAE,SAAS,KAAK,CAAC,GAAG,EAAE;CACtB,KAAI,IAAI,GAAG,GAAG,IAAI,KAAK;CACvB,OAAM,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG;OACvD;CACL,KAAI,GAAG,CAAC,MAAM,GAAG,GAAG;CACpB,KAAI,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM;CACjC,KAAI,GAAG,CAAC,IAAI,GAAG,MAAM;CACrB,KAAI,GAAG,CAAC,MAAM,GAAG,MAAM;CACvB,KAAI,GAAG,CAAC,MAAM,GAAG,KAAK;;CAEtB,KAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM;CAC/B,OAAM,MAAM,GAAG;CACf,KAAA;CACA,GAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;CACA,GAAE,SAAS,KAAK,CAAC,EAAE,EAAE;MACjB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;MACtB,IAAI,CAAC,CAAC,EAAE;CACZ,KAAI,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;MACd,cAAc,CAAC,GAAG,CAAC;MACnB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;CACnC,KAAI,OAAO,CAAC;CACZ,GAAA;;CAEA;CACA;CACA;IACE,SAAS,UAAU,GAAG;MACpB,KAAK,CAAC,gBAAgB,CAAC;CAC3B,GAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;CACA,GAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;CAC3B,KAAI,IAAI,CAAC;CACT,KAAI,KAAK,GAAG,KAAK,IAAI,EAAE;CACvB,KAAI,QAAQ,CAAC,GAAG,OAAO,EAAE,GAAG;CAC5B,OAAM,IAAI,CAAC,KAAK,KAAK,EAAE;CACvB,SAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;CACrB,OAAA;CACA,KAAA;CACA,KAAI,OAAO,KAAK;CAChB,GAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;IACE,SAAS,OAAO,GAAG;CACrB,KAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;CACxB,KAAI,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;;MAErE,IAAI,CAAC,GAAG,CAAC;MACT;CACJ,OAAM,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,QAAO,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QACpE;CACN,OAAM,EAAE,CAAC;CACT,KAAA;MACI,CAAC,IAAI,CAAC;;MAEN,IAAI,YAAY,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;CAC9C,OAAM,OAAO,KAAK,CAAC,wBAAwB,CAAC;CAC5C,KAAA;;CAEA,KAAI,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;MAC/B,MAAM,IAAI,CAAC;MACX,cAAc,CAAC,GAAG,CAAC;CACvB,KAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;MACtB,MAAM,IAAI,CAAC;;MAEX,OAAO,GAAG,CAAC;QACT,IAAI,EAAE,YAAY;CACxB,OAAM,OAAO,EAAE;CACf,MAAK,CAAC;CACN,GAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;IACE,SAAS,WAAW,GAAG;CACzB,KAAI,IAAI,GAAG,GAAG,QAAQ,EAAE;;CAExB;CACA,KAAI,IAAI,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC;MAChC,IAAI,CAAC,IAAI,EAAE;CACf,KAAI,OAAO,EAAE;;CAEb;MACI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,CAAC,sBAAsB,CAAC;;CAEjE;CACA,KAAI,IAAI,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;;CAEhC,KAAI,IAAI,GAAG,GAAG,GAAG,CAAC;QACZ,IAAI,EAAE,gBAAgB;CAC5B,OAAM,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;CAClE,OAAM,KAAK,EAAE;CACb,WAAU,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC;YAChD;CACV,MAAK,CAAC;;CAEN;MACI,KAAK,CAAC,eAAe,CAAC;;CAE1B,KAAI,OAAO,GAAG;CACd,GAAA;;CAEA;CACA;CACA;CACA;CACA;IACE,SAAS,YAAY,GAAG;MACtB,IAAI,KAAK,GAAG,EAAE;;MAEd,QAAQ,CAAC,KAAK,CAAC;;CAEnB;CACA,KAAI,IAAI,IAAI;CACZ,KAAI,QAAQ,IAAI,GAAG,WAAW,EAAE,GAAG;CACnC,OAAM,IAAI,IAAI,KAAK,KAAK,EAAE;CAC1B,SAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;UAChB,QAAQ,CAAC,KAAK,CAAC;CACvB,OAAA;CACA,KAAA;;CAEA,KAAI,OAAO,KAAK;CAChB,GAAA;;CAEA,GAAE,UAAU,EAAE;IACZ,OAAO,YAAY,EAAE;CACvB,CAAA;;CAEA;CACA;CACA;CACA;CACA;CACA;EACA,SAAS,IAAI,CAAC,GAAG,EAAE;CACnB,GAAE,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,YAAY;CACnE,CAAA;;CAEA,CAAAA,KAAc,GAAG,KAAK;CACtB;;;;;;;;;ECpQA,IAAI,eAAe,GAAG,CAACC,KAAI,IAAIA,KAAI,CAAC,eAAe,KAAK,UAAU,GAAG,EAAE;CACvE,KAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;EAC7D,CAAC;CACD,CAAA,MAAM,CAAC,cAAc,CAACD,KAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;CAC7D,CAAAA,KAAA,CAAA,OAAe,GAAG,aAAa;CAC/B,CAAA,MAAM,qBAAqB,GAAG,eAAe,CAACE,cAA8B,CAAC;CAC7E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAA,SAAS,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE;MACpC,IAAI,WAAW,GAAG,IAAI;MACtB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CAC7C,SAAQ,OAAO,WAAW;CAC1B,KAAA;MACI,MAAM,YAAY,GAAG,IAAI,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;CAClE,KAAI,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU;CACtD,KAAI,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,KAAK;CAC1C,SAAQ,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE;cACpC;CACZ,SAAA;CACA,SAAQ,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW;UACvC,IAAI,WAAW,EAAE;CACzB,aAAY,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC;CAClD,SAAA;eACa,IAAI,KAAK,EAAE;CACxB,aAAY,WAAW,GAAG,WAAW,IAAI,EAAE;CAC3C,aAAY,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK;CACzC,SAAA;CACA,KAAA,CAAK,CAAC;CACN,KAAI,OAAO,WAAW;CACtB,CAAA;CACA;;;;;;;;;;;CC1CA,CAAA,MAAM,CAAC,cAAc,CAAC,SAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;CAC7D,CAAA,SAAA,CAAA,SAAiB,GAAG,MAAM;EAC1B,IAAI,qBAAqB,GAAG,oBAAoB;EAChD,IAAI,YAAY,GAAG,WAAW;EAC9B,IAAI,eAAe,GAAG,SAAS;EAC/B,IAAI,mBAAmB,GAAG,4BAA4B;EACtD,IAAI,sBAAsB,GAAG,SAAS;CACtC;CACA;CACA;CACA,CAAA,IAAI,aAAa,GAAG,UAAU,QAAQ,EAAE;MACpC,OAAO,CAAC,QAAQ;CACpB,SAAQ,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;CACtC,SAAQ,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC;EAC5C,CAAC;CACD;CACA;CACA;CACA,CAAA,IAAI,UAAU,GAAG,UAAU,KAAK,EAAE,SAAS,EAAE;CAC7C,KAAI,OAAO,SAAS,CAAC,WAAW,EAAE;EAClC,CAAC;CACD;CACA;CACA;CACA,CAAA,IAAI,UAAU,GAAG,UAAU,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA,CAAE;CAC5E;CACA;CACA;CACA,CAAA,IAAI,SAAS,GAAG,UAAU,QAAQ,EAAE,OAAO,EAAE;MACzC,IAAI,OAAO,KAAK,MAAM,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,CAAA;CAC3C,KAAI,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;CACjC,SAAQ,OAAO,QAAQ;CACvB,KAAA;CACA,KAAI,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE;CACrC,KAAI,IAAI,OAAO,CAAC,WAAW,EAAE;CAC7B;UACQ,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC;CACvE,KAAA;WACS;CACT;UACQ,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC;CACpE,KAAA;MACI,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC;EACrD,CAAC;CACD,CAAA,SAAA,CAAA,SAAiB,GAAG,SAAS;CAC7B;;;;;;;;;;EC7CA,IAAI,eAAe,GAAG,CAACD,GAAI,IAAIA,GAAI,CAAC,eAAe,KAAK,UAAU,GAAG,EAAE;CACvE,KAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;EAC7D,CAAC;CACD,CAAA,IAAI,iBAAiB,GAAG,eAAe,CAACC,cAA0B,CAAC;EACnE,IAAI,WAAW,GAAGC,gBAAA,EAAsB;CACxC;CACA;CACA;CACA,CAAA,SAAS,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE;MAC/B,IAAI,MAAM,GAAG,EAAE;MACf,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CAC7C,SAAQ,OAAO,MAAM;CACrB,KAAA;CACA,KAAI,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,QAAQ,EAAE,KAAK,EAAE;CACrE;CACA,SAAQ,IAAI,QAAQ,IAAI,KAAK,EAAE;CAC/B,aAAY,MAAM,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK;CACzE,SAAA;CACA,KAAA,CAAK,CAAC;CACN,KAAI,OAAO,MAAM;CACjB,CAAA;EACA,SAAS,CAAC,OAAO,GAAG,SAAS;CAC7B,CAAA,GAAc,GAAG,SAAS;CAC1B;;;;CCtBA,IAAI,UAAU,GAAG,UAAU,EAAE;AAE7B,aAAe,aAAa,uBAAuB,CAAC,UAAU,CAAC;;;;;;;;","x_google_ignoreList":[0,1]} \ No newline at end of file diff --git a/node_modules/style-to-js/umd/style-to-js.min.js b/node_modules/style-to-js/umd/style-to-js.min.js new file mode 100644 index 00000000..e5f0d6ad --- /dev/null +++ b/node_modules/style-to-js/umd/style-to-js.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).StyleToJS=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,r,n,o={};function u(){if(n)return o;n=1;var e=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){let r=null;if(!e||"string"!=typeof e)return r;const n=(0,u.default)(e),o="function"==typeof t;return n.forEach((e=>{if("declaration"!==e.type)return;const{property:n,value:u}=e;o?t(n,u,e):u&&(r=r||{},r[n]=u)})),r};const u=e(function(){if(r)return t;r=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,u=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,l="";function s(e){return e?e.replace(f,l):l}return t=function(t,r){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];r=r||{};var f=1,p=1;function d(e){var t=e.match(n);t&&(f+=t.length);var r=e.lastIndexOf("\n");p=~r?e.length-r:p+e.length}function m(){var e={line:f,column:p};return function(t){return t.position=new v(e),g(),t}}function v(e){this.start=e,this.end={line:f,column:p},this.source=r.source}function h(e){var n=new Error(r.source+":"+f+":"+p+": "+e);if(n.reason=e,n.filename=r.source,n.line=f,n.column=p,n.source=t,!r.silent)throw n}function y(e){var r=e.exec(t);if(r){var n=r[0];return d(n),t=t.slice(n.length),r}}function g(){y(o)}function _(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var e=m();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var r=2;l!=t.charAt(r)&&("*"!=t.charAt(r)||"/"!=t.charAt(r+1));)++r;if(r+=2,l===t.charAt(r-1))return h("End of comment missing");var n=t.slice(2,r-2);return p+=2,d(n),t=t.slice(r),p+=2,e({type:"comment",comment:n})}}function b(){var t=m(),r=y(u);if(r){if(w(),!y(i))return h("property missing ':'");var n=y(a),o=t({type:"declaration",property:s(r[0].replace(e,l)),value:n?s(n[0].replace(e,l)):l});return y(c),o}}return v.prototype.content=t,g(),function(){var e,t=[];for(_(t);e=b();)!1!==e&&(t.push(e),_(t));return t}()}}());return o}var i,a,c,f={};function l(){if(i)return f;i=1,Object.defineProperty(f,"__esModule",{value:!0}),f.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(e,t){return t.toUpperCase()},a=function(e,t){return"".concat(t,"-")};return f.camelCase=function(i,c){return void 0===c&&(c={}),function(t){return!t||r.test(t)||e.test(t)}(i)?i:(i=i.toLowerCase(),(i=c.reactCompat?i.replace(o,a):i.replace(n,a)).replace(t,u))},f}return e(function(){if(c)return a;c=1;var e=(a&&a.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(u()),t=l();function r(r,n){var o={};return r&&"string"==typeof r?((0,e.default)(r,(function(e,r){e&&r&&(o[(0,t.camelCase)(e,n)]=r)})),o):o}return r.default=r,a=r}())})); +//# sourceMappingURL=style-to-js.min.js.map diff --git a/node_modules/style-to-js/umd/style-to-js.min.js.map b/node_modules/style-to-js/umd/style-to-js.min.js.map new file mode 100644 index 00000000..5b5ca23d --- /dev/null +++ b/node_modules/style-to-js/umd/style-to-js.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"style-to-js.min.js","sources":["../node_modules/style-to-object/cjs/index.js","../node_modules/inline-style-parser/cjs/index.js","../cjs/utilities.js","../cjs/index.js?commonjs-entry","../cjs/index.js"],"sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = StyleToObject;\nconst inline_style_parser_1 = __importDefault(require(\"inline-style-parser\"));\n/**\n * Parses inline style to object.\n *\n * @param style - Inline style.\n * @param iterator - Iterator.\n * @returns - Style object or null.\n *\n * @example Parsing inline style to object:\n *\n * ```js\n * import parse from 'style-to-object';\n * parse('line-height: 42;'); // { 'line-height': '42' }\n * ```\n */\nfunction StyleToObject(style, iterator) {\n let styleObject = null;\n if (!style || typeof style !== 'string') {\n return styleObject;\n }\n const declarations = (0, inline_style_parser_1.default)(style);\n const hasIterator = typeof iterator === 'function';\n declarations.forEach((declaration) => {\n if (declaration.type !== 'declaration') {\n return;\n }\n const { property, value } = declaration;\n if (hasIterator) {\n iterator(property, value, declaration);\n }\n else if (value) {\n styleObject = styleObject || {};\n styleObject[property] = value;\n }\n });\n return styleObject;\n}\n//# sourceMappingURL=index.js.map","'use strict';\n\n// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nfunction index (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) ; else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n\nmodule.exports = index;\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.camelCase = void 0;\nvar CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;\nvar HYPHEN_REGEX = /-([a-z])/g;\nvar NO_HYPHEN_REGEX = /^[^-]+$/;\nvar VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;\nvar MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;\n/**\n * Checks whether to skip camelCase.\n */\nvar skipCamelCase = function (property) {\n return !property ||\n NO_HYPHEN_REGEX.test(property) ||\n CUSTOM_PROPERTY_REGEX.test(property);\n};\n/**\n * Replacer that capitalizes first character.\n */\nvar capitalize = function (match, character) {\n return character.toUpperCase();\n};\n/**\n * Replacer that removes beginning hyphen of vendor prefix property.\n */\nvar trimHyphen = function (match, prefix) { return \"\".concat(prefix, \"-\"); };\n/**\n * CamelCases a CSS property.\n */\nvar camelCase = function (property, options) {\n if (options === void 0) { options = {}; }\n if (skipCamelCase(property)) {\n return property;\n }\n property = property.toLowerCase();\n if (options.reactCompat) {\n // `-ms` vendor prefix should not be capitalized\n property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);\n }\n else {\n // for non-React, remove first hyphen so vendor prefix is not capitalized\n property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);\n }\n return property.replace(HYPHEN_REGEX, capitalize);\n};\nexports.camelCase = camelCase;\n//# sourceMappingURL=utilities.js.map","import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireCjs } from \"/home/runner/work/style-to-js/style-to-js/cjs/index.js\";\nvar cjsExports = requireCjs();\nexport { cjsExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(cjsExports);","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar style_to_object_1 = __importDefault(require(\"style-to-object\"));\nvar utilities_1 = require(\"./utilities\");\n/**\n * Parses CSS inline style to JavaScript object (camelCased).\n */\nfunction StyleToJS(style, options) {\n var output = {};\n if (!style || typeof style !== 'string') {\n return output;\n }\n (0, style_to_object_1.default)(style, function (property, value) {\n // skip CSS comment\n if (property && value) {\n output[(0, utilities_1.camelCase)(property, options)] = value;\n }\n });\n return output;\n}\nStyleToJS.default = StyleToJS;\nmodule.exports = StyleToJS;\n//# sourceMappingURL=index.js.map"],"names":["__importDefault","this","mod","__esModule","default","Object","defineProperty","cjs","value","style","iterator","styleObject","declarations","inline_style_parser_1","hasIterator","forEach","declaration","type","property","COMMENT_REGEX","NEWLINE_REGEX","WHITESPACE_REGEX","PROPERTY_REGEX","COLON_REGEX","VALUE_REGEX","SEMICOLON_REGEX","TRIM_REGEX","EMPTY_STRING","trim","str","replace","options","TypeError","lineno","column","updatePosition","lines","match","length","i","lastIndexOf","position","start","line","node","Position","whitespace","end","source","error","msg","err","Error","reason","filename","silent","re","m","exec","slice","comments","rules","c","comment","push","pos","charAt","prop","val","ret","prototype","content","decl","decls","require$$0","utilities","camelCase","CUSTOM_PROPERTY_REGEX","HYPHEN_REGEX","NO_HYPHEN_REGEX","VENDOR_PREFIX_REGEX","MS_VENDOR_PREFIX_REGEX","capitalize","character","toUpperCase","trimHyphen","prefix","concat","test","skipCamelCase","toLowerCase","reactCompat","getDefaultExportFromCjs","style_to_object_1","utilities_1","require$$1","StyleToJS","output","requireCjs"],"mappings":"4XACA,IAAIA,EAAmBC,GAAQA,EAAKD,iBAAoB,SAAUE,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,EACAG,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAAH,QAgBA,SAAuBK,EAAOC,GAC1B,IAAIC,EAAc,KAClB,IAAKF,GAA0B,iBAAVA,EACjB,OAAOE,EAEX,MAAMC,GAAe,EAAIC,EAAsBT,SAASK,GAClDK,EAAkC,mBAAbJ,EAc3B,OAbAE,EAAaG,SAASC,IAClB,GAAyB,gBAArBA,EAAYC,KACZ,OAEJ,MAAMC,SAAEA,EAAQV,MAAEA,GAAUQ,EACxBF,EACAJ,EAASQ,EAAUV,EAAOQ,GAErBR,IACLG,EAAcA,GAAe,CAAA,EAC7BA,EAAYO,GAAYV,EACpC,IAEWG,CACX,EApCA,MAAME,EAAwBb,+BCF9B,IAAImB,EAAgB,kCAEhBC,EAAgB,MAChBC,EAAmB,OAGnBC,EAAiB,yCACjBC,EAAc,QACdC,EAAc,uDACdC,EAAkB,UAGlBC,EAAa,aAMbC,EAAe,GA0OnB,SAASC,EAAKC,GACZ,OAAOA,EAAMA,EAAIC,QAAQJ,EAAYC,GAAgBA,CACvD,QAEApB,EAjOA,SAAgBE,EAAOsB,GACrB,GAAqB,iBAAVtB,EACT,MAAM,IAAIuB,UAAU,mCAGtB,IAAKvB,EAAO,MAAO,GAEnBsB,EAAUA,GAAW,CAAA,EAKrB,IAAIE,EAAS,EACTC,EAAS,EAOb,SAASC,EAAeN,GACtB,IAAIO,EAAQP,EAAIQ,MAAMjB,GAClBgB,IAAOH,GAAUG,EAAME,QAC3B,IAAIC,EAAIV,EAAIW,YAvCF,MAwCVN,GAAUK,EAAIV,EAAIS,OAASC,EAAIL,EAASL,EAAIS,MAChD,CAOE,SAASG,IACP,IAAIC,EAAQ,CAAEC,KAAMV,EAAQC,OAAQA,GACpC,OAAO,SAAUU,GAGf,OAFAA,EAAKH,SAAW,IAAII,EAASH,GAC7BI,IACOF,CACb,CACA,CAUE,SAASC,EAASH,GAChBzC,KAAKyC,MAAQA,EACbzC,KAAK8C,IAAM,CAAEJ,KAAMV,EAAQC,OAAQA,GACnCjC,KAAK+C,OAASjB,EAAQiB,MAC1B,CAaE,SAASC,EAAMC,GACb,IAAIC,EAAM,IAAIC,MACZrB,EAAQiB,OAAS,IAAMf,EAAS,IAAMC,EAAS,KAAOgB,GAQxD,GANAC,EAAIE,OAASH,EACbC,EAAIG,SAAWvB,EAAQiB,OACvBG,EAAIR,KAAOV,EACXkB,EAAIjB,OAASA,EACbiB,EAAIH,OAASvC,GAETsB,EAAQwB,OACV,MAAMJ,CAEZ,CAQE,SAASd,EAAMmB,GACb,IAAIC,EAAID,EAAGE,KAAKjD,GAChB,GAAKgD,EAAL,CACA,IAAI5B,EAAM4B,EAAE,GAGZ,OAFAtB,EAAeN,GACfpB,EAAQA,EAAMkD,MAAM9B,EAAIS,QACjBmB,CAJC,CAKZ,CAKE,SAASX,IACPT,EAAMhB,EACV,CAQE,SAASuC,EAASC,GAChB,IAAIC,EAEJ,IADAD,EAAQA,GAAS,GACTC,EAAIC,MACA,IAAND,GACFD,EAAMG,KAAKF,GAGf,OAAOD,CACX,CAQE,SAASE,IACP,IAAIE,EAAMxB,IACV,GA/IgB,KA+IKhC,EAAMyD,OAAO,IA9IvB,KA8IyCzD,EAAMyD,OAAO,GAAjE,CAGA,IADA,IAAI3B,EAAI,EAENZ,GAAgBlB,EAAMyD,OAAO3B,KAlJpB,KAmJI9B,EAAMyD,OAAO3B,IApJZ,KAoJmC9B,EAAMyD,OAAO3B,EAAI,OAEhEA,EAIJ,GAFAA,GAAK,EAEDZ,IAAiBlB,EAAMyD,OAAO3B,EAAI,GACpC,OAAOU,EAAM,0BAGf,IAAIpB,EAAMpB,EAAMkD,MAAM,EAAGpB,EAAI,GAM7B,OALAL,GAAU,EACVC,EAAeN,GACfpB,EAAQA,EAAMkD,MAAMpB,GACpBL,GAAU,EAEH+B,EAAI,CACThD,KAhKa,UAiKb8C,QAASlC,GAvB0D,CAyBzE,CAQE,SAASb,IACP,IAAIiD,EAAMxB,IAGN0B,EAAO9B,EAAMf,GACjB,GAAK6C,EAAL,CAIA,GAHAJ,KAGK1B,EAAMd,GAAc,OAAO0B,EAAM,wBAGtC,IAAImB,EAAM/B,EAAMb,GAEZ6C,EAAMJ,EAAI,CACZhD,KAzLiB,cA0LjBC,SAAUU,EAAKuC,EAAK,GAAGrC,QAAQX,EAAeQ,IAC9CnB,MAAO4D,EACHxC,EAAKwC,EAAI,GAAGtC,QAAQX,EAAeQ,IACnCA,IAMN,OAFAU,EAAMZ,GAEC4C,CApBI,CAqBf,CAyBE,OA1JAxB,EAASyB,UAAUC,QAAU9D,EAyJ7BqC,IAjBA,WACE,IAKI0B,EALAC,EAAQ,GAMZ,IAJAb,EAASa,GAIDD,EAAOxD,MACA,IAATwD,IACFC,EAAMT,KAAKQ,GACXZ,EAASa,IAIb,OAAOA,CACX,CAGS7D,EACT,EDlP8C8D,2DEL9CrE,OAAOC,eAAeqE,EAAS,aAAc,CAAEnE,OAAO,IACtDmE,EAAAC,eAAoB,EACpB,IAAIC,EAAwB,qBACxBC,EAAe,YACfC,EAAkB,UAClBC,EAAsB,6BACtBC,EAAyB,UAYzBC,EAAa,SAAU7C,EAAO8C,GAC9B,OAAOA,EAAUC,aACrB,EAIIC,EAAa,SAAUhD,EAAOiD,GAAU,MAAO,GAAGC,OAAOD,EAAQ,IAAK,SAoB1EX,EAAAC,UAhBgB,SAAU1D,EAAUa,GAEhC,YADgB,IAAZA,IAAsBA,EAAU,CAAA,GAnBpB,SAAUb,GAC1B,OAAQA,GACJ6D,EAAgBS,KAAKtE,IACrB2D,EAAsBW,KAAKtE,EACnC,CAgBQuE,CAAcvE,GACPA,GAEXA,EAAWA,EAASwE,eAGhBxE,EAFAa,EAAQ4D,YAEGzE,EAASY,QAAQmD,EAAwBI,GAIzCnE,EAASY,QAAQkD,EAAqBK,IAErCvD,QAAQgD,EAAcI,GAC1C,WCxC4BU,+BCH5B,IAGIC,GAHmB5F,GAAQA,EAAKD,iBAAoB,SAAUE,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,GACwCwE,KACpCoB,EAAcC,IAIlB,SAASC,EAAUvF,EAAOsB,GACtB,IAAIkE,EAAS,CAAA,EACb,OAAKxF,GAA0B,iBAAVA,IAGrB,EAAIoF,EAAkBzF,SAASK,GAAO,SAAUS,EAAUV,GAElDU,GAAYV,IACZyF,GAAO,EAAIH,EAAYlB,WAAW1D,EAAUa,IAAYvB,EAEpE,IACWyF,GARIA,CASf,QACAD,EAAU5F,QAAU4F,EACpBzF,EAAiByF,EDrBAE","x_google_ignoreList":[0,1]} \ No newline at end of file diff --git a/node_modules/style-to-object/LICENSE b/node_modules/style-to-object/LICENSE new file mode 100644 index 00000000..e1090121 --- /dev/null +++ b/node_modules/style-to-object/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2017 Menglin "Mark" Xu <mark@remarkablemark.org> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/style-to-object/README.md b/node_modules/style-to-object/README.md new file mode 100644 index 00000000..9172d1f1 --- /dev/null +++ b/node_modules/style-to-object/README.md @@ -0,0 +1,188 @@ +# style-to-object + +[![NPM](https://nodei.co/npm/style-to-object.png)](https://nodei.co/npm/style-to-object/) + +[![NPM version](https://img.shields.io/npm/v/style-to-object)](https://www.npmjs.com/package/style-to-object) +[![NPM bundle size](https://img.shields.io/bundlephobia/minzip/style-to-object)](https://bundlephobia.com/package/style-to-object) +[![build](https://github.com/remarkablemark/style-to-object/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/style-to-object/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/remarkablemark/style-to-object/branch/master/graph/badge.svg?token=XWxph9dpa4)](https://codecov.io/gh/remarkablemark/style-to-object) +[![NPM downloads](https://img.shields.io/npm/dm/style-to-object)](https://www.npmjs.com/package/style-to-object) + +Parse CSS inline style to JavaScript object: + +```js +import parse from 'style-to-object'; + +parse('color: #C0FFEE; background: #BADA55;'); +``` + +Output: + +```js +{ color: '#C0FFEE', background: '#BADA55' } +``` + +[JSFiddle](https://jsfiddle.net/remarkablemark/ykz2meot/) | [Examples](https://github.com/remarkablemark/style-to-object/tree/master/examples) + +## Installation + +[NPM](https://www.npmjs.com/package/style-to-object): + +```sh +npm install style-to-object --save +``` + +[Yarn](https://yarn.fyi/style-to-object): + +```sh +yarn add style-to-object +``` + +[CDN](https://unpkg.com/style-to-object/): + +```html +<script src="https://unpkg.com/style-to-object@latest/dist/style-to-object.min.js"></script> +<script> + window.StyleToObject(/* string */); +</script> +``` + +## Usage + +Import with ES Modules: + +```js +import parse from 'style-to-object'; +``` + +Require with CommonJS: + +```js +const parse = require('style-to-object').default; +``` + +Parse single declaration: + +```js +parse('line-height: 42'); +``` + +Output: + +```js +{ 'line-height': '42' } +``` + +Parse multiple declarations: + +```js +parse(` + border-color: #ACE; + z-index: 1337; +`); +``` + +Output: + +```js +{ 'border-color': '#ACE', 'z-index': '1337' } +``` + +Parse unknown declarations: + +```js +parse('answer: 42;'); +``` + +Output: + +```js +{ 'answer': '42' } +``` + +Invalid declarations/arguments: + +<!-- prettier-ignore-start --> + +```js +parse(` + top: ; + right: 1em; +`); // { right: '1em' } + +parse(); // null +parse(null); // null +parse(1); // null +parse(true); // null +parse('top:'); // null +parse(':12px'); // null +parse(':'); // null +parse(';'); // null + +parse('top'); // throws Error +parse('/*'); // throws Error +``` + +<!-- prettier-ignore-end --> + +### Iterator + +If the 2nd argument is a function, then the parser will return `null`: + +```js +parse('color: #f00', () => {}); // null +``` + +But the function will iterate through each declaration: + +<!-- prettier-ignore-start --> + +```js +parse('color: #f00', (name, value, declaration) => { + console.log(name); // 'color' + console.log(value); // '#f00' + console.log(declaration); // { type: 'declaration', property: 'color', value: '#f00' } +}); +``` + +<!-- prettier-ignore-end --> + +This makes it easy to customize the output: + +```js +const style = ` + color: red; + background: blue; +`; +const output = []; + +function iterator(name, value) { + output.push([name, value]); +} + +parse(style, iterator); +console.log(output); // [['color', 'red'], ['background', 'blue']] +``` + +## Migration + +### v1 + +Migrated to TypeScript. Iterator excludes `Comment`. CommonJS requires the `.default` key: + +```js +const parse = require('style-to-object').default; +``` + +## Release + +Release and publish are automated by [Release Please](https://github.com/googleapis/release-please). + +## Special Thanks + +- [inline-style-parser](https://github.com/remarkablemark/inline-style-parser) +- [Contributors](https://github.com/remarkablemark/style-to-object/graphs/contributors) + +## License + +[MIT](https://github.com/remarkablemark/style-to-object/blob/master/LICENSE) diff --git a/node_modules/style-to-object/cjs/index.d.ts b/node_modules/style-to-object/cjs/index.d.ts new file mode 100644 index 00000000..8804e046 --- /dev/null +++ b/node_modules/style-to-object/cjs/index.d.ts @@ -0,0 +1,22 @@ +import type { Declaration } from 'inline-style-parser'; +export { Declaration }; +export interface StyleObject { + [name: string]: string; +} +type Iterator = (property: string, value: string, declaration: Declaration) => void; +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +export default function StyleToObject(style: string, iterator?: Iterator): StyleObject | null; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/style-to-object/cjs/index.d.ts.map b/node_modules/style-to-object/cjs/index.d.ts.map new file mode 100644 index 00000000..10f038cc --- /dev/null +++ b/node_modules/style-to-object/cjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,KAAK,QAAQ,GAAG,CACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,KACrB,IAAI,CAAC;AAEV;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,QAAQ,GAClB,WAAW,GAAG,IAAI,CA0BpB"} \ No newline at end of file diff --git a/node_modules/style-to-object/cjs/index.js b/node_modules/style-to-object/cjs/index.js new file mode 100644 index 00000000..ddc74fc8 --- /dev/null +++ b/node_modules/style-to-object/cjs/index.js @@ -0,0 +1,44 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = StyleToObject; +const inline_style_parser_1 = __importDefault(require("inline-style-parser")); +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +function StyleToObject(style, iterator) { + let styleObject = null; + if (!style || typeof style !== 'string') { + return styleObject; + } + const declarations = (0, inline_style_parser_1.default)(style); + const hasIterator = typeof iterator === 'function'; + declarations.forEach((declaration) => { + if (declaration.type !== 'declaration') { + return; + } + const { property, value } = declaration; + if (hasIterator) { + iterator(property, value, declaration); + } + else if (value) { + styleObject = styleObject || {}; + styleObject[property] = value; + } + }); + return styleObject; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-to-object/cjs/index.js.map b/node_modules/style-to-object/cjs/index.js.map new file mode 100644 index 00000000..55f505e0 --- /dev/null +++ b/node_modules/style-to-object/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AA6BA,gCA6BC;AAzDD,8EAAwC;AAcxC;;;;;;;;;;;;;GAaG;AACH,SAAwB,aAAa,CACnC,KAAa,EACb,QAAmB;IAEnB,IAAI,WAAW,GAAuB,IAAI,CAAC;IAE3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,6BAAK,EAAC,KAAK,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC;IAEnD,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACnC,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YACvC,OAAO;QACT,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;QAExC,IAAI,WAAW,EAAE,CAAC;YAChB,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QACzC,CAAC;aAAM,IAAI,KAAK,EAAE,CAAC;YACjB,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;YAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAChC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/node_modules/style-to-object/esm/index.d.ts b/node_modules/style-to-object/esm/index.d.ts new file mode 100644 index 00000000..8804e046 --- /dev/null +++ b/node_modules/style-to-object/esm/index.d.ts @@ -0,0 +1,22 @@ +import type { Declaration } from 'inline-style-parser'; +export { Declaration }; +export interface StyleObject { + [name: string]: string; +} +type Iterator = (property: string, value: string, declaration: Declaration) => void; +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +export default function StyleToObject(style: string, iterator?: Iterator): StyleObject | null; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/style-to-object/esm/index.d.ts.map b/node_modules/style-to-object/esm/index.d.ts.map new file mode 100644 index 00000000..10f038cc --- /dev/null +++ b/node_modules/style-to-object/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,KAAK,QAAQ,GAAG,CACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,KACrB,IAAI,CAAC;AAEV;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,QAAQ,GAClB,WAAW,GAAG,IAAI,CA0BpB"} \ No newline at end of file diff --git a/node_modules/style-to-object/esm/index.js b/node_modules/style-to-object/esm/index.js new file mode 100644 index 00000000..e774a184 --- /dev/null +++ b/node_modules/style-to-object/esm/index.js @@ -0,0 +1,38 @@ +import parse from 'inline-style-parser'; +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +export default function StyleToObject(style, iterator) { + let styleObject = null; + if (!style || typeof style !== 'string') { + return styleObject; + } + const declarations = parse(style); + const hasIterator = typeof iterator === 'function'; + declarations.forEach((declaration) => { + if (declaration.type !== 'declaration') { + return; + } + const { property, value } = declaration; + if (hasIterator) { + iterator(property, value, declaration); + } + else if (value) { + styleObject = styleObject || {}; + styleObject[property] = value; + } + }); + return styleObject; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-to-object/esm/index.js.map b/node_modules/style-to-object/esm/index.js.map new file mode 100644 index 00000000..5f7670bc --- /dev/null +++ b/node_modules/style-to-object/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,qBAAqB,CAAC;AAcxC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAa,EACb,QAAmB;IAEnB,IAAI,WAAW,GAAuB,IAAI,CAAC;IAE3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC;IAEnD,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACnC,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YACvC,OAAO;QACT,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;QAExC,IAAI,WAAW,EAAE,CAAC;YAChB,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QACzC,CAAC;aAAM,IAAI,KAAK,EAAE,CAAC;YACjB,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;YAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAChC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/node_modules/style-to-object/esm/index.mjs b/node_modules/style-to-object/esm/index.mjs new file mode 100644 index 00000000..9db01cbb --- /dev/null +++ b/node_modules/style-to-object/esm/index.mjs @@ -0,0 +1,41 @@ +import parse from 'inline-style-parser'; + +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +function StyleToObject(style, iterator) { + let styleObject = null; + if (!style || typeof style !== 'string') { + return styleObject; + } + const declarations = parse(style); + const hasIterator = typeof iterator === 'function'; + declarations.forEach((declaration) => { + if (declaration.type !== 'declaration') { + return; + } + const { property, value } = declaration; + if (hasIterator) { + iterator(property, value, declaration); + } + else if (value) { + styleObject = styleObject || {}; + styleObject[property] = value; + } + }); + return styleObject; +} + +export { StyleToObject as default }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/style-to-object/esm/index.mjs.map b/node_modules/style-to-object/esm/index.mjs.map new file mode 100644 index 00000000..4004121a --- /dev/null +++ b/node_modules/style-to-object/esm/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeA;;;;;;;;;;;;;AAaG;AACW,SAAU,aAAa,CACnC,KAAa,EACb,QAAmB,EAAA;IAEnB,IAAI,WAAW,GAAuB,IAAI;IAE1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACvC,QAAA,OAAO,WAAW;IACpB;AAEA,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC;AACjC,IAAA,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU;AAElD,IAAA,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,KAAI;AACnC,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE;YACtC;QACF;AAEA,QAAA,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW;QAEvC,IAAI,WAAW,EAAE;AACf,YAAA,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC;QACxC;aAAO,IAAI,KAAK,EAAE;AAChB,YAAA,WAAW,GAAG,WAAW,IAAI,EAAE;AAC/B,YAAA,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK;QAC/B;AACF,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,WAAW;AACpB;;;;"} \ No newline at end of file diff --git a/node_modules/style-to-object/package.json b/node_modules/style-to-object/package.json new file mode 100644 index 00000000..ea5da984 --- /dev/null +++ b/node_modules/style-to-object/package.json @@ -0,0 +1,92 @@ +{ + "name": "style-to-object", + "version": "1.0.14", + "description": "Parse CSS inline style to JavaScript object.", + "author": "Mark <mark@remarkablemark.org>", + "main": "./cjs/index.js", + "module": "./esm/index.mjs", + "types": "./esm/index.d.ts", + "exports": { + "import": { + "types": "./esm/index.d.ts", + "default": "./esm/index.mjs" + }, + "require": { + "types": "./cjs/index.d.ts", + "default": "./cjs/index.js" + } + }, + "scripts": { + "build": "run-s build:*", + "build:cjs": "tsc --project tsconfig.cjs.json", + "build:esm": "tsc --project tsconfig.json", + "build:umd": "rollup --config --failAfterWarnings", + "clean": "rm -rf cjs coverage dist esm", + "lint": "eslint .", + "lint:fix": "npm run lint -- --fix", + "lint:package": "publint", + "lint:tsc": "tsc --noEmit", + "prepare": "husky", + "prepublishOnly": "run-s lint lint:tsc test clean build", + "test": "jest", + "test:ci": "CI=true jest --ci --colors --coverage", + "test:esm": "npm run build && node --test **/*.test.mjs", + "test:watch": "npm run test -- --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/remarkablemark/style-to-object.git" + }, + "bugs": { + "url": "https://github.com/remarkablemark/style-to-object/issues" + }, + "keywords": [ + "style-to-object", + "inline", + "style", + "parser", + "css", + "object", + "pojo" + ], + "dependencies": { + "inline-style-parser": "0.2.7" + }, + "devDependencies": { + "@commitlint/cli": "20.1.0", + "@commitlint/config-conventional": "20.0.0", + "@eslint/compat": "2.0.0", + "@eslint/eslintrc": "3.3.1", + "@eslint/js": "9.39.1", + "@rollup/plugin-commonjs": "29.0.0", + "@rollup/plugin-node-resolve": "16.0.3", + "@rollup/plugin-terser": "0.4.4", + "@rollup/plugin-typescript": "12.3.0", + "@types/jest": "30.0.0", + "@types/node": "24.10.1", + "@typescript-eslint/eslint-plugin": "8.46.4", + "@typescript-eslint/parser": "8.46.4", + "eslint": "9.39.1", + "eslint-plugin-prettier": "5.5.4", + "eslint-plugin-simple-import-sort": "12.1.1", + "globals": "16.5.0", + "husky": "9.1.7", + "jest": "30.2.0", + "lint-staged": "16.2.6", + "npm-run-all": "4.1.5", + "prettier": "3.6.2", + "publint": "0.3.15", + "rollup": "4.53.2", + "ts-jest": "29.4.5", + "ts-node": "10.9.2", + "tslib": "2.8.1", + "typescript": "5.9.3" + }, + "files": [ + "/cjs", + "/dist", + "/esm", + "/src" + ], + "license": "MIT" +} diff --git a/node_modules/style-to-object/src/index.ts b/node_modules/style-to-object/src/index.ts new file mode 100644 index 00000000..98b95a61 --- /dev/null +++ b/node_modules/style-to-object/src/index.ts @@ -0,0 +1,59 @@ +import type { Declaration } from 'inline-style-parser'; +import parse from 'inline-style-parser'; + +export { Declaration }; + +export interface StyleObject { + [name: string]: string; +} + +type Iterator = ( + property: string, + value: string, + declaration: Declaration, +) => void; + +/** + * Parses inline style to object. + * + * @param style - Inline style. + * @param iterator - Iterator. + * @returns - Style object or null. + * + * @example Parsing inline style to object: + * + * ```js + * import parse from 'style-to-object'; + * parse('line-height: 42;'); // { 'line-height': '42' } + * ``` + */ +export default function StyleToObject( + style: string, + iterator?: Iterator, +): StyleObject | null { + let styleObject: StyleObject | null = null; + + if (!style || typeof style !== 'string') { + return styleObject; + } + + const declarations = parse(style); + const hasIterator = typeof iterator === 'function'; + + declarations.forEach((declaration) => { + if (declaration.type !== 'declaration') { + return; + } + + const { property, value } = declaration; + + if (hasIterator) { + iterator(property, value, declaration); + } else if (value) { + styleObject = styleObject || {}; + styleObject[property] = value; + } + }); + + return styleObject; +} diff --git a/node_modules/trim-lines/index.d.ts b/node_modules/trim-lines/index.d.ts new file mode 100644 index 00000000..05920941 --- /dev/null +++ b/node_modules/trim-lines/index.d.ts @@ -0,0 +1,10 @@ +/** + * Remove initial and final spaces and tabs at the line breaks in `value`. + * Does not trim initial and final spaces and tabs of the value itself. + * + * @param {string} value + * Value to trim. + * @returns {string} + * Trimmed value. + */ +export function trimLines(value: string): string diff --git a/node_modules/trim-lines/index.js b/node_modules/trim-lines/index.js new file mode 100644 index 00000000..52e8feff --- /dev/null +++ b/node_modules/trim-lines/index.js @@ -0,0 +1,69 @@ +const tab = 9 /* `\t` */ +const space = 32 /* ` ` */ + +/** + * Remove initial and final spaces and tabs at the line breaks in `value`. + * Does not trim initial and final spaces and tabs of the value itself. + * + * @param {string} value + * Value to trim. + * @returns {string} + * Trimmed value. + */ +export function trimLines(value) { + const source = String(value) + const search = /\r?\n|\r/g + let match = search.exec(source) + let last = 0 + /** @type {Array<string>} */ + const lines = [] + + while (match) { + lines.push( + trimLine(source.slice(last, match.index), last > 0, true), + match[0] + ) + + last = match.index + match[0].length + match = search.exec(source) + } + + lines.push(trimLine(source.slice(last), last > 0, false)) + + return lines.join('') +} + +/** + * @param {string} value + * Line to trim. + * @param {boolean} start + * Whether to trim the start of the line. + * @param {boolean} end + * Whether to trim the end of the line. + * @returns {string} + * Trimmed line. + */ +function trimLine(value, start, end) { + let startIndex = 0 + let endIndex = value.length + + if (start) { + let code = value.codePointAt(startIndex) + + while (code === tab || code === space) { + startIndex++ + code = value.codePointAt(startIndex) + } + } + + if (end) { + let code = value.codePointAt(endIndex - 1) + + while (code === tab || code === space) { + endIndex-- + code = value.codePointAt(endIndex - 1) + } + } + + return endIndex > startIndex ? value.slice(startIndex, endIndex) : '' +} diff --git a/node_modules/trim-lines/license b/node_modules/trim-lines/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/trim-lines/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <mailto:tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/trim-lines/package.json b/node_modules/trim-lines/package.json new file mode 100644 index 00000000..96371539 --- /dev/null +++ b/node_modules/trim-lines/package.json @@ -0,0 +1,67 @@ +{ + "name": "trim-lines", + "version": "3.0.1", + "description": "Remove spaces and tabs around line-breaks", + "license": "MIT", + "keywords": [ + "space", + "tab", + "line", + "break", + "trim" + ], + "repository": "wooorm/trim-lines", + "bugs": "https://github.com/wooorm/trim-lines/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/tape": "^4.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "rimraf": "^3.0.0", + "tape": "^5.0.0", + "typescript": "^4.0.0", + "xo": "^0.50.0" + }, + "scripts": { + "prepublishOnly": "npm run build && npm run format", + "prebuild": "rimraf \"*.d.ts\"", + "build": "tsc", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node test.js", + "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/trim-lines/readme.md b/node_modules/trim-lines/readme.md new file mode 100644 index 00000000..b3fb32d8 --- /dev/null +++ b/node_modules/trim-lines/readme.md @@ -0,0 +1,125 @@ +# trim-lines + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Remove spaces and tabs around line breaks. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`trimLines(value)`](#trimlinesvalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a tiny utility that removes spaces and tabs around line endings, +keeping the line endings, and not removing whitespace at the start or end of the +string. +It might look trivial, but it’s actually pretty complex to get performant. + +## When should I use this? + +When you need to trim markdown-like whitespace around line endings and don’t +want to run into performance problems. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+, or 18.0+), install with [npm][]: + +```sh +npm install trim-lines +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import trimLines from 'https://esm.sh/trim-lines@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import trimLines from 'https://esm.sh/trim-lines@3?bundle' +</script> +``` + +## Use + +```js +import {trimLines} from 'trim-lines' + +console.log(trimLines(' foo\t\n\n bar \n\tbaz ')) // => ' foo\n\nbar\nbaz ' +``` + +## API + +This package exports the identifier `trimLines`. +There is no default export. + +### `trimLines(value)` + +Remove spaces and tabs around line breaks in `value` (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+, 16.0+, and 18.0+. +It also works in Deno and modern browsers. + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/wooorm/trim-lines/workflows/main/badge.svg + +[build]: https://github.com/wooorm/trim-lines/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-lines.svg + +[coverage]: https://codecov.io/github/wooorm/trim-lines + +[downloads-badge]: https://img.shields.io/npm/dm/trim-lines.svg + +[downloads]: https://www.npmjs.com/package/trim-lines + +[size-badge]: https://img.shields.io/bundlephobia/minzip/trim-lines.svg + +[size]: https://bundlephobia.com/result?p=trim-lines + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ diff --git a/node_modules/trough/index.d.ts b/node_modules/trough/index.d.ts new file mode 100644 index 00000000..ac4ed6e9 --- /dev/null +++ b/node_modules/trough/index.d.ts @@ -0,0 +1,7 @@ +export type Callback = import('./lib/index.js').Callback; +export type Middleware = import('./lib/index.js').Middleware; +export type Pipeline = import('./lib/index.js').Pipeline; +export type Run = import('./lib/index.js').Run; +export type Use = import('./lib/index.js').Use; +export { trough, wrap } from "./lib/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/trough/index.d.ts.map b/node_modules/trough/index.d.ts.map new file mode 100644 index 00000000..d974bc30 --- /dev/null +++ b/node_modules/trough/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"uBACa,OAAO,gBAAgB,EAAE,QAAQ;yBACjC,OAAO,gBAAgB,EAAE,UAAU;uBACnC,OAAO,gBAAgB,EAAE,QAAQ;kBACjC,OAAO,gBAAgB,EAAE,GAAG;kBAC5B,OAAO,gBAAgB,EAAE,GAAG"} \ No newline at end of file diff --git a/node_modules/trough/index.js b/node_modules/trough/index.js new file mode 100644 index 00000000..80d85468 --- /dev/null +++ b/node_modules/trough/index.js @@ -0,0 +1,9 @@ +/** + * @typedef {import('./lib/index.js').Callback} Callback + * @typedef {import('./lib/index.js').Middleware} Middleware + * @typedef {import('./lib/index.js').Pipeline} Pipeline + * @typedef {import('./lib/index.js').Run} Run + * @typedef {import('./lib/index.js').Use} Use + */ + +export {trough, wrap} from './lib/index.js' diff --git a/node_modules/trough/license b/node_modules/trough/license new file mode 100644 index 00000000..3f0166f6 --- /dev/null +++ b/node_modules/trough/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/trough/package.json b/node_modules/trough/package.json new file mode 100644 index 00000000..0dedc06b --- /dev/null +++ b/node_modules/trough/package.json @@ -0,0 +1,77 @@ +{ + "name": "trough", + "version": "2.2.0", + "description": "`trough` is middleware", + "license": "MIT", + "keywords": [ + "middleware", + "ware" + ], + "repository": "wooorm/trough", + "bugs": "https://github.com/wooorm/trough/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^9.0.0", + "prettier": "^3.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.56.0" + }, + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix", + "prepack": "npm run build && npm run format", + "test": "npm run build && npm run format && npm run test-coverage", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api" + }, + "prettier": { + "bracketSpacing": false, + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true, + "#": "some nessecary `any`s", + "ignoreFiles": [ + "lib/index.js", + "lib/index.d.ts" + ] + }, + "xo": { + "prettier": true, + "rules": { + "capitalized-comments": "off" + } + } +} diff --git a/node_modules/trough/readme.md b/node_modules/trough/readme.md new file mode 100644 index 00000000..239fe132 --- /dev/null +++ b/node_modules/trough/readme.md @@ -0,0 +1,494 @@ +# trough + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +`trough` is middleware. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`trough()`](#trough-1) + * [`wrap(middleware, callback)`](#wrapmiddleware-callback) + * [`Callback`](#callback) + * [`Middleware`](#middleware) + * [`Pipeline`](#pipeline) + * [`Run`](#run) + * [`Use`](#use-1) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +`trough` is like [`ware`][github-segmentio-ware] with less sugar. +Middleware functions can also change the input of the next. + +The word **trough** (`/trôf/`) means a channel used to convey a liquid. + +## When should I use this? + +You can use this package when you’re building something that accepts “plugins”, +which are functions, that can be sync or async, promises or callbacks. + +## Install + +This package is [ESM only][github-gist-esm]. +In Node.js (version 16+), +install with [npm][npm-install]: + +```sh +npm install trough +``` + +In Deno with [`esm.sh`][esm-sh]: + +```js +import {trough, wrap} from 'https://esm.sh/trough@2' +``` + +In browsers with [`esm.sh`][esm-sh]: + +```html +<script type="module"> + import {trough, wrap} from 'https://esm.sh/trough@2?bundle' +</script> +``` + +## Use + +```js +import fs from 'node:fs' +import path from 'node:path' +import process from 'node:process' +import {trough} from 'trough' + +const pipeline = trough() + .use(function (fileName) { + console.log('Checking… ' + fileName) + }) + .use(function (fileName) { + return path.join(process.cwd(), fileName) + }) + .use(function (filePath, next) { + fs.stat(filePath, function (error, stats) { + next(error, {filePath, stats}) + }) + }) + .use(function (ctx, next) { + if (ctx.stats.isFile()) { + fs.readFile(ctx.filePath, next) + } else { + next(new Error('Expected file')) + } + }) + +pipeline.run('readme.md', console.log) +pipeline.run('node_modules', console.log) +``` + +Yields: + +```txt +Checking… readme.md +Checking… node_modules +Error: Expected file + at ~/example.js:22:12 + at wrapped (~/node_modules/trough/index.js:111:16) + at next (~/node_modules/trough/index.js:62:23) + at done (~/node_modules/trough/index.js:145:7) + at ~/example.js:15:7 + at FSReqCallback.oncomplete (node:fs:199:5) +null <Buffer 23 20 74 72 6f 75 67 68 0a 0a 5b 21 5b 42 75 69 6c 64 5d 5b 62 75 69 6c 64 2d 62 61 64 67 65 5d 5d 5b 62 75 69 6c 64 5d 0a 5b 21 5b 43 6f 76 65 72 61 ... 7994 more bytes> +``` + +## API + +This package exports the identifiers +[`trough`][api-trough] and +[`wrap`][api-wrap]. +There is no default export. + +It exports the [TypeScript][] types +[`Callback`][api-callback], +[`Middleware`][api-middleware], +[`Pipeline`][api-pipeline], +[`Run`][api-run], +and [`Use`][api-use]. + +### `trough()` + +Create new middleware. + +###### Parameters + +There are no parameters. + +###### Returns + +[`Pipeline`][api-pipeline]. + +### `wrap(middleware, callback)` + +Wrap `middleware` into a uniform interface. + +You can pass all input to the resulting function. +`callback` is then called with the output of `middleware`. + +If `middleware` accepts more arguments than the later given in input, +an extra `done` function is passed to it after that input, +which must be called by `middleware`. + +The first value in `input` is the main input value. +All other input values are the rest input values. +The values given to `callback` are the input values, +merged with every non-nullish output value. + +* if `middleware` throws an error, + returns a promise that is rejected, + or calls the given `done` function with an error, + `callback` is called with that error +* if `middleware` returns a value or returns a promise that is resolved, + that value is the main output value +* if `middleware` calls `done`, + all non-nullish values except for the first one (the error) overwrite the + output values + +###### Parameters + +* `middleware` ([`Middleware`][api-middleware]) + — function to wrap +* `callback` ([`Callback`][api-callback]) + — callback called with the output of `middleware` + +###### Returns + +Wrapped middleware ([`Run`][api-run]). + +### `Callback` + +Callback function (TypeScript type). + +###### Parameters + +* `error` (`Error`, optional) + — error, if any +* `...output` (`Array<unknown>`, optional) + — output values + +###### Returns + +Nothing (`undefined`). + +### `Middleware` + +A middleware function called with the output of its predecessor (TypeScript +type). + +###### Synchronous + +If `fn` returns or throws an error, +the pipeline fails and `done` is called with that error. + +If `fn` returns a value (neither `null` nor `undefined`), +the first `input` of the next function is set to that value +(all other `input` is passed through). + +The following example shows how returning an error stops the pipeline: + +```js +import {trough} from 'trough' + +trough() + .use(function (thing) { + return new Error('Got: ' + thing) + }) + .run('some value', console.log) +``` + +Yields: + +```txt +Error: Got: some value + at ~/example.js:5:12 + … +``` + +The following example shows how throwing an error stops the pipeline: + +```js +import {trough} from 'trough' + +trough() + .use(function (thing) { + throw new Error('Got: ' + thing) + }) + .run('more value', console.log) +``` + +Yields: + +```txt +Error: Got: more value + at ~/example.js:5:11 + … +``` + +The following example shows how the first output can be modified: + +```js +import {trough} from 'trough' + +trough() + .use(function (thing) { + return 'even ' + thing + }) + .run('more value', 'untouched', console.log) +``` + +Yields: + +```txt +null 'even more value' 'untouched' +``` + +###### Promise + +If `fn` returns a promise, +and that promise rejects, +the pipeline fails and `done` is called with the rejected value. + +If `fn` returns a promise, +and that promise resolves with a value (neither `null` nor `undefined`), +the first `input` of the next function is set to that value (all other `input` +is passed through). + +The following example shows how rejecting a promise stops the pipeline: + +```js +import {trough} from 'trough' + +trough() + .use(function (thing) { + return new Promise(function (resolve, reject) { + reject('Got: ' + thing) + }) + }) + .run('thing', console.log) +``` + +Yields: + +```txt +Got: thing +``` + +The following example shows how the input isn’t touched by resolving to `null`. + +```js +import {trough} from 'trough' + +trough() + .use(function () { + return new Promise(function (resolve) { + setTimeout(function () { + resolve(null) + }, 100) + }) + }) + .run('Input', console.log) +``` + +Yields: + +```txt +null 'Input' +``` + +###### Asynchronous + +If `fn` accepts one more argument than the given `input`, +a `next` function is given (after the input). +`next` must be called, but doesn’t have to be called async. + +If `next` is given a value (neither `null` nor `undefined`) as its first +argument, +the pipeline fails and `done` is called with that value. + +If `next` is given no value (either `null` or `undefined`) as the first +argument, +all following non-nullish values change the input of the following +function, +and all nullish values default to the `input`. + +The following example shows how passing a first argument stops the pipeline: + +```js +import {trough} from 'trough' + +trough() + .use(function (thing, next) { + next(new Error('Got: ' + thing)) + }) + .run('thing', console.log) +``` + +Yields: + +```txt +Error: Got: thing + at ~/example.js:5:10 +``` + +The following example shows how more values than the input are passed. + +```js +import {trough} from 'trough' + +trough() + .use(function (thing, next) { + setTimeout(function () { + next(null, null, 'values') + }, 100) + }) + .run('some', console.log) +``` + +Yields: + +```txt +null 'some' 'values' +``` + +###### Parameters + +* `...input` (`Array<any>`, optional) + — input values + +###### Returns + +Output, promise, etc (`any`). + +### `Pipeline` + +Pipeline (TypeScript type). + +###### Properties + +* `run` ([`Run`][api-run]) + — run the pipeline +* `use` ([`Use`][api-use]) + — add middleware + +### `Run` + +Call all middleware (TypeScript type). + +Calls `done` on completion with either an error or the output of the +last middleware. + +> 👉 **Note**: as the length of input defines whether async functions get a +> `next` function, +> it’s recommended to keep `input` at one value normally. + +###### Parameters + +* `...input` (`Array<any>`, optional) + — input values +* `done` ([`Callback`][api-callback]) + — callback called when done + +###### Returns + +Nothing (`undefined`). + +### `Use` + +Add middleware (TypeScript type). + +###### Parameters + +* `middleware` ([`Middleware`][api-middleware]) + — middleware function + +###### Returns + +Current pipeline ([`Pipeline`][api-pipeline]). + +## Compatibility + +This projects is compatible with maintained versions of Node.js. + +When we cut a new major release, +we drop support for unmaintained versions of Node. +This means we try to keep the current release line, +`trough@2`, +compatible with Node.js 12. + +## Security + +This package is safe. + +## Contribute + +Yes please! +See [How to Contribute to Open Source][open-source-guide-contribute]. + +## License + +[MIT][file-license] © [Titus Wormer][wooorm] + +<!-- Definitions --> + +[api-callback]: #callback + +[api-middleware]: #middleware + +[api-pipeline]: #pipeline + +[api-run]: #run + +[api-trough]: #trough + +[api-use]: #use + +[api-wrap]: #wrapmiddleware-callback + +[badge-build-image]: https://github.com/wooorm/trough/workflows/main/badge.svg + +[badge-build-url]: https://github.com/wooorm/trough/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/wooorm/trough.svg + +[badge-coverage-url]: https://codecov.io/github/wooorm/trough + +[badge-downloads-image]: https://img.shields.io/npm/dm/trough.svg + +[badge-downloads-url]: https://www.npmjs.com/package/trough + +[badge-size-image]: https://img.shields.io/bundlejs/size/trough + +[badge-size-url]: https://bundlejs.com/?q=trough + +[npm-install]: https://docs.npmjs.com/cli/install + +[esm-sh]: https://esm.sh + +[file-license]: license + +[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[github-segmentio-ware]: https://github.com/segmentio/ware + +[open-source-guide-contribute]: https://opensource.guide/how-to-contribute/ + +[typescript]: https://www.typescriptlang.org + +[wooorm]: https://wooorm.com diff --git a/node_modules/unified/index.d.ts b/node_modules/unified/index.d.ts new file mode 100644 index 00000000..08d53e38 --- /dev/null +++ b/node_modules/unified/index.d.ts @@ -0,0 +1,106 @@ +import type {Value} from 'vfile' +import type {CompileResults} from './lib/index.js' + +export type { + // `CompileResultMap` is typed and exposed below. + CompileResults, + Compiler, + // `Data` is typed and exposed below. + Parser, + Pluggable, + PluggableList, + Plugin, + PluginTuple, + Preset, + ProcessCallback, + Processor, + RunCallback, + // `Settings` is typed and exposed below. + TransformCallback, + Transformer +} from './lib/index.js' + +export {unified} from './lib/index.js' + +// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts> +declare const emptyObjectSymbol: unique symbol + +/** + * Interface of known results from compilers. + * + * Normally, compilers result in text ({@linkcode Value} of `vfile`). + * When you compile to something else, such as a React node (as in, + * `rehype-react`), you can augment this interface to include that type. + * + * ```ts + * import type {ReactNode} from 'somewhere' + * + * declare module 'unified' { + * interface CompileResultMap { + * // Register a new result (value is used, key should match it). + * ReactNode: ReactNode + * } + * } + * + * export {} // You may not need this, but it makes sure the file is a module. + * ``` + * + * Use {@linkcode CompileResults} to access the values. + */ +export interface CompileResultMap { + // Note: if `Value` from `VFile` is changed, this should too. + Uint8Array: Uint8Array + string: string +} + +/** + * Interface of known data that can be supported by all plugins. + * + * Typically, options can be given to a specific plugin, but sometimes it makes + * sense to have information shared with several plugins. + * For example, a list of HTML elements that are self-closing, which is needed + * during all phases. + * + * To type this, do something like: + * + * ```ts + * declare module 'unified' { + * interface Data { + * htmlVoidElements?: Array<string> | undefined + * } + * } + * + * export {} // You may not need this, but it makes sure the file is a module. + * ``` + */ +export interface Data { + settings?: Settings | undefined +} + +/** + * Interface of known extra options, that can be supported by parser and + * compilers. + * + * This exists so that users can use packages such as `remark`, which configure + * both parsers and compilers (in this case `remark-parse` and + * `remark-stringify`), and still provide options for them. + * + * When you make parsers or compilers, that could be packaged up together, + * you should support `this.data('settings')` as input and merge it with + * explicitly passed `options`. + * Then, to type it, using `remark-stringify` as an example, do something like: + * + * ```ts + * declare module 'unified' { + * interface Settings { + * bullet: '*' | '+' | '-' + * // … + * } + * } + * + * export {} // You may not need this, but it makes sure the file is a module. + * ``` + */ +export interface Settings { + [emptyObjectSymbol]?: never +} diff --git a/node_modules/unified/index.js b/node_modules/unified/index.js new file mode 100644 index 00000000..43197543 --- /dev/null +++ b/node_modules/unified/index.js @@ -0,0 +1,2 @@ +// Note: types exposed from `index.d.ts`. +export {unified} from './lib/index.js' diff --git a/node_modules/unified/license b/node_modules/unified/license new file mode 100644 index 00000000..f3722d94 --- /dev/null +++ b/node_modules/unified/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/unified/package.json b/node_modules/unified/package.json new file mode 100644 index 00000000..7d359e43 --- /dev/null +++ b/node_modules/unified/package.json @@ -0,0 +1,120 @@ +{ + "name": "unified", + "version": "11.0.5", + "description": "parse, inspect, transform, and serialize content through syntax trees", + "license": "MIT", + "keywords": [ + "ast", + "compile", + "content", + "cst", + "parse", + "process", + "rehype", + "remark", + "retext", + "serialize", + "stringify", + "syntax", + "transform", + "tree", + "unified" + ], + "homepage": "https://unifiedjs.com", + "repository": "unifiedjs/unified", + "bugs": "https://github.com/unifiedjs/unified/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Junyoung Choi <fluke8259@gmail.com>", + "Hernan Rajchert <hrajchert@gmail.com>", + "Christian Murphy <christian.murphy.42@gmail.com>", + "Vse Mozhet Byt <vsemozhetbyt@gmail.com>", + "Richard Littauer <richard.littauer@gmail.com>" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "devDependencies": { + "@types/extend": "^3.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "tsd": "^0.31.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "build": "tsc --build --clean && tsc --build && node script/fix-types.js && type-coverage && tsd", + "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix", + "prepack": "npm run build && npm run format", + "test": "npm run build && npm run format && npm run test-coverage", + "test-api": "node --conditions development test/index.js", + "test-coverage": "c8 --100 --check-coverage --reporter lcov npm run test-api" + }, + "prettier": { + "bracketSpacing": false, + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm", + [ + "remark-lint-no-html", + false + ] + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/naming-convention": "off", + "import/no-duplicates": "off" + } + } + ], + "prettier": true, + "rules": { + "unicorn/no-this-assignment": "off" + } + } +} diff --git a/node_modules/unified/readme.md b/node_modules/unified/readme.md new file mode 100644 index 00000000..d175d7f6 --- /dev/null +++ b/node_modules/unified/readme.md @@ -0,0 +1,1835 @@ +# [![unified][logo]][site] + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**unified** lets you inspect and transform content with plugins. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [Overview](#overview) +* [API](#api) + * [`processor()`](#processor) + * [`processor.compiler`](#processorcompiler) + * [`processor.data([key[, value]])`](#processordatakey-value) + * [`processor.freeze()`](#processorfreeze) + * [`processor.parse(file)`](#processorparsefile) + * [`processor.parser`](#processorparser) + * [`processor.process(file[, done])`](#processorprocessfile-done) + * [`processor.processSync(file)`](#processorprocesssyncfile) + * [`processor.run(tree[, file][, done])`](#processorruntree-file-done) + * [`processor.runSync(tree[, file])`](#processorrunsynctree-file) + * [`processor.stringify(tree[, file])`](#processorstringifytree-file) + * [`processor.use(plugin[, options])`](#processoruseplugin-options) + * [`CompileResultMap`](#compileresultmap) + * [`CompileResults`](#compileresults) + * [`Compiler`](#compiler) + * [`Data`](#data) + * [`Parser`](#parser) + * [`Pluggable`](#pluggable) + * [`PluggableList`](#pluggablelist) + * [`Plugin`](#plugin) + * [`PluginTuple`](#plugintuple) + * [`Preset`](#preset) + * [`ProcessCallback`](#processcallback) + * [`Processor`](#processor-1) + * [`RunCallback`](#runcallback) + * [`Settings`](#settings) + * [`TransformCallback`](#transformcallback) + * [`Transformer`](#transformer) +* [Types](#types) +* [Compatibility](#compatibility) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [Acknowledgments](#acknowledgments) +* [License](#license) + +## What is this? + +unified is two things: + +* **unified** is a collective of 500+ free and open source packages that work + with content as structured data (ASTs) +* `unified` (this project) is the core package, used in 1.3m+ projects on GH, + to process content with plugins + +Several ecosystems are built on unified around different kinds of content. +Notably, [remark][] (markdown), [rehype][] (HTML), and [retext][] (natural +language). +These ecosystems can be connected together. + +* for more about us, see [`unifiedjs.com`][site] +* for updates, see [@unifiedjs][twitter] on Twitter +* for questions, see [support][] +* to help, see [contribute][] and [sponsor][] below + +## When should I use this? + +In some cases, you are already using unified. +For example, it’s used in MDX, Gatsby, Docusaurus, etc. +In those cases, you don’t need to add `unified` yourself but you can include +plugins into those projects. + +But the real fun (for some) is to get your hands dirty and work with syntax +trees and build with it yourself. +You can create those projects, or things like Prettier, or your own site +generator. +You can connect utilities together and make your own plugins that check for +problems and transform from one thing to another. + +When you are dealing with one type of content (such as markdown), you can use +the main package of that ecosystem instead (so `remark`). +When you are dealing with different kinds of content (such as markdown and +HTML), it’s recommended to use `unified` itself, and pick and choose the plugins +you need. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unified +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {unified} from 'https://esm.sh/unified@11' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {unified} from 'https://esm.sh/unified@11?bundle' +</script> +``` + +## Use + +```js +import rehypeDocument from 'rehype-document' +import rehypeFormat from 'rehype-format' +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeDocument, {title: '👋🌍'}) + .use(rehypeFormat) + .use(rehypeStringify) + .process('# Hello world!') + +console.error(reporter(file)) +console.log(String(file)) +``` + +Yields: + +```txt +no issues found +``` + +```html +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>👋🌍</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + </head> + <body> + <h1>Hello world!</h1> + </body> +</html> +``` + +<!-- Old name: --> + +<a name="description"></a> + +## Overview + +`unified` is an interface for processing content with syntax trees. +Syntax trees are a representation of content understandable to programs. +Those programs, called *[plugins][api-plugin]*, take these trees and inspect and +modify them. +To get to the syntax tree from text, there is a *[parser][api-parser]*. +To get from that back to text, there is a *[compiler][api-compiler]*. +This is the *[process][api-process]* of a *processor*. + +```ascii +| ........................ process ........................... | +| .......... parse ... | ... run ... | ... stringify ..........| + + +--------+ +----------+ +Input ->- | Parser | ->- Syntax Tree ->- | Compiler | ->- Output + +--------+ | +----------+ + X + | + +--------------+ + | Transformers | + +--------------+ +``` + +###### Processors + +Processors process content. +On its own, `unified` (the root processor) doesn’t work. +It needs to be configured with plugins to work. +For example: + +```js +const processor = unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeDocument, {title: '👋🌍'}) + .use(rehypeFormat) + .use(rehypeStringify) +``` + +That processor can do different things. +It can: + +* …parse markdown (`parse`) +* …turn parsed markdown into HTML and format the HTML (`run`) +* …compile HTML (`stringify`) +* …do all of the above (`process`) + +Every processor implements another processor. +To create a processor, call another processor. +The new processor is configured to work the same as its ancestor. +But when the descendant processor is configured in the future it does not affect +the ancestral processor. + +When processors are exposed from a module (for example, `unified` itself) they +should not be configured directly, as that would change their behavior for all +module users. +Those processors are *[frozen][api-freeze]* and they should be called to create +a new processor before they are used. + +###### File + +When processing a document, metadata is gathered about that document. +[`vfile`][vfile] is the file format that stores data, metadata, and messages +about files for unified and plugins. + +There are several [utilities][vfile-utilities] for working with these files. + +###### Syntax tree + +The syntax trees used in unified are [unist][] nodes. +A tree represents a whole document and each [node][] is a plain JavaScript +object with a `type` field. +The semantics of nodes and the format of syntax trees is defined by other +projects: + +* [esast][] — JavaScript +* [hast][] — HTML +* [mdast][] — markdown +* [nlcst][] — natural language +* [xast][] — XML + +There are many utilities for working with trees listed in each aforementioned +project and maintained in the [`syntax-tree`][syntax-tree] organization. +These utilities are a level lower than unified itself and are building blocks +that can be used to make plugins. + +<!-- Old name: --> + +<a name="list-of-processors"></a> + +###### Ecosystems + +Around each syntax tree is an ecosystem that focusses on that particular kind +of content. +At their core, they parse text to a tree and compile that tree back to text. +They also provide plugins that work with the syntax tree, without requiring +that the end user has knowledge about that tree. + +* [rehype][] (hast) — HTML +* [remark][] (mdast) — markdown +* [retext][] (nlcst) — natural language + +<a name="list-of-plugins"></a> + +###### Plugins + +Each aforementioned ecosystem comes with a large set of plugins that you can +pick and choose from to do all kinds of things. + +* [List of remark plugins][remark-plugins] · + [`remarkjs/awesome-remark`][awesome-remark] · + [`remark-plugin` topic][topic-remark-plugin] +* [List of rehype plugins][rehype-plugins] · + [`rehypejs/awesome-rehype`][awesome-rehype] · + [`rehype-plugin` topic][topic-rehype-plugin] +* [List of retext plugins][retext-plugins] · + [`retextjs/awesome-retext`][awesome-retext] · + [`retext-plugin` topic][topic-retext-plugin] + +There are also a few plugins that work in any ecosystem: + +* [`unified-diff`](https://github.com/unifiedjs/unified-diff) + — ignore unrelated messages in GitHub Actions and Travis +* [`unified-infer-git-meta`](https://github.com/unifiedjs/unified-infer-git-meta) + — infer metadata of a document from Git +* [`unified-message-control`](https://github.com/unifiedjs/unified-message-control) + — enable, disable, and ignore messages from content + +###### Configuration + +Processors are configured with [plugins][api-plugin] or with the +[`data`][api-data] method. +Most plugins also accept configuration through options. +See each plugin’s readme for more info. + +###### Integrations + +unified can integrate with the file system through +[`unified-engine`][unified-engine]. +CLI apps can be created with [`unified-args`][unified-args], Gulp plugins with +[`unified-engine-gulp`][unified-engine-gulp], and language servers with +[`unified-language-server`][unified-language-server]. +A streaming interface can be created with [`unified-stream`][unified-stream]. + +###### Programming interface + +The [API][] provided by `unified` allows multiple files to be processed and +gives access to metadata (such as lint messages): + +```js +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkPresetLintMarkdownStyleGuide from 'remark-preset-lint-markdown-style-guide' +import remarkRehype from 'remark-rehype' +import remarkRetext from 'remark-retext' +import retextEnglish from 'retext-english' +import retextEquality from 'retext-equality' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' + +const file = await unified() + .use(remarkParse) + .use(remarkPresetLintMarkdownStyleGuide) + .use(remarkRetext, unified().use(retextEnglish).use(retextEquality)) + .use(remarkRehype) + .use(rehypeStringify) + .process('*Emphasis* and _stress_, you guys!') + +console.error(reporter(file)) +console.log(String(file)) +``` + +Yields: + +```txt +1:16-1:24 warning Emphasis should use `*` as a marker emphasis-marker remark-lint +1:30-1:34 warning `guys` may be insensitive, use `people`, `persons`, `folks` instead gals-man retext-equality + +⚠ 2 warnings +``` + +```html +<p><em>Emphasis</em> and <em>stress</em>, you guys!</p> +``` + +<!-- Old name: --> + +<a name="processing-between-syntaxes"></a> + +###### Transforming between ecosystems + +Ecosystems can be combined in two modes. + +**Bridge** mode transforms the tree from one format (*origin*) to another +(*destination*). +A different processor runs on the destination tree. +Afterwards, the original processor continues with the origin tree. + +**Mutate** mode also transforms the syntax tree from one format to another. +But the original processor continues transforming the destination tree. + +In the previous example (“Programming interface”), `remark-retext` is used in +bridge mode: the origin syntax tree is kept after retext is done; whereas +`remark-rehype` is used in mutate mode: it sets a new syntax tree and discards +the origin tree. + +The following plugins lets you combine ecosystems: + +* [`remark-retext`][remark-retext] — turn markdown into natural language +* [`remark-rehype`][remark-rehype] — turn markdown into HTML +* [`rehype-retext`][rehype-retext] — turn HTML into natural language +* [`rehype-remark`][rehype-remark] — turn HTML into markdown + +## API + +This package exports the identifier `unified` (the root `processor`). +There is no default export. + +### `processor()` + +Create a new processor. + +###### Returns + +New *[unfrozen][api-freeze]* processor ([`processor`][api-processor]). + +This processor is configured to work the same as its ancestor. +When the descendant processor is configured in the future it does not affect +the ancestral processor. + +###### Example + +This example shows how a new processor can be created (from `remark`) and linked +to **stdin**(4) and **stdout**(4). + +```js +import process from 'node:process' +import concatStream from 'concat-stream' +import {remark} from 'remark' + +process.stdin.pipe( + concatStream(function (buf) { + process.stdout.write(String(remark().processSync(buf))) + }) +) +``` + +### `processor.compiler` + +Compiler to use ([`Compiler`][api-compiler], optional). + +### `processor.data([key[, value]])` + +Configure the processor with info available to all plugins. +Information is stored in an object. + +Typically, options can be given to a specific plugin, but sometimes it makes +sense to have information shared with several plugins. +For example, a list of HTML elements that are self-closing, which is needed +during all [phases][overview]. + +> 👉 **Note**: setting information cannot occur on *[frozen][api-freeze]* +> processors. +> Call the processor first to create a new unfrozen processor. + +> 👉 **Note**: to register custom data in TypeScript, augment the +> [`Data`][api-data] interface. + +###### Signatures + +* `processor = processor.data(key, value)` +* `processor = processor.data(dataset)` +* `value = processor.data(key)` +* `dataset = processor.data()` + +###### Parameters + +* `key` ([`keyof Data`][api-data], optional) — field to get +* `value` ([`Data[key]`][api-data]) — value to set +* `values` ([`Data`][api-data]) — values to set + +###### Returns + +The current processor when setting ([`processor`][api-processor]), the value at +`key` when getting ([`Data[key]`][api-data]), or the entire dataset when +getting without key ([`Data`][api-data]). + +###### Example + +This example show how to get and set info: + +```js +import {unified} from 'unified' + +const processor = unified().data('alpha', 'bravo') + +processor.data('alpha') // => 'bravo' + +processor.data() // => {alpha: 'bravo'} + +processor.data({charlie: 'delta'}) + +processor.data() // => {charlie: 'delta'} +``` + +### `processor.freeze()` + +Freeze a processor. + +Frozen processors are meant to be extended and not to be configured directly. + +When a processor is frozen it cannot be unfrozen. +New processors working the same way can be created by calling the processor. + +It’s possible to freeze processors explicitly by calling `.freeze()`. +Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`, +`.stringify()`, `.process()`, or `.processSync()` are called. + +###### Returns + +The current processor ([`processor`][api-processor]). + +###### Example + +This example, `index.js`, shows how `rehype` prevents extensions to itself: + +```js +import rehypeParse from 'rehype-parse' +import rehypeStringify from 'rehype-stringify' +import {unified} from 'unified' + +export const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze() +``` + +That processor can be used and configured like so: + +```js +import {rehype} from 'rehype' +import rehypeFormat from 'rehype-format' +// … + +rehype() + .use(rehypeFormat) + // … +``` + +A similar looking example is broken as operates on the frozen interface. +If this behavior was allowed it would result in unexpected behavior so an error +is thrown. +**This is not valid**: + +```js +import {rehype} from 'rehype' +import rehypeFormat from 'rehype-format' +// … + +rehype + .use(rehypeFormat) + // … +``` + +Yields: + +```txt +~/node_modules/unified/index.js:426 + throw new Error( + ^ + +Error: Cannot call `use` on a frozen processor. +Create a new processor first, by calling it: use `processor()` instead of `processor`. + at assertUnfrozen (~/node_modules/unified/index.js:426:11) + at Function.use (~/node_modules/unified/index.js:165:5) + … +``` + +### `processor.parse(file)` + +Parse text to a syntax tree. + +> 👉 **Note**: `parse` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `parse` performs the [parse phase][overview], not the run phase +> or other phases. + +###### Parameters + +* `file` ([`Compatible`][vfile-compatible]) — file to parse; typically + `string` or [`VFile`][vfile]; any value accepted as `x` in `new VFile(x)` + +###### Returns + +Syntax tree representing `file` ([`Node`][node]). + +###### Example + +This example shows how `parse` can be used to create a tree from a file. + +```js +import remarkParse from 'remark-parse' +import {unified} from 'unified' + +const tree = unified().use(remarkParse).parse('# Hello world!') + +console.log(tree) +``` + +Yields: + +```js +{ + type: 'root', + children: [ + {type: 'heading', depth: 1, children: [Array], position: [Object]} + ], + position: { + start: {line: 1, column: 1, offset: 0}, + end: {line: 1, column: 15, offset: 14} + } +} +``` + +### `processor.parser` + +Parser to use ([`Parser`][api-parser], optional). + +### `processor.process(file[, done])` + +Process the given file as configured on the processor. + +> 👉 **Note**: `process` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `process` performs the [parse, run, and stringify +> phases][overview]. + +###### Signatures + +* `processor.process(file, done)` +* `Promise<VFile> = processor.process(file?)` + +###### Parameters + +* `file` ([`Compatible`][vfile-compatible], optional) — file; typically + `string` or [`VFile`][vfile]; any value accepted as `x` in `new VFile(x)` +* `done` ([`ProcessCallback`][api-process-callback], optional) — callback + +###### Returns + +Nothing if `done` is given (`undefined`). +Otherwise a promise, rejected with a fatal error or resolved with the +processed file ([`Promise<VFile>`][vfile]). + +The parsed, transformed, and compiled value is available at `file.value` (see +note). + +> 👉 **Note**: unified typically compiles by serializing: most +> compilers return `string` (or `Uint8Array`). +> Some compilers, such as the one configured with +> [`rehype-react`][rehype-react], return other values (in this case, a React +> tree). +> If you’re using a compiler that doesn’t serialize, expect different result +> values. +> +> To register custom results in TypeScript, add them to +> [`CompileResultMap`][api-compile-result-map]. + +###### Example + +This example shows how `process` can be used to process a file: + +```js +import rehypeDocument from 'rehype-document' +import rehypeFormat from 'rehype-format' +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeDocument, {title: '👋🌍'}) + .use(rehypeFormat) + .use(rehypeStringify) + .process('# Hello world!') + +console.log(String(file)) +``` + +Yields: + +```html +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>👋🌍</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + </head> + <body> + <h1>Hello world!</h1> + </body> +</html> +``` + +### `processor.processSync(file)` + +Process the given file as configured on the processor. + +An error is thrown if asynchronous transforms are configured. + +> 👉 **Note**: `processSync` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `processSync` performs the [parse, run, and stringify +> phases][overview]. + +###### Parameters + +* `file` ([`Compatible`][vfile-compatible], optional) — file; typically + `string` or [`VFile`][vfile]; any value accepted as `x` in `new VFile(x)` + +###### Returns + +The processed file ([`VFile`][vfile]). + +The parsed, transformed, and compiled value is available at `file.value` (see +note). + +> 👉 **Note**: unified typically compiles by serializing: most +> compilers return `string` (or `Uint8Array`). +> Some compilers, such as the one configured with +> [`rehype-react`][rehype-react], return other values (in this case, a React +> tree). +> If you’re using a compiler that doesn’t serialize, expect different result +> values. +> +> To register custom results in TypeScript, add them to +> [`CompileResultMap`][api-compile-result-map]. + +###### Example + +This example shows how `processSync` can be used to process a file, if all +transformers are synchronous. + +```js +import rehypeDocument from 'rehype-document' +import rehypeFormat from 'rehype-format' +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {unified} from 'unified' + +const processor = unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeDocument, {title: '👋🌍'}) + .use(rehypeFormat) + .use(rehypeStringify) + +console.log(String(processor.processSync('# Hello world!'))) +``` + +Yields: + +```html +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>👋🌍</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + </head> + <body> + <h1>Hello world!</h1> + </body> +</html> +``` + +### `processor.run(tree[, file][, done])` + +Run *[transformers][api-transformer]* on a syntax tree. + +> 👉 **Note**: `run` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `run` performs the [run phase][overview], not other phases. + +###### Signatures + +* `processor.run(tree, done)` +* `processor.run(tree, file, done)` +* `Promise<Node> = processor.run(tree, file?)` + +###### Parameters + +* `tree` ([`Node`][node]) — tree to transform and inspect +* `file` ([`Compatible`][vfile-compatible], optional) — file associated + with `node`; any value accepted as `x` in `new VFile(x)` +* `done` ([`RunCallback`][api-run-callback], optional) — callback + +###### Returns + +Nothing if `done` is given (`undefined`). +Otherwise, a promise rejected with a fatal error or resolved with the +transformed tree ([`Promise<Node>`][node]). + +###### Example + +This example shows how `run` can be used to transform a tree: + +```js +import remarkReferenceLinks from 'remark-reference-links' +import {unified} from 'unified' +import {u} from 'unist-builder' + +const tree = u('root', [ + u('paragraph', [ + u('link', {href: 'https://example.com'}, [u('text', 'Example Domain')]) + ]) +]) + +const changedTree = await unified().use(remarkReferenceLinks).run(tree) + +console.log(changedTree) +``` + +Yields: + +```js +{ + type: 'root', + children: [ + {type: 'paragraph', children: [Array]}, + {type: 'definition', identifier: '1', title: '', url: undefined} + ] +} +``` + +### `processor.runSync(tree[, file])` + +Run *[transformers][api-transformer]* on a syntax tree. + +An error is thrown if asynchronous transforms are configured. + +> 👉 **Note**: `runSync` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `runSync` performs the [run phase][overview], not other phases. + +###### Parameters + +* `tree` ([`Node`][node]) — tree to transform and inspect +* `file` ([`Compatible`][vfile-compatible], optional) — file associated + with `node`; any value accepted as `x` in `new VFile(x)` + +###### Returns + +Transformed tree ([`Node`][node]). + +### `processor.stringify(tree[, file])` + +Compile a syntax tree. + +> 👉 **Note**: `stringify` freezes the processor if not already +> *[frozen][api-freeze]*. + +> 👉 **Note**: `stringify` performs the [stringify phase][overview], not the run +> phase or other phases. + +###### Parameters + +* `tree` ([`Node`][node]) — tree to compile +* `file` ([`Compatible`][vfile-compatible], optional) — file associated + with `node`; any value accepted as `x` in `new VFile(x)` + +###### Returns + +Textual representation of the tree (`Uint8Array` or `string`, see note). + +> 👉 **Note**: unified typically compiles by serializing: most compilers +> return `string` (or `Uint8Array`). +> Some compilers, such as the one configured with +> [`rehype-react`][rehype-react], return other values (in this case, a +> React tree). +> If you’re using a compiler that doesn’t serialize, expect different +> result values. +> +> To register custom results in TypeScript, add them to +> [`CompileResultMap`][api-compile-result-map]. + +###### Example + +This example shows how `stringify` can be used to serialize a syntax tree: + +```js +import {h} from 'hastscript' +import rehypeStringify from 'rehype-stringify' +import {unified} from 'unified' + +const tree = h('h1', 'Hello world!') + +const document = unified().use(rehypeStringify).stringify(tree) + +console.log(document) +``` + +Yields: + +```html +<h1>Hello world!</h1> +``` + +### `processor.use(plugin[, options])` + +Configure the processor to use a plugin, a list of usable values, or a preset. + +If the processor is already using a plugin, the previous plugin configuration +is changed based on the options that are passed in. +In other words, the plugin is not added a second time. + +> 👉 **Note**: `use` cannot be called on [*frozen*][api-freeze] processors. +> Call the processor first to create a new unfrozen processor. + +###### Signatures + +* `processor.use(preset?)` +* `processor.use(list)` +* `processor.use(plugin[, ...parameters])` + +###### Parameters + +* `preset` ([`Preset`][api-preset]) — plugins and settings +* `list` ([`PluggableList`][api-pluggable-list]) — list of usable things +* `plugin` ([`Plugin`][api-plugin]) — plugin +* `parameters` (`Array<unknown>`) — configuration for `plugin`, typically a + single options object + +###### Returns + +Current processor ([`processor`][api-processor]). + +###### Example + +There are many ways to pass plugins to `.use()`. +This example gives an overview: + +```js +import {unified} from 'unified' + +unified() + // Plugin with options: + .use(pluginA, {x: true, y: true}) + // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`): + .use(pluginA, {y: false, z: true}) + // Plugins: + .use([pluginB, pluginC]) + // Two plugins, the second with options: + .use([pluginD, [pluginE, {}]]) + // Preset with plugins and settings: + .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}}) + // Settings only: + .use({settings: {position: false}}) +``` + +### `CompileResultMap` + +Interface of known results from compilers (TypeScript type). + +Normally, compilers result in text ([`Value`][vfile-value] of `vfile`). +When you compile to something else, such as a React node (as in, +`rehype-react`), you can augment this interface to include that type. + +```ts +import type {ReactNode} from 'somewhere' + +declare module 'unified' { + interface CompileResultMap { + // Register a new result (value is used, key should match it). + ReactNode: ReactNode + } +} + +export {} // You may not need this, but it makes sure the file is a module. +``` + +Use [`CompileResults`][api-compile-results] to access the values. + +###### Type + +```ts +interface CompileResultMap { + // Note: if `Value` from `VFile` is changed, this should too. + Uint8Array: Uint8Array + string: string +} +``` + +### `CompileResults` + +Acceptable results from compilers (TypeScript type). + +To register custom results, add them to +[`CompileResultMap`][api-compile-result-map]. + +###### Type + +```ts +type CompileResults = CompileResultMap[keyof CompileResultMap] +``` + +### `Compiler` + +A **compiler** handles the compiling of a syntax tree to something else +(in most cases, text) (TypeScript type). + +It is used in the stringify phase and called with a [`Node`][node] +and [`VFile`][vfile] representation of the document to compile. +It should return the textual representation of the given tree (typically +`string`). + +> 👉 **Note**: unified typically compiles by serializing: most compilers +> return `string` (or `Uint8Array`). +> Some compilers, such as the one configured with +> [`rehype-react`][rehype-react], return other values (in this case, a +> React tree). +> If you’re using a compiler that doesn’t serialize, expect different +> result values. +> +> To register custom results in TypeScript, add them to +> [`CompileResultMap`][api-compile-result-map]. + +###### Type + +```ts +type Compiler< + Tree extends Node = Node, + Result extends CompileResults = CompileResults +> = (tree: Tree, file: VFile) => Result +``` + +### `Data` + +Interface of known data that can be supported by all plugins (TypeScript type). + +Typically, options can be given to a specific plugin, but sometimes it makes +sense to have information shared with several plugins. +For example, a list of HTML elements that are self-closing, which is needed +during all phases. + +To type this, do something like: + +```ts +declare module 'unified' { + interface Data { + htmlVoidElements?: Array<string> | undefined + } +} + +export {} // You may not need this, but it makes sure the file is a module. +``` + +###### Type + +```ts +interface Data { + settings?: Settings | undefined +} +``` + +See [`Settings`][api-settings] for more info. + +### `Parser` + +A **parser** handles the parsing of text to a syntax tree (TypeScript type). + +It is used in the parse phase and is called with a `string` and +[`VFile`][vfile] of the document to parse. +It must return the syntax tree representation of the given file +([`Node`][node]). + +###### Type + +```ts +type Parser<Tree extends Node = Node> = (document: string, file: VFile) => Tree +``` + +### `Pluggable` + +Union of the different ways to add plugins and settings (TypeScript type). + +###### Type + +```ts +type Pluggable = + | Plugin<Array<any>, any, any> + | PluginTuple<Array<any>, any, any> + | Preset +``` + +See [`Plugin`][api-plugin], [`PluginTuple`][api-plugin-tuple], +and [`Preset`][api-preset] for more info. + +### `PluggableList` + +List of plugins and presets (TypeScript type). + +###### Type + +```ts +type PluggableList = Array<Pluggable> +``` + +See [`Pluggable`][api-pluggable] for more info. + +### `Plugin` + +Single plugin (TypeScript type). + +Plugins configure the processors they are applied on in the following ways: + +* they change the processor, such as the parser, the compiler, or by + configuring data +* they specify how to handle trees and files + +In practice, they are functions that can receive options and configure the +processor (`this`). + +> 👉 **Note**: plugins are called when the processor is *frozen*, not when they +> are applied. + +###### Type + +```ts +type Plugin< + PluginParameters extends unknown[] = [], + Input extends Node | string | undefined = Node, + Output = Input +> = ( + this: Processor, + ...parameters: PluginParameters +) => Input extends string // Parser. + ? Output extends Node | undefined + ? undefined | void + : never + : Output extends CompileResults // Compiler. + ? Input extends Node | undefined + ? undefined | void + : never + : // Inspect/transform. + | Transformer< + Input extends Node ? Input : Node, + Output extends Node ? Output : Node + > + | undefined + | void +``` + +See [`Transformer`][api-transformer] for more info. + +###### Example + +`move.js`: + +```js +/** + * @typedef Options + * Configuration (required). + * @property {string} extname + * File extension to use (must start with `.`). + */ + +/** @type {import('unified').Plugin<[Options]>} */ +export function move(options) { + if (!options || !options.extname) { + throw new Error('Missing `options.extname`') + } + + return function (_, file) { + if (file.extname && file.extname !== options.extname) { + file.extname = options.extname + } + } +} +``` + +`example.md`: + +```markdown +# Hello, world! +``` + +`example.js`: + +```js +import rehypeStringify from 'rehype-stringify' +import remarkParse from 'remark-parse' +import remarkRehype from 'remark-rehype' +import {read, write} from 'to-vfile' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' +import {move} from './move.js' + +const file = await unified() + .use(remarkParse) + .use(remarkRehype) + .use(move, {extname: '.html'}) + .use(rehypeStringify) + .process(await read('example.md')) + +console.error(reporter(file)) +await write(file) // Written to `example.html`. +``` + +Yields: + +```txt +example.md: no issues found +``` + +…and in `example.html`: + +```html +<h1>Hello, world!</h1> +``` + +### `PluginTuple` + +Tuple of a plugin and its configuration (TypeScript type). + +The first item is a plugin, the rest are its parameters. + +###### Type + +```ts +type PluginTuple< + TupleParameters extends unknown[] = [], + Input extends Node | string | undefined = undefined, + Output = undefined +> = [ + plugin: Plugin<TupleParameters, Input, Output>, + ...parameters: TupleParameters +] +``` + +See [`Plugin`][api-plugin] for more info. + +### `Preset` + +Sharable configuration (TypeScript type). + +They can contain plugins and settings. + +###### Fields + +* `plugins` ([`PluggableList`][api-pluggable-list], optional) + — list of plugins and presets +* `settings` ([`Data`][api-data], optional) + — shared settings for parsers and compilers + +###### Example + +`preset.js`: + +```js +import remarkCommentConfig from 'remark-comment-config' +import remarkLicense from 'remark-license' +import remarkPresetLintConsistent from 'remark-preset-lint-consistent' +import remarkPresetLintRecommended from 'remark-preset-lint-recommended' +import remarkToc from 'remark-toc' + +/** @type {import('unified').Preset} */ +const preset = { + plugins: [ + remarkPresetLintRecommended, + remarkPresetLintConsistent, + remarkCommentConfig, + [remarkToc, {maxDepth: 3, tight: true}], + remarkLicense + ] + settings: {bullet: '*', emphasis: '*', fences: true}, +} + +export default preset +``` + +`example.md`: + +```markdown +# Hello, world! + +_Emphasis_ and **importance**. + +## Table of contents + +## API + +## License +``` + +`example.js`: + +```js +import {remark} from 'remark' +import {read, write} from 'to-vfile' +import {reporter} from 'vfile-reporter' +import preset from './preset.js' + +const file = await remark() + .use(preset) + .process(await read('example.md')) + +console.error(reporter(file)) +await write(file) +``` + +Yields: + +```txt +example.md: no issues found +``` + +`example.md` now contains: + +```markdown +# Hello, world! + +*Emphasis* and **importance**. + +## Table of contents + +* [API](#api) +* [License](#license) + +## API + +## License + +[MIT](license) © [Titus Wormer](https://wooorm.com) +``` + +### `ProcessCallback` + +Callback called when the process is done (TypeScript type). + +Called with either an error or a result. + +###### Parameters + +* `error` (`Error`, optional) + — fatal error +* `file` ([`VFile`][vfile], optional) + — processed file + +###### Returns + +Nothing (`undefined`). + +###### Example + +This example shows how `process` can be used to process a file with a callback. + +```js +import remarkGithub from 'remark-github' +import remarkParse from 'remark-parse' +import remarkStringify from 'remark-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' + +unified() + .use(remarkParse) + .use(remarkGithub) + .use(remarkStringify) + .process('@unifiedjs', function (error, file) { + if (error) throw error + if (file) { + console.error(reporter(file)) + console.log(String(file)) + } + }) +``` + +Yields: + +```txt +no issues found +``` + +```markdown +[**@unifiedjs**](https://github.com/unifiedjs) +``` + +### `Processor` + +Type of a [`processor`][api-processor] (TypeScript type). + +### `RunCallback` + +Callback called when transformers are done (TypeScript type). + +Called with either an error or results. + +###### Parameters + +* `error` (`Error`, optional) + — fatal error +* `tree` ([`Node`][node], optional) + — transformed tree +* `file` ([`VFile`][vfile], optional) + — file + +###### Returns + +Nothing (`undefined`). + +### `Settings` + +Interface of known extra options, that can be supported by parser and +compilers. + +This exists so that users can use packages such as `remark`, which configure +both parsers and compilers (in this case `remark-parse` and +`remark-stringify`), and still provide options for them. + +When you make parsers or compilers, that could be packaged up together, you +should support `this.data('settings')` as input and merge it with explicitly +passed `options`. +Then, to type it, using `remark-stringify` as an example, do something like: + +```ts +declare module 'unified' { + interface Settings { + bullet: '*' | '+' | '-' + // … + } +} + +export {} // You may not need this, but it makes sure the file is a module. +``` + +###### Type + +```ts +interface Settings {} +``` + +### `TransformCallback` + +Callback passed to transforms (TypeScript type). + +If the signature of a `transformer` accepts a third argument, the transformer +may perform asynchronous operations, and must call it. + +###### Parameters + +* `error` (`Error`, optional) + — fatal error to stop the process +* `tree` ([`Node`][node], optional) + — new, changed, tree +* `file` ([`VFile`][vfile], optional) + — new, changed, file + +###### Returns + +Nothing (`undefined`). + +### `Transformer` + +Transformers handle syntax trees and files (TypeScript type). + +They are functions that are called each time a syntax tree and file are +passed through the run phase. +When an error occurs in them (either because it’s thrown, returned, +rejected, or passed to `next`), the process stops. + +The run phase is handled by [`trough`][trough], see its documentation for +the exact semantics of these functions. + +> 👉 **Note**: you should likely ignore `next`: don’t accept it. +> it supports callback-style async work. +> But promises are likely easier to reason about. + +###### Type + +```ts +type Transformer< + Input extends Node = Node, + Output extends Node = Input +> = ( + tree: Input, + file: VFile, + next: TransformCallback<Output> +) => + | Promise<Output | undefined> + | Output + | Error + | undefined +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types +[`CompileResultMap`][api-compile-result-map], +[`CompileResults`][api-compile-results], +[`Compiler`][api-compiler], +[`Data`][api-data], +[`Parser`][api-parser], +[`Pluggable`][api-pluggable], +[`PluggableList`][api-pluggable-list], +[`Plugin`][api-plugin], +[`PluginTuple`][api-plugin-tuple], +[`Preset`][api-preset], +[`ProcessCallback`][api-process-callback], +[`Processor`][api-processor], +[`RunCallback`][api-run-callback], +[`Settings`][api-settings], +[`TransformCallback`][api-transform-callback], +and [`Transformer`][api-transformer] + +For TypeScript to work, it is particularly important to type your plugins +correctly. +We strongly recommend using the `Plugin` type with its generics and to use the +node types for the syntax trees provided by our packages (as in, +[`@types/hast`][types-hast], [`@types/mdast`][types-mdast], +[`@types/nlcst`][types-nlcst]). + +```js +/** + * @typedef {import('hast').Root} HastRoot + * @typedef {import('mdast').Root} MdastRoot + */ + +/** + * @typedef Options + * Configuration (optional). + * @property {boolean | null | undefined} [someField] + * Some option (optional). + */ + +// To type options: +/** @type {import('unified').Plugin<[(Options | null | undefined)?]>} */ +export function myPluginAcceptingOptions(options) { + const settings = options || {} + // `settings` is now `Options`. +} + +// To type a plugin that works on a certain tree, without options: +/** @type {import('unified').Plugin<[], MdastRoot>} */ +export function myRemarkPlugin() { + return function (tree, file) { + // `tree` is `MdastRoot`. + } +} + +// To type a plugin that transforms one tree into another: +/** @type {import('unified').Plugin<[], MdastRoot, HastRoot>} */ +export function remarkRehype() { + return function (tree) { + // `tree` is `MdastRoot`. + // Result must be `HastRoot`. + } +} + +// To type a plugin that defines a parser: +/** @type {import('unified').Plugin<[], string, MdastRoot>} */ +export function remarkParse(options) {} + +// To type a plugin that defines a compiler: +/** @type {import('unified').Plugin<[], HastRoot, string>} */ +export function rehypeStringify(options) {} +``` + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `unified@^11`, compatible +with Node.js 16. + +## Contribute + +See [`contributing.md`][contributing] in [`unifiedjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +For info on how to submit a security report, see our +[security policy][security]. + +## Sponsor + +Support this effort and give back by sponsoring on [OpenCollective][collective]! + +<table> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://americanexpress.io">American Express</a><br><br> + <a href="https://americanexpress.io"><img src="https://avatars1.githubusercontent.com/u/3853301?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="6"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## Acknowledgments + +Preliminary work for unified was done [in 2014][preliminary] for +**[retext][]** and inspired by [`ware`][ware]. +Further incubation happened in **[remark][]**. +The project was finally [externalised][] in 2015 and [published][] as `unified`. +The project was authored by **[@wooorm](https://github.com/wooorm)**. + +Although `unified` since moved its plugin architecture to [`trough`][trough], +thanks to **[@calvinfo](https://github.com/calvinfo)**, +**[@ianstormtaylor](https://github.com/ianstormtaylor)**, and others for their +work on [`ware`][ware], as it was a huge initial inspiration. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[logo]: https://raw.githubusercontent.com/unifiedjs/unified/93862e5/logo.svg?sanitize=true + +[build-badge]: https://github.com/unifiedjs/unified/workflows/main/badge.svg + +[build]: https://github.com/unifiedjs/unified/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified.svg + +[coverage]: https://codecov.io/github/unifiedjs/unified + +[downloads-badge]: https://img.shields.io/npm/dm/unified.svg + +[downloads]: https://www.npmjs.com/package/unified + +[size-badge]: https://img.shields.io/bundlejs/size/unified + +[size]: https://bundlejs.com/?q=unified + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/unifiedjs/unified/discussions + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[health]: https://github.com/unifiedjs/.github + +[contributing]: https://github.com/unifiedjs/.github/blob/main/contributing.md + +[support]: https://github.com/unifiedjs/.github/blob/main/support.md + +[coc]: https://github.com/unifiedjs/.github/blob/main/code-of-conduct.md + +[security]: https://github.com/unifiedjs/.github/blob/main/security.md + +[license]: license + +[author]: https://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[site]: https://unifiedjs.com + +[twitter]: https://twitter.com/unifiedjs + +[rehype]: https://github.com/rehypejs/rehype + +[remark]: https://github.com/remarkjs/remark + +[retext]: https://github.com/retextjs/retext + +[syntax-tree]: https://github.com/syntax-tree + +[esast]: https://github.com/syntax-tree/esast + +[hast]: https://github.com/syntax-tree/hast + +[mdast]: https://github.com/syntax-tree/mdast + +[nlcst]: https://github.com/syntax-tree/nlcst + +[unist]: https://github.com/syntax-tree/unist + +[xast]: https://github.com/syntax-tree/xast + +[unified-engine]: https://github.com/unifiedjs/unified-engine + +[unified-args]: https://github.com/unifiedjs/unified-args + +[unified-engine-gulp]: https://github.com/unifiedjs/unified-engine-gulp + +[unified-language-server]: https://github.com/unifiedjs/unified-language-server + +[unified-stream]: https://github.com/unifiedjs/unified-stream + +[rehype-remark]: https://github.com/rehypejs/rehype-remark + +[rehype-retext]: https://github.com/rehypejs/rehype-retext + +[remark-rehype]: https://github.com/remarkjs/remark-rehype + +[remark-retext]: https://github.com/remarkjs/remark-retext + +[node]: https://github.com/syntax-tree/unist#node + +[vfile]: https://github.com/vfile/vfile + +[vfile-compatible]: https://github.com/vfile/vfile#compatible + +[vfile-value]: https://github.com/vfile/vfile#value + +[vfile-utilities]: https://github.com/vfile/vfile#list-of-utilities + +[rehype-react]: https://github.com/rehypejs/rehype-react + +[trough]: https://github.com/wooorm/trough#function-fninput-next + +[rehype-plugins]: https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins + +[remark-plugins]: https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins + +[retext-plugins]: https://github.com/retextjs/retext/blob/main/doc/plugins.md#list-of-plugins + +[awesome-rehype]: https://github.com/rehypejs/awesome-rehype + +[awesome-remark]: https://github.com/remarkjs/awesome-remark + +[awesome-retext]: https://github.com/retextjs/awesome-retext + +[topic-rehype-plugin]: https://github.com/topics/rehype-plugin + +[topic-remark-plugin]: https://github.com/topics/remark-plugin + +[topic-retext-plugin]: https://github.com/topics/retext-plugin + +[types-hast]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast + +[types-mdast]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast + +[types-nlcst]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nlcst + +[preliminary]: https://github.com/retextjs/retext/commit/8fcb1f + +[externalised]: https://github.com/remarkjs/remark/commit/9892ec + +[published]: https://github.com/unifiedjs/unified/commit/2ba1cf + +[ware]: https://github.com/segmentio/ware + +[api]: #api + +[contribute]: #contribute + +[overview]: #overview + +[sponsor]: #sponsor + +[api-compile-result-map]: #compileresultmap + +[api-compile-results]: #compileresults + +[api-compiler]: #compiler + +[api-data]: #data + +[api-freeze]: #processorfreeze + +[api-parser]: #parser + +[api-pluggable]: #pluggable + +[api-pluggable-list]: #pluggablelist + +[api-plugin]: #plugin + +[api-plugin-tuple]: #plugintuple + +[api-preset]: #preset + +[api-process]: #processorprocessfile-done + +[api-process-callback]: #processcallback + +[api-processor]: #processor + +[api-run-callback]: #runcallback + +[api-settings]: #settings + +[api-transform-callback]: #transformcallback + +[api-transformer]: #transformer diff --git a/node_modules/unist-util-is/index.d.ts b/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..5d1bbbb3 --- /dev/null +++ b/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,5 @@ +export type Check = import("./lib/index.js").Check; +export type Test = import("./lib/index.js").Test; +export type TestFunction = import("./lib/index.js").TestFunction; +export { is, convert } from "./lib/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/unist-util-is/index.d.ts.map b/node_modules/unist-util-is/index.d.ts.map new file mode 100644 index 00000000..ba2e37a1 --- /dev/null +++ b/node_modules/unist-util-is/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"oBACa,OAAO,gBAAgB,EAAE,KAAK;mBAC9B,OAAO,gBAAgB,EAAE,IAAI;2BAC7B,OAAO,gBAAgB,EAAE,YAAY"} \ No newline at end of file diff --git a/node_modules/unist-util-is/index.js b/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..08faf55d --- /dev/null +++ b/node_modules/unist-util-is/index.js @@ -0,0 +1,7 @@ +/** + * @typedef {import('./lib/index.js').Check} Check + * @typedef {import('./lib/index.js').Test} Test + * @typedef {import('./lib/index.js').TestFunction} TestFunction + */ + +export {is, convert} from './lib/index.js' diff --git a/node_modules/unist-util-is/license b/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unist-util-is/package.json b/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..88ca667b --- /dev/null +++ b/node_modules/unist-util-is/package.json @@ -0,0 +1,103 @@ +{ + "name": "unist-util-is", + "version": "6.0.1", + "description": "unist utility to check if a node passes a test", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "repository": "syntax-tree/unist-util-is", + "bugs": "https://github.com/syntax-tree/unist-util-is/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Christian Murphy <christian.murphy.42@gmail.com>", + "Lucas Brandstaetter <lucas@brandstaetter.tech> (https://github.com/Roang-zero1)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0" + }, + "devDependencies": { + "@types/mdast": "^4.0.0", + "@types/node": "^24.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "tsd": "^0.33.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && tsd && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test/index.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "#": "needed `any`s", + "ignoreFiles": [ + "lib/index.d.ts" + ], + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/no-unnecessary-type-arguments": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "import/no-extraneous-dependencies": "off" + } + } + ], + "prettier": true + } +} diff --git a/node_modules/unist-util-is/readme.md b/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..86aa997d --- /dev/null +++ b/node_modules/unist-util-is/readme.md @@ -0,0 +1,351 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[unist][] utility to check if nodes pass a test. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`is(node[, test[, index, parent[, context]]])`](#isnode-test-index-parent-context) + * [`convert(test)`](#converttest) + * [`Check`](#check) + * [`Test`](#test) + * [`TestFunction`](#testfunction) +* [Examples](#examples) + * [Example of `convert`](#example-of-convert) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a small utility that checks that a node is a certain node. + +## When should I use this? + +Use this small utility if you find yourself repeating code for checking what +nodes are. + +A similar package, [`hast-util-is-element`][hast-util-is-element], works on hast +elements. + +For more advanced tests, [`unist-util-select`][unist-util-select] can be used +to match against CSS selectors. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unist-util-is +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {is} from 'https://esm.sh/unist-util-is@6' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {is} from 'https://esm.sh/unist-util-is@6?bundle' +</script> +``` + +## Use + +```js +import {is} from 'unist-util-is' + +const node = {type: 'strong'} +const parent = {type: 'paragraph', children: [node]} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true + +function test(node, n) { + return n === 5 +} +``` + +## API + +This package exports the identifiers [`convert`][api-convert] and +[`is`][api-is]. +There is no default export. + +### `is(node[, test[, index, parent[, context]]])` + +Check if `node` is a `Node` and whether it passes the given test. + +###### Parameters + +* `node` (`unknown`, optional) + — thing to check, typically [`Node`][node] +* `test` ([`Test`][api-test], optional) + — a test for a specific element +* `index` (`number`, optional) + — the node’s position in its parent +* `parent` ([`Node`][node], optional) + — the node’s parent +* `context` (`unknown`, optional) + — context object (`this`) to call `test` with + +###### Returns + +Whether `node` is a [`Node`][node] and passes a test (`boolean`). + +###### Throws + +When an incorrect `test`, `index`, or `parent` is given. +There is no error thrown when `node` is not a node. + +### `convert(test)` + +Generate a check from a test. + +Useful if you’re going to test many nodes, for example when creating a +utility where something else passes a compatible test. + +The created function is a bit faster because it expects valid input only: +a `node`, `index`, and `parent`. + +###### Parameters + +* `test` ([`Test`][api-test], optional) + — a test for a specific node + +###### Returns + +A check ([`Check`][api-check]). + +### `Check` + +Check that an arbitrary value is a node (TypeScript type). + +###### Parameters + +* `this` (`unknown`, optional) + — context object (`this`) to call `test` with +* `node` (`unknown`) + — anything (typically a node) +* `index` (`number`, optional) + — the node’s position in its parent +* `parent` ([`Node`][node], optional) + — the node’s parent + +###### Returns + +Whether this is a node and passes a test (`boolean`). + +### `Test` + +Check for an arbitrary node (TypeScript type). + +###### Type + +```ts +type Test = + | Array<Record<string, unknown> | TestFunction | string> + | Record<string, unknown> + | TestFunction + | string + | null + | undefined +``` + +Checks that the given thing is a node, and then: + +* when `string`, checks that the node has that tag name +* when `function`, see [`TestFunction`][api-test-function] +* when `object`, checks that all keys in test are in node, and that they have + (strictly) equal values +* when `Array`, checks if one of the subtests pass + +### `TestFunction` + +Check if a node passes a test (TypeScript type). + +###### Parameters + +* `node` ([`Node`][node]) + — a node +* `index` (`number` or `undefined`) + — the node’s position in its parent +* `parent` ([`Node`][node] or `undefined`) + — the node’s parent + +###### Returns + +Whether this node passes the test (`boolean`, optional). + +## Examples + +### Example of `convert` + +```js +import {u} from 'unist-builder' +import {convert} from 'unist-util-is' + +const test = convert('leaf') + +const tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +const leafs = tree.children.filter(function (child, index) { + return test(child, index, tree) +}) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`Check`][api-check], +[`Test`][api-test], +[`TestFunction`][api-test-function]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `unist-util-is@^6`, +compatible with Node.js 16. + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — find all nodes between two nodes +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — remove nodes from tree + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-check]: #check + +[api-convert]: #converttest + +[api-is]: #isnode-test-index-parent-context + +[api-test]: #test + +[api-test-function]: #testfunction + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-is/actions + +[build-badge]: https://github.com/syntax-tree/unist-util-is/workflows/main/badge.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[collective]: https://opencollective.com/unified + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[hast-util-is-element]: https://github.com/syntax-tree/hast-util-is-element + +[health]: https://github.com/syntax-tree/.github + +[license]: license + +[node]: https://github.com/syntax-tree/unist#node + +[npm]: https://docs.npmjs.com/cli/install + +[size]: https://bundlejs.com/?q=unist-util-is + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org + +[unist]: https://github.com/syntax-tree/unist + +[unist-util-select]: https://github.com/syntax-tree/unist-util-select diff --git a/node_modules/unist-util-position/index.d.ts b/node_modules/unist-util-position/index.d.ts new file mode 100644 index 00000000..74cdd90b --- /dev/null +++ b/node_modules/unist-util-position/index.d.ts @@ -0,0 +1 @@ +export {pointEnd, pointStart, position} from './lib/index.js' diff --git a/node_modules/unist-util-position/index.js b/node_modules/unist-util-position/index.js new file mode 100644 index 00000000..74cdd90b --- /dev/null +++ b/node_modules/unist-util-position/index.js @@ -0,0 +1 @@ +export {pointEnd, pointStart, position} from './lib/index.js' diff --git a/node_modules/unist-util-position/license b/node_modules/unist-util-position/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/unist-util-position/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unist-util-position/package.json b/node_modules/unist-util-position/package.json new file mode 100644 index 00000000..7c2469de --- /dev/null +++ b/node_modules/unist-util-position/package.json @@ -0,0 +1,76 @@ +{ + "name": "unist-util-position", + "version": "5.0.0", + "description": "unist utility to get the position of a node", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "node", + "position", + "point" + ], + "repository": "syntax-tree/unist-util-position", + "bugs": "https://github.com/syntax-tree/unist-util-position/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/unist-util-position/readme.md b/node_modules/unist-util-position/readme.md new file mode 100644 index 00000000..4dd2e9c2 --- /dev/null +++ b/node_modules/unist-util-position/readme.md @@ -0,0 +1,243 @@ +# unist-util-position + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[unist][] utility to get positional info of nodes. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`position(node)`](#positionnode) + * [`pointEnd(node)`](#pointendnode) + * [`pointStart(node)`](#pointstartnode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This utility helps with accessing positional info on a potentially dirty tree. + +## When should I use this? + +The positional info is typically consistent and proper in unist trees generated +by our ecosystem, but, user plugins could mess that up. +If you’re making a reusable plugin, and accessing the positional info often, you +might want to guard against that by using this utility. + +You might also find the utility [`unist-util-generated`][unist-util-generated] +useful to check whether a node is considered to be generated (not in the +original input file). + +You might also enjoy +[`unist-util-stringify-position`][unist-util-stringify-position] when you want +to display positional info to users. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unist-util-position +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5?bundle' +</script> +``` + +## Use + +```js +import {fromMarkdown} from 'mdast-util-from-markdown' +import {pointEnd, pointStart, position} from 'unist-util-position' + +const tree = fromMarkdown('# foo\n\n* bar\n') + +console.log(position(tree)) +console.log(pointStart(tree)) +console.log(pointEnd(tree)) +``` + +Yields: + +```js +{start: {line: 1, column: 1, offset: 0}, end: {line: 4, column: 1, offset: 13}} +{line: 1, column: 1, offset: 0} +{line: 4, column: 1, offset: 13} +``` + +## API + +This package exports the identifiers [`pointEnd`][pointend], +[`pointStart`][pointstart], and [`position`][position]. +There is no default export. + +### `position(node)` + +Get the positional info of `node`. + +###### Parameters + +* `node` ([`Node`][node]) + — node + +###### Returns + +Position, if valid ([`Position`][unist-position] or `undefined`). + +### `pointEnd(node)` + +Get the ending point of `node`. + +###### Parameters + +* `node` ([`Node`][node]) + — node + +###### Returns + +Point, if valid ([`Point`][unist-point] or `undefined`). + +### `pointStart(node)` + +Get the starting point of `node`. + +###### Parameters + +* `node` ([`Node`][node]) + — node + +###### Returns + +Point, if valid ([`Point`][unist-point] or `undefined`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `unist-util-position@^5`, +compatible with Node.js 16. + +## Related + +* [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position) + — serialize a node, position, or point as a human readable location +* [`unist-util-position-from-estree`](https://github.com/syntax-tree/unist-util-position-from-estree) + — get a position from an estree node +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — remove positions from tree +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — check if a node is generated +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — get the source of a node + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/syntax-tree/unist-util-position/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-position/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-position + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-position + +[size]: https://bundlejs.com/?q=unist-util-position + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[unist-position]: https://github.com/syntax-tree/unist#position + +[unist-point]: https://github.com/syntax-tree/unist#point + +[unist-util-generated]: https://github.com/syntax-tree/unist-util-generated + +[unist-util-stringify-position]: https://github.com/syntax-tree/unist-util-stringify-position + +[position]: #positionnode + +[pointend]: #pointendnode + +[pointstart]: #pointstartnode diff --git a/node_modules/unist-util-stringify-position/index.d.ts b/node_modules/unist-util-stringify-position/index.d.ts new file mode 100644 index 00000000..93163eae --- /dev/null +++ b/node_modules/unist-util-stringify-position/index.d.ts @@ -0,0 +1 @@ +export {stringifyPosition} from './lib/index.js' diff --git a/node_modules/unist-util-stringify-position/index.js b/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 00000000..93163eae --- /dev/null +++ b/node_modules/unist-util-stringify-position/index.js @@ -0,0 +1 @@ +export {stringifyPosition} from './lib/index.js' diff --git a/node_modules/unist-util-stringify-position/license b/node_modules/unist-util-stringify-position/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/unist-util-stringify-position/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unist-util-stringify-position/package.json b/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 00000000..334550f9 --- /dev/null +++ b/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,80 @@ +{ + "name": "unist-util-stringify-position", + "version": "4.0.0", + "description": "unist utility to serialize a node, position, or point as a human readable location", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "position", + "location", + "point", + "node", + "stringify", + "tostring" + ], + "repository": "syntax-tree/unist-util-stringify-position", + "bugs": "https://github.com/syntax-tree/unist-util-stringify-position/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0" + }, + "devDependencies": { + "@types/mdast": "^4.0.0", + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/unist-util-stringify-position/readme.md b/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 00000000..af692c81 --- /dev/null +++ b/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,206 @@ +# unist-util-stringify-position + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[unist][] utility to pretty print the positional info of a node. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`stringifyPosition(node|position|point)`](#stringifypositionnodepositionpoint) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a utility that takes any [unist][] (whether mdast, hast, etc) +node, position, or point, and serializes its positional info. + +## When should I use this? + +This utility is useful to display where something occurred in the original +document, in one standard way, for humans. +For example, when throwing errors or warning messages about something. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unist-util-stringify-position +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4?bundle' +</script> +``` + +## Use + +```js +import {stringifyPosition} from 'unist-util-stringify-position' + +stringifyPosition({line: 2, column: 3}) // => '2:3' (point) +stringifyPosition({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' (position) +stringifyPosition({ + type: 'text', + value: '!', + position: { + start: {line: 5, column: 11}, + end: {line: 5, column: 12} + } +}) // => '5:11-5:12' (node) +``` + +## API + +This package exports the identifier [`stringifyPosition`][stringifyposition]. +There is no default export. + +### `stringifyPosition(node|position|point)` + +Serialize the positional info of a point, position (start and end points), or +node. + +###### Parameters + +* `node` ([`Node`][node]) + — node whose `position` fields to serialize +* `position` ([`Position`][position]) + — position whose `start` and `end` points to serialize +* `point` ([`Point`][point]) + — point whose `line` and `column` fields to serialize + +###### Returns + +Pretty printed positional info of a node (`string`). + +In the format of a range `ls:cs-le:ce` (when given `node` or `position`) or a +point `l:c` (when given `point`), where `l` stands for line, `c` for column, `s` +for `start`, and `e` for end. +An empty string (`''`) is returned if the given value is neither `node`, +`position`, nor `point`. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`unist-util-stringify-position@^4`, compatible with Node.js 16. + +## Security + +This project is safe. + +## Related + +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — check if a node is generated +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — get positional info of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — remove positional info from trees +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — get the source of a value (node or position) in a file + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definition --> + +[build-badge]: https://github.com/syntax-tree/unist-util-stringify-position/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-stringify-position/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-stringify-position + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-stringify-position + +[size]: https://bundlejs.com/?q=unist-util-stringify-position + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[stringifyposition]: #stringifypositionnodepositionpoint diff --git a/node_modules/unist-util-visit-parents/index.d.ts b/node_modules/unist-util-visit-parents/index.d.ts new file mode 100644 index 00000000..abd196cd --- /dev/null +++ b/node_modules/unist-util-visit-parents/index.d.ts @@ -0,0 +1,14 @@ +export type {Test} from 'unist-util-is' +export type { + Action, + ActionTuple, + BuildVisitor, + // Undocumented: used in `unist-util-visit`: + InclusiveDescendant, + Index, + // Undocumented: used in `unist-util-visit`: + Matches, + Visitor, + VisitorResult +} from './lib/index.js' +export {CONTINUE, EXIT, SKIP, visitParents} from './lib/index.js' diff --git a/node_modules/unist-util-visit-parents/index.js b/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..995e97b6 --- /dev/null +++ b/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts` +export {CONTINUE, EXIT, SKIP, visitParents} from './lib/index.js' diff --git a/node_modules/unist-util-visit-parents/license b/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unist-util-visit-parents/package.json b/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..899f3170 --- /dev/null +++ b/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,106 @@ +{ + "name": "unist-util-visit-parents", + "version": "6.0.2", + "description": "unist utility to recursively walk over nodes, with ancestral information", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "repository": "syntax-tree/unist-util-visit-parents", + "bugs": "https://github.com/syntax-tree/unist-util-visit-parents/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": { + ".": "./index.js", + "./do-not-use-color": { + "node": "./lib/color.node.js", + "default": "./lib/color.js" + } + }, + "types": "index.d.ts", + "files": [ + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "devDependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/node": "^24.0.0", + "@types/xast": "^2.0.0", + "c8": "^10.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "strip-ansi": "^7.0.0", + "tsd": "^0.33.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && tsd && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "#": "needed `any`s", + "ignoreFiles": [ + "lib/index.d.ts" + ], + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/unist-util-visit-parents/readme.md b/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..be99bc2e --- /dev/null +++ b/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,388 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[unist][] utility to walk the tree with a stack of parents. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`visitParents(tree[, test], visitor[, reverse])`](#visitparentstree-test-visitor-reverse) + * [`CONTINUE`](#continue) + * [`EXIT`](#exit) + * [`SKIP`](#skip) + * [`Action`](#action) + * [`ActionTuple`](#actiontuple) + * [`BuildVisitor`](#buildvisitor) + * [`Index`](#index) + * [`Test`](#test) + * [`Visitor`](#visitor) + * [`VisitorResult`](#visitorresult) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a very important utility for working with unist as it lets you walk the +tree. + +## When should I use this? + +You can use this utility when you want to walk the tree and want to know about +every parent of each node. +You can use [`unist-util-visit`][unist-util-visit] if you don’t care about the +entire stack of parents. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unist-util-visit-parents +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {visitParents} from 'https://esm.sh/unist-util-visit-parents@6' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {visitParents} from 'https://esm.sh/unist-util-visit-parents@6?bundle' +</script> +``` + +## Use + +```js +import {visitParents} from 'unist-util-visit-parents' +import {fromMarkdown} from 'mdast-util-from-markdown' + +const tree = fromMarkdown('Some *emphasis*, **strong**, and `code`.') + +visitParents(tree, 'strong', function (node, ancestors) { + console.log(node.type, ancestors.map(ancestor => ancestor.type)) +}) +``` + +Yields: + +```js +strong ['root', 'paragraph'] +``` + +## API + +This package exports the identifiers [`CONTINUE`][api-continue], +[`EXIT`][api-exit], [`SKIP`][api-skip], and [`visitParents`][api-visitparents]. +There is no default export. + +### `visitParents(tree[, test], visitor[, reverse])` + +Visit nodes, with ancestral information. + +This algorithm performs *[depth-first][]* *[tree traversal][tree-traversal]* +in *[preorder][]* (**NLR**) or if `reverse` is given, in *reverse preorder* +(**NRL**). + +You can choose for which nodes `visitor` is called by passing a `test`. +For complex tests, you should test yourself in `visitor`, as it will be +faster and will have improved type information. + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times, walk it once, use +[`unist-util-is`][unist-util-is] to check if a node matches, and then perform +different operations. + +You can change the tree. +See [`Visitor`][api-visitor] for more info. + +###### Parameters + +* `tree` ([`Node`][node]) + — tree to traverse +* `test` ([`Test`][api-test], optional) + — [`unist-util-is`][unist-util-is]-compatible test +* `visitor` ([`Visitor`][api-visitor]) + — handle each node +* `reverse` (`boolean`, default: `false`) + — traverse in reverse preorder (NRL) instead of the default preorder (NLR) + +###### Returns + +Nothing (`undefined`). + +### `CONTINUE` + +Continue traversing as normal (`true`). + +### `EXIT` + +Stop traversing immediately (`false`). + +### `SKIP` + +Do not traverse this node’s children (`'skip'`). + +### `Action` + +Union of the action types (TypeScript type). + +###### Type + +```ts +type Action = typeof CONTINUE | typeof EXIT | typeof SKIP +``` + +### `ActionTuple` + +List with one or two values, the first an action, the second an index +(TypeScript type). + +###### Type + +```ts +type ActionTuple = [ + (Action | null | undefined | void)?, + (Index | null | undefined)? +] +``` + +### `BuildVisitor` + +Build a typed `Visitor` function from a tree and a test (TypeScript type). + +It will infer which values are passed as `node` and which as `parents`. + +###### Type parameters + +* `Tree` ([`Node`][node], default: `Node`) + — tree type +* `Check` ([`Test`][api-test], default: `Test`) + — test type + +###### Returns + +[`Visitor`][api-visitor]. + +### `Index` + +Move to the sibling at `index` next (after node itself is completely +traversed) (TypeScript type). + +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings. +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent. + +###### Type + +```ts +type Index = number +``` + +### `Test` + +[`unist-util-is`][unist-util-is] compatible test (TypeScript type). + +### `Visitor` + +Handle a node (matching `test`, if given) (TypeScript type). + +Visitors are free to transform `node`. +They can also transform the parent of node (the last of `ancestors`). + +Replacing `node` itself, if `SKIP` is not returned, still causes its +descendants to be walked (which is a bug). + +When adding or removing previous siblings of `node` (or next siblings, in +case of reverse), the `Visitor` should return a new `Index` to specify the +sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case +of reverse) is handled as expected without needing to return a new `Index`. + +Removing the children property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) + — found node +* `parents` ([`Array<Node>`][node]) + — ancestors of `node` + +###### Returns + +What to do next. + +An `Index` is treated as a tuple of `[CONTINUE, Index]`. +An `Action` is treated as a tuple of `[Action]`. + +Passing a tuple back only makes sense if the `Action` is `SKIP`. +When the `Action` is `EXIT`, that action can be returned. +When the `Action` is `CONTINUE`, `Index` can be returned. + +### `VisitorResult` + +Any value that can be returned from a visitor (TypeScript type). + +###### Type + +```ts +type VisitorResult = + | Action + | ActionTuple + | Index + | null + | undefined + | void +``` + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`Action`][api-action], +[`ActionTuple`][api-actiontuple], [`BuildVisitor`][api-buildvisitor], +[`Index`][api-index], [`Test`][api-test], [`Visitor`][api-visitor], and +[`VisitorResult`][api-visitorresult]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`unist-util-visit-parents@^6`, compatible with Node.js 16. + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — walk the tree with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definition --> + +[build-badge]: https://github.com/syntax-tree/unist-util-visit-parents/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-visit-parents/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-visit-parents + +[size]: https://bundlejs.com/?q=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit + +[unist-util-is]: https://github.com/syntax-tree/unist-util-is + +[api-visitparents]: #visitparentstree-test-visitor-reverse + +[api-continue]: #continue + +[api-exit]: #exit + +[api-skip]: #skip + +[api-action]: #action + +[api-actiontuple]: #actiontuple + +[api-buildvisitor]: #buildvisitor + +[api-index]: #index + +[api-test]: #test + +[api-visitor]: #visitor + +[api-visitorresult]: #visitorresult diff --git a/node_modules/unist-util-visit/index.d.ts b/node_modules/unist-util-visit/index.d.ts new file mode 100644 index 00000000..c6ebdb0a --- /dev/null +++ b/node_modules/unist-util-visit/index.d.ts @@ -0,0 +1,9 @@ +export type {Test} from 'unist-util-is' +export type { + Action, + ActionTuple, + Index, + VisitorResult +} from 'unist-util-visit-parents' +export type {Visitor, BuildVisitor} from './lib/index.js' +export {CONTINUE, EXIT, SKIP, visit} from './lib/index.js' diff --git a/node_modules/unist-util-visit/index.js b/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..47479999 --- /dev/null +++ b/node_modules/unist-util-visit/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts` +export {CONTINUE, EXIT, SKIP, visit} from './lib/index.js' diff --git a/node_modules/unist-util-visit/license b/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unist-util-visit/package.json b/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..425c5162 --- /dev/null +++ b/node_modules/unist-util-visit/package.json @@ -0,0 +1,113 @@ +{ + "name": "unist-util-visit", + "version": "5.0.0", + "description": "unist utility to visit nodes", + "license": "MIT", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "repository": "syntax-tree/unist-util-visit", + "bugs": "https://github.com/syntax-tree/unist-util-visit/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Eugene Sharygin <eush77@gmail.com>", + "Richard Gibson <richard.gibson@gmail.com>" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "devDependencies": { + "@types/mdast": "^4.0.0", + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-gfm": "^2.0.0", + "micromark-extension-gfm": "^2.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "tsd": "^0.28.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && tsd && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "#": "needed `any`s", + "ignoreFiles": [ + "lib/index.d.ts" + ], + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "import/no-extraneous-dependencies": "off" + } + } + ], + "prettier": true + } +} diff --git a/node_modules/unist-util-visit/readme.md b/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..1829fe80 --- /dev/null +++ b/node_modules/unist-util-visit/readme.md @@ -0,0 +1,319 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[unist][] utility to walk the tree. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`visit(tree[, test], visitor[, reverse])`](#visittree-test-visitor-reverse) + * [`CONTINUE`](#continue) + * [`EXIT`](#exit) + * [`SKIP`](#skip) + * [`Action`](#action) + * [`ActionTuple`](#actiontuple) + * [`BuildVisitor`](#buildvisitor) + * [`Index`](#index) + * [`Test`](#test) + * [`Visitor`](#visitor) + * [`VisitorResult`](#visitorresult) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a very important utility for working with unist as it lets you walk the +tree. + +## When should I use this? + +You can use this utility when you want to walk the tree. +You can use [`unist-util-visit-parents`][vp] if you care about the entire stack +of parents. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install unist-util-visit +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {CONTINUE, EXIT, SKIP, visit} from 'https://esm.sh/unist-util-visit@5' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {CONTINUE, EXIT, SKIP, visit} from 'https://esm.sh/unist-util-visit@5?bundle' +</script> +``` + +## Use + +```js +import {fromMarkdown} from 'mdast-util-from-markdown' +import {visit} from 'unist-util-visit' + +const tree = fromMarkdown('Some *emphasis*, **strong**, and `code`.') + +visit(tree, 'text', function (node, index, parent) { + console.log([node.value, parent ? parent.type : index]) +}) +``` + +Yields: + +```js +[ 'Some ', 'paragraph' ] +[ 'emphasis', 'emphasis' ] +[ ', ', 'paragraph' ] +[ 'strong', 'strong' ] +[ ', and ', 'paragraph' ] +[ '.', 'paragraph' ] +``` + +## API + +This package exports the identifiers [`CONTINUE`][api-continue], +[`EXIT`][api-exit], [`SKIP`][api-skip], and [`visit`][api-visit]. +There is no default export. + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but [`Visitor`][api-visitor] has a different signature. + +### `CONTINUE` + +Continue traversing as normal (`true`). + +### `EXIT` + +Stop traversing immediately (`false`). + +### `SKIP` + +Do not traverse this node’s children (`'skip'`). + +### `Action` + +Union of the action types (TypeScript type). +See [`Action` in `unist-util-visit-parents`][vp-action]. + +### `ActionTuple` + +List with an action and an index (TypeScript type). +See [`ActionTuple` in `unist-util-visit-parents`][vp-action-tuple]. + +### `BuildVisitor` + +Build a typed `Visitor` function from a tree and a test (TypeScript type). +See [`BuildVisitor` in `unist-util-visit-parents`][vp-build-visitor]. + +### `Index` + +Move to the sibling at `index` next (TypeScript type). +See [`Index` in `unist-util-visit-parents`][vp-index]. + +### `Test` + +[`unist-util-is`][unist-util-is] compatible test (TypeScript type). + +### `Visitor` + +Handle a node (matching `test`, if given) (TypeScript type). + +Visitors are free to transform `node`. +They can also transform `parent`. + +Replacing `node` itself, if `SKIP` is not returned, still causes its +descendants to be walked (which is a bug). + +When adding or removing previous siblings of `node` (or next siblings, in +case of reverse), the `Visitor` should return a new `Index` to specify the +sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case +of reverse) is handled as expected without needing to return a new `Index`. + +Removing the children property of `parent` still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) + — found node +* `index` (`number` or `undefined`) + — index of `node` in `parent` +* `parent` ([`Node`][node] or `undefined`) + — parent of `node` + +###### Returns + +What to do next. + +An `Index` is treated as a tuple of `[CONTINUE, Index]`. +An `Action` is treated as a tuple of `[Action]`. + +Passing a tuple back only makes sense if the `Action` is `SKIP`. +When the `Action` is `EXIT`, that action can be returned. +When the `Action` is `CONTINUE`, `Index` can be returned. + +### `VisitorResult` + +Any value that can be returned from a visitor (TypeScript type). +See [`VisitorResult` in `unist-util-visit-parents`][vp-visitor-result]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`Action`][api-action], +[`ActionTuple`][api-action-tuple], [`BuildVisitor`][api-build-visitor], +[`Index`][api-index], [`Test`][api-test], [`Visitor`][api-visitor], and +[`VisitorResult`][api-visitor-result]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `unist-util-visit@^5`, +compatible with Node.js 16. + +## Related + +* [`unist-util-visit-parents`][vp] + — walk the tree with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for +ways to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definition --> + +[build-badge]: https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg + +[build]: https://github.com/syntax-tree/unist-util-visit/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-visit + +[size]: https://bundlejs.com/?q=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/syntax-tree/unist/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[license]: license + +[author]: https://wooorm.com + +[health]: https://github.com/syntax-tree/.github + +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/main/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#nodes + +[unist-util-is]: https://github.com/syntax-tree/unist-util-is + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[vp-action]: https://github.com/syntax-tree/unist-util-visit-parents#action + +[vp-action-tuple]: https://github.com/syntax-tree/unist-util-visit-parents#actiontuple + +[vp-build-visitor]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor + +[vp-index]: https://github.com/syntax-tree/unist-util-visit-parents#index + +[vp-visitor-result]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresult + +[api-visit]: #visittree-test-visitor-reverse + +[api-continue]: #continue + +[api-exit]: #exit + +[api-skip]: #skip + +[api-action]: #action + +[api-action-tuple]: #actiontuple + +[api-build-visitor]: #buildvisitor + +[api-index]: #index + +[api-test]: #test + +[api-visitor]: #visitor + +[api-visitor-result]: #visitorresult diff --git a/node_modules/vfile-message/index.d.ts b/node_modules/vfile-message/index.d.ts new file mode 100644 index 00000000..d6013369 --- /dev/null +++ b/node_modules/vfile-message/index.d.ts @@ -0,0 +1,2 @@ +export { VFileMessage } from "./lib/index.js"; +export type Options = import("./lib/index.js").Options; diff --git a/node_modules/vfile-message/index.js b/node_modules/vfile-message/index.js new file mode 100644 index 00000000..61f33bd6 --- /dev/null +++ b/node_modules/vfile-message/index.js @@ -0,0 +1,5 @@ +/** + * @typedef {import('./lib/index.js').Options} Options + */ + +export {VFileMessage} from './lib/index.js' diff --git a/node_modules/vfile-message/license b/node_modules/vfile-message/license new file mode 100644 index 00000000..bc8f165a --- /dev/null +++ b/node_modules/vfile-message/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vfile-message/package.json b/node_modules/vfile-message/package.json new file mode 100644 index 00000000..5c6f9b07 --- /dev/null +++ b/node_modules/vfile-message/package.json @@ -0,0 +1,80 @@ +{ + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "bugs": "https://github.com/vfile/vfile-message/issues", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "description": "vfile utility to create a virtual message", + "devDependencies": { + "@types/node": "^24.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^11.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^1.0.0" + }, + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "file", + "message", + "utility", + "util", + "vfile-util", + "vfile", + "virtual" + ], + "license": "MIT", + "name": "vfile-message", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "vfile/vfile-message", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix", + "prepack": "npm run build && npm run format", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "ignoreCatch": true + }, + "type": "module", + "version": "4.0.3", + "xo": { + "prettier": true, + "rules": { + "prefer-destructuring": "off", + "unicorn/prefer-at": "off" + }, + "space": true + } +} diff --git a/node_modules/vfile-message/readme.md b/node_modules/vfile-message/readme.md new file mode 100644 index 00000000..1ecccc0e --- /dev/null +++ b/node_modules/vfile-message/readme.md @@ -0,0 +1,252 @@ +# vfile-message + +[![Build][badge-build-image]][badge-build-url] +[![Coverage][badge-coverage-image]][badge-coverage-url] +[![Downloads][badge-downloads-image]][badge-downloads-url] +[![Size][badge-size-image]][badge-size-url] + +Create [vfile][github-vfile] messages. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`VFileMessage(reason[, options])`](#vfilemessagereason-options) + * [`Options`](#options) + * [Well-known](#well-known) +* [Compatibility](#compatibility) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package provides a (lint) message format. + +## When should I use this? + +In most cases, +you can use `file.message` from `VFile` itself, +but in some cases you might not have a file, +and still want to emit warnings or errors, +in which case this can be used directly. + +## Install + +This package is [ESM only][github-gist-esm]. +In Node.js (version 16+), +install with [npm][npmjs-install]: + +```sh +npm install vfile-message +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {VFileMessage} from 'https://esm.sh/vfile-message@4' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {VFileMessage} from 'https://esm.sh/vfile-message@4?bundle' +</script> +``` + +## Use + +```js +import {VFileMessage} from 'vfile-message' + +const message = new VFileMessage( + 'Unexpected unknown word `braavo`, did you mean `bravo`?', + {place: {column: 8, line: 1}, ruleId: 'typo', source: 'spell'} +) + +console.log(message) +``` + +Yields: + +```text +[1:8: Unexpected unknown word `braavo`, did you mean `bravo`?] { + reason: 'Unexpected unknown word `braavo`, did you mean `bravo`?', + line: 1, + column: 8, + ancestors: undefined, + cause: undefined, + fatal: undefined, + place: {line: 1, column: 8}, + ruleId: 'typo', + source: 'spell' +} +``` + +## API + +This package exports the identifier [`VFileMessage`][api-vfile-message]. +There is no default export. +It exports the additional [TypeScript][] type [`Options`][api-options]. + +### `VFileMessage(reason[, options])` + +Create a message for `reason`. + +> 🪦 **Note**: also has obsolete signatures. + +###### Parameters + +* `reason` (`string`) + — reason for message (should use markdown) +* `options` ([`Options`][api-options], optional) + — configuration. + +###### Extends + +[`Error`][developer-mozilla-error]. + +###### Returns + +Instance of `VFileMessage`. + +###### Fields + +* `ancestors` ([`Array<Node>`][github-unist-node] or `undefined`) + — stack of (inclusive) ancestor nodes surrounding the message +* `cause` ([`Error`][developer-mozilla-error] or `undefined`) + — original error cause of the message +* `column` (`number` or `undefined`) + — starting column of message +* `fatal` (`boolean` or `undefined`) + — state of problem; `true`: error, file not usable; `false`: warning, + change may be needed; `undefined`: info, change likely not needed +* `line` (`number` or `undefined`) + — starting line of message +* `place` ([`Point`][github-unist-point], [`Position`][github-unist-position] + or `undefined`) + — place of message +* `reason` (`string`) + — reason for message (should use markdown) +* `ruleId` (`string` or `undefined`, example: `'my-rule'`) + — category of message +* `source` (`string` or `undefined`, example: `'my-package'`) + — namespace of message + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `ancestors` ([`Array<Node>`][github-unist-node], optional) + — stack of (inclusive) ancestor nodes surrounding the message +* `cause` ([`Error`][developer-mozilla-error], optional) + — original error cause of the message +* `place` ([`Point`][github-unist-point] or [`Position`][github-unist-position], + optional) + — place of message +* `ruleId` (`string`, optional, example: `'my-rule'`) + — category of message +* `source` (`string`, optional, , example: `'my-package'`) + — namespace of who sent the message + +### Well-known + +It’s OK to store custom data directly on the `VFileMessage`, some of those are +handled by [utilities][github-vfile-util]. +The following fields are documented and typed here. + +###### Fields + +* `actual` (`string`, optional) + — specify the source value that’s being reported, which is deemed incorrect +* `expected` (`Array<string>`, optional) + — suggest acceptable values that can be used instead of `actual` +* `url` (`string`, optional) + — link to docs for the message (this must be an absolute URL that can be + passed as `x` to `new URL(x)`) +* `note` (`string`, optional) + — long form description of the message (you should use markdown) + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `vfile-message@^4`, +compatible with Node.js 16. + +## Contribute + +See [`contributing.md`][health-contributing] in [`vfile/.github`][health] +for ways to get started. +See [`support.md`][health-support] for ways to get help. + +This project has a [code of conduct][health-coc]. +By interacting with this repository, +organization, +or community you agree to abide by its terms. + +## License + +[MIT][file-license] © [Titus Wormer][wooorm] + +<!-- Definitions --> + +[api-options]: #options + +[api-vfile-message]: #vfilemessagereason-options + +[badge-build-image]: https://github.com/vfile/vfile-message/workflows/main/badge.svg + +[badge-build-url]: https://github.com/vfile/vfile-message/actions + +[badge-coverage-image]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg + +[badge-coverage-url]: https://codecov.io/github/vfile/vfile-message + +[badge-downloads-image]: https://img.shields.io/npm/dm/vfile-message.svg + +[badge-downloads-url]: https://www.npmjs.com/package/vfile-message + +[badge-size-image]: https://img.shields.io/bundlejs/size/vfile-message + +[badge-size-url]: https://bundlejs.com/?q=vfile-message + +[developer-mozilla-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error + +[esmsh]: https://esm.sh + +[file-license]: license + +[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[github-unist-node]: https://github.com/syntax-tree/unist#node + +[github-unist-point]: https://github.com/syntax-tree/unist#point + +[github-unist-position]: https://github.com/syntax-tree/unist#position + +[github-vfile]: https://github.com/vfile/vfile + +[github-vfile-util]: https://github.com/vfile/vfile#utilities + +[health]: https://github.com/vfile/.github + +[health-coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md + +[health-contributing]: https://github.com/vfile/.github/blob/main/contributing.md + +[health-support]: https://github.com/vfile/.github/blob/main/support.md + +[npmjs-install]: https://docs.npmjs.com/cli/install + +[typescript]: https://www.typescriptlang.org + +[wooorm]: https://wooorm.com diff --git a/node_modules/vfile/index.d.ts b/node_modules/vfile/index.d.ts new file mode 100644 index 00000000..3d87485d --- /dev/null +++ b/node_modules/vfile/index.d.ts @@ -0,0 +1,153 @@ +import type {VFile} from './lib/index.js' + +// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts> +declare const emptyObjectSymbol: unique symbol + +// To do: next major: remove. +export type {Options as MessageOptions} from 'vfile-message' + +export {VFile} from './lib/index.js' + +// To do: next major: remove. +// Deprecated names (w/ prefix): +export type { + Compatible as VFileCompatible, + DataMap as VFileDataMap, + Data as VFileData, + Options as VFileOptions, + ReporterSettings as VFileReporterSettings, + Reporter as VFileReporter, + Value as VFileValue +} + +/** + * Things that can be passed to the constructor. + */ +export type Compatible = Options | URL | VFile | Value + +/** + * Raw source map. + * + * See: + * <https://github.com/mozilla/source-map/blob/60adcb0/source-map.d.ts#L15-L23>. + */ +export interface Map { + /** + * The generated file this source map is associated with. + */ + file: string + /** + * A string of base64 VLQs which contain the actual mappings. + */ + mappings: string + /** + * An array of identifiers which can be referenced by individual mappings. + */ + names: Array<string> + /** + * An array of contents of the original source files. + */ + sourcesContent?: Array<string> | undefined + /** + * The URL root from which all sources are relative. + */ + sourceRoot?: string | undefined + /** + * An array of URLs to the original source files. + */ + sources: Array<string> + /** + * Which version of the source map spec this map is following. + */ + version: number +} + +/** + * This map registers the type of the `data` key of a `VFile`. + * + * This type can be augmented to register custom `data` types. + * + * @example + * declare module 'vfile' { + * interface DataMap { + * // `file.data.name` is typed as `string` + * name: string + * } + * } + */ +export interface DataMap { + [emptyObjectSymbol]?: never +} + +/** + * Custom info. + * + * Known attributes can be added to {@linkcode DataMap} + */ +export type Data = Record<string, unknown> & Partial<DataMap> + +/** + * Configuration. + */ +export interface Options { + /** + * Arbitrary fields that will be shallow copied over to the new file. + */ + [key: string]: unknown + /** + * Set `basename` (name). + */ + basename?: string | null | undefined + /** + * Set `cwd` (working directory). + */ + cwd?: string | null | undefined + /** + * Set `data` (associated info). + */ + data?: Data | null | undefined + /** + * Set `dirname` (path w/o basename). + */ + dirname?: string | null | undefined + /** + * Set `extname` (extension with dot). + */ + extname?: string | null | undefined + /** + * Set `history` (paths the file moved between). + */ + history?: Array<string> | null | undefined + /** + * Set `path` (current path). + */ + path?: URL | string | null | undefined + /** + * Set `stem` (name without extension). + */ + stem?: string | null | undefined + /** + * Set `value` (the contents of the file). + */ + value?: Value | null | undefined +} + +/** + * Configuration for reporters. + */ +export type ReporterSettings = Record<string, unknown> + +/** + * Type for a reporter. + */ +export type Reporter<Settings = ReporterSettings> = ( + files: Array<VFile>, + options: Settings +) => string + +/** + * Contents of the file. + * + * Can either be text or a `Uint8Array` structure. + */ +export type Value = Uint8Array | string diff --git a/node_modules/vfile/index.js b/node_modules/vfile/index.js new file mode 100644 index 00000000..329a4dcc --- /dev/null +++ b/node_modules/vfile/index.js @@ -0,0 +1,2 @@ +// More types exposed from `index.d.ts`. +export {VFile} from './lib/index.js' diff --git a/node_modules/vfile/license b/node_modules/vfile/license new file mode 100644 index 00000000..f3722d94 --- /dev/null +++ b/node_modules/vfile/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/vfile/package.json b/node_modules/vfile/package.json new file mode 100644 index 00000000..cd586823 --- /dev/null +++ b/node_modules/vfile/package.json @@ -0,0 +1,134 @@ +{ + "name": "vfile", + "version": "6.0.3", + "description": "Virtual file format for text processing", + "license": "MIT", + "keywords": [ + "vfile", + "virtual", + "file", + "text", + "processing", + "message", + "warning", + "error", + "remark", + "retext", + "rehype" + ], + "repository": "vfile/vfile", + "bugs": "https://github.com/vfile/vfile/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "Brendan Abbott <brendan.abbott@temando.com>", + "Denys Dovhan <email@denysdovhan.com>", + "Kyle Mathews <mathews.kyle@gmail.com>", + "Shinnosuke Watanabe <snnskwtnb@gmail.com>", + "Sindre Sorhus <sindresorhus@gmail.com>" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "imports": { + "#minpath": { + "node": "./lib/minpath.js", + "default": "./lib/minpath.browser.js" + }, + "#minproc": { + "node": "./lib/minproc.js", + "default": "./lib/minproc.browser.js" + }, + "#minurl": { + "node": "./lib/minurl.js", + "default": "./lib/minurl.browser.js" + } + }, + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.59.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm", + [ + "remark-lint-no-html", + false + ] + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/node_modules/vfile/readme.md b/node_modules/vfile/readme.md new file mode 100644 index 00000000..e5127c75 --- /dev/null +++ b/node_modules/vfile/readme.md @@ -0,0 +1,785 @@ +<h1> + <img src="https://raw.githubusercontent.com/vfile/vfile/fc8164b/logo.svg?sanitize=true" alt="vfile" /> +</h1> + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +**vfile** is a small and browser friendly virtual file format that tracks +metadata about files (such as its `path` and `value`) and lint +[messages][api-vfile-messages]. + +## Contents + +* [unified](#unified) +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`VFile(options?)`](#vfileoptions) + * [`file.cwd`](#filecwd) + * [`file.data`](#filedata) + * [`file.history`](#filehistory) + * [`file.messages`](#filemessages) + * [`file.value`](#filevalue) + * [`file.basename`](#filebasename) + * [`file.dirname`](#filedirname) + * [`file.extname`](#fileextname) + * [`file.path`](#filepath) + * [`file.stem`](#filestem) + * [`VFile#fail(reason[, options])`](#vfilefailreason-options) + * [`VFile#info(reason[, options])`](#vfileinforeason-options) + * [`VFile#message(reason[, options])`](#vfilemessagereason-options) + * [`VFile#toString(encoding?)`](#vfiletostringencoding) + * [`Compatible`](#compatible) + * [`Data`](#data) + * [`DataMap`](#datamap) + * [`Map`](#map) + * [`MessageOptions`](#messageoptions) + * [`Options`](#options) + * [`Reporter`](#reporter) + * [`ReporterSettings`](#reportersettings) + * [`Value`](#value) + * [Well-known](#well-known) +* [List of utilities](#list-of-utilities) +* [Reporters](#reporters) +* [Types](#types) +* [Compatibility](#compatibility) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [Acknowledgments](#acknowledgments) +* [License](#license) + +## unified + +**vfile** is part of the unified collective. + +* for more about us, see [`unifiedjs.com`][site] +* for how the collective is governed, see [`unifiedjs/collective`][governance] +* for updates, see [@unifiedjs][twitter] on Twitter + +## What is this? + +This package provides a virtual file format. +It exposes an API to access the file value, path, metadata about the file, and +specifically supports attaching lint messages and errors to certain places in +these files. + +## When should I use this? + +The virtual file format is useful when dealing with the concept of files in +places where you might not be able to access the file system. +The message API is particularly useful when making things that check files (as +in, linting). + +vfile is made for [unified][], which amongst other things checks files. +However, vfile can be used in other projects that deal with parsing, +transforming, and serializing data, to build linters, compilers, static site +generators, and other build tools. + +This is different from the excellent [`vinyl`][vinyl] in that vfile has a +smaller API, a smaller size, and focuses on messages. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install vfile +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {VFile} from 'https://esm.sh/vfile@6' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {VFile} from 'https://esm.sh/vfile@6?bundle' +</script> +``` + +## Use + +```js +import {VFile} from 'vfile' + +const file = new VFile({ + path: '~/example.txt', + value: 'Alpha *braavo* charlie.' +}) + +console.log(file.path) // => '~/example.txt' +console.log(file.dirname) // => '~' + +file.extname = '.md' + +console.log(file.basename) // => 'example.md' + +file.basename = 'index.text' + +console.log(file.history) // => ['~/example.txt', '~/example.md', '~/index.text'] + +file.message('Unexpected unknown word `braavo`, did you mean `bravo`?', { + place: {line: 1, column: 8}, + source: 'spell', + ruleId: 'typo' +}) + +console.log(file.messages) +``` + +Yields: + +```txt +[ + [~/index.text:1:8: Unexpected unknown word `braavo`, did you mean `bravo`?] { + ancestors: undefined, + cause: undefined, + column: 8, + fatal: false, + line: 1, + place: { line: 1, column: 8 }, + reason: 'Unexpected unknown word `braavo`, did you mean `bravo`?', + ruleId: 'typo', + source: 'spell', + file: '~/index.text' + } +] +``` + +## API + +This package exports the identifier [`VFile`][api-vfile]. +There is no default export. + +### `VFile(options?)` + +Create a new virtual file. + +`options` is treated as: + +* `string` or [`Uint8Array`][mdn-uint8-array] — `{value: options}` +* `URL` — `{path: options}` +* `VFile` — shallow copies its data over to the new file +* `object` — all fields are shallow copied over to the new file + +Path related fields are set in the following order (least specific to +most specific): `history`, `path`, `basename`, `stem`, `extname`, +`dirname`. + +You cannot set `dirname` or `extname` without setting either `history`, +`path`, `basename`, or `stem` too. + +###### Parameters + +* `options` ([`Compatible`][api-compatible], optional) + — file value + +###### Returns + +New instance (`VFile`). + +###### Example + +```js +new VFile() +new VFile('console.log("alpha");') +new VFile(new Uint8Array([0x65, 0x78, 0x69, 0x74, 0x20, 0x31])) +new VFile({path: path.join('path', 'to', 'readme.md')}) +new VFile({stem: 'readme', extname: '.md', dirname: path.join('path', 'to')}) +new VFile({other: 'properties', are: 'copied', ov: {e: 'r'}}) +``` + +### `file.cwd` + +Base of `path` (`string`, default: `process.cwd()` or `'/'` in browsers). + +### `file.data` + +Place to store custom info (`Record<string, unknown>`, default: `{}`). + +It’s OK to store custom data directly on the file but moving it to `data` is +recommended. + +### `file.history` + +List of file paths the file moved between (`Array<string>`). + +The first is the original path and the last is the current path. + +### `file.messages` + +List of messages associated with the file +([`Array<VFileMessage>`][api-vfile-message]). + +### `file.value` + +Raw value ([`Uint8Array`][mdn-uint8-array], `string`, `undefined`). + +### `file.basename` + +Get or set the basename (including extname) (`string?`, example: `'index.min.js'`). + +Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` on +windows). +Cannot be nullified (use `file.path = file.dirname` instead). + +### `file.dirname` + +Get or set the parent path (`string?`, example: `'~'`). + +Cannot be set if there’s no `path` yet. + +### `file.extname` + +Get or set the extname (including dot) (`string?`, example: `'.js'`). + +Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` on +windows). +Cannot be set if there’s no `path` yet. + +### `file.path` + +Get or set the full path (`string?`, example: `'~/index.min.js'`). + +Cannot be nullified. +You can set a file URL (a `URL` object with a `file:` protocol) which will be +turned into a path with [`url.fileURLToPath`][file-url-to-path]. + +### `file.stem` + +Get or set the stem (basename w/o extname) (`string?`, example: `'index.min'`). + +Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` on +windows). +Cannot be nullified. + +### `VFile#fail(reason[, options])` + +Create a fatal message for `reason` associated with the file. + +The `fatal` field of the message is set to `true` (error; file not usable) and +the `file` field is set to the current file path. +The message is added to the `messages` field on `file`. + +> 🪦 **Note**: also has obsolete signatures. + +###### Parameters + +* `reason` (`string`) + — reason for message, should use markdown +* `options` ([`MessageOptions`][api-message-options], optional) + — configuration + +###### Returns + +Nothing (`never`). + +###### Throws + +Message ([`VFileMessage`][vmessage]). + +### `VFile#info(reason[, options])` + +Create an info message for `reason` associated with the file. + +The `fatal` field of the message is set to `undefined` (info; change likely not +needed) and the `file` field is set to the current file path. +The message is added to the `messages` field on `file`. + +> 🪦 **Note**: also has obsolete signatures. + +###### Parameters + +* `reason` (`string`) + — reason for message, should use markdown +* `options` ([`MessageOptions`][api-message-options], optional) + — configuration + +###### Returns + +Message ([`VFileMessage`][vmessage]). + +### `VFile#message(reason[, options])` + +Create a message for `reason` associated with the file. + +The `fatal` field of the message is set to `false` (warning; change may be +needed) and the `file` field is set to the current file path. +The message is added to the `messages` field on `file`. + +> 🪦 **Note**: also has obsolete signatures. + +###### Parameters + +* `reason` (`string`) + — reason for message, should use markdown +* `options` ([`MessageOptions`][api-message-options], optional) + — configuration + +###### Returns + +Message ([`VFileMessage`][vmessage]). + +### `VFile#toString(encoding?)` + +Serialize the file. + +> **Note**: which encodings are supported depends on the engine. +> For info on Node.js, see: +> <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + +###### Parameters + +* `encoding` (`string`, default: `'utf8'`) + — character encoding to understand `value` as when it’s a + [`Uint8Array`][mdn-uint8-array] + +###### Returns + +Serialized file (`string`). + +### `Compatible` + +Things that can be passed to the constructor (TypeScript type). + +###### Type + +```ts +type Compatible = Options | URL | VFile | Value +``` + +### `Data` + +Custom info (TypeScript type). + +Known attributes can be added to [`DataMap`][api-data-map]. + +###### Type + +```ts +type Data = Record<string, unknown> & Partial<DataMap> +``` + +### `DataMap` + +This map registers the type of the `data` key of a `VFile` (TypeScript type). + +This type can be augmented to register custom `data` types. + +###### Type + +```ts +interface DataMap {} +``` + +###### Example + +```ts +declare module 'vfile' { + interface DataMap { + // `file.data.name` is typed as `string` + name: string + } +} +``` + +### `Map` + +Raw source map (TypeScript type). + +See [`source-map`][source-map]. + +###### Fields + +* `version` (`number`) + — which version of the source map spec this map is following +* `sources` (`Array<string>`) + — an array of URLs to the original source files +* `names` (`Array<string>`) + — an array of identifiers which can be referenced by individual mappings +* `sourceRoot` (`string`, optional) + — the URL root from which all sources are relative +* `sourcesContent` (`Array<string>`, optional) + — an array of contents of the original source files +* `mappings` (`string`) + — a string of base64 VLQs which contain the actual mappings +* `file` (`string`) + — the generated file this source map is associated with + +### `MessageOptions` + +Options to create messages (TypeScript type). + +See [`Options` in `vfile-message`][vfile-message-options]. + +### `Options` + +An object with arbitrary fields and the following known fields (TypeScript +type). + +###### Fields + +* `basename` (`string`, optional) + — set `basename` (name) +* `cwd` (`string`, optional) + — set `cwd` (working directory) +* `data` ([`Data`][api-data], optional) + — set `data` (associated info) +* `dirname` (`string`, optional) + — set `dirname` (path w/o basename) +* `extname` (`string`, optional) + — set `extname` (extension with dot) +* `history` (`Array<string>`, optional) + — set `history` (paths the file moved between) +* `path` (`URL | string`, optional) + — set `path` (current path) +* `stem` (`string`, optional) + — set `stem` (name without extension) +* `value` ([`Value`][api-value], optional) + — set `value` (the contents of the file) + +### `Reporter` + +Type for a reporter (TypeScript type). + +###### Type + +```ts +type Reporter<Settings = ReporterSettings> = ( + files: Array<VFile>, + options: Settings +) => string +``` + +### `ReporterSettings` + +Configuration for reporters (TypeScript type). + +###### Type + +```ts +type ReporterSettings = Record<string, unknown> +``` + +### `Value` + +Contents of the file (TypeScript type). + +Can either be text or a [`Uint8Array`][mdn-uint8-array] structure. + +###### Type + +```ts +type Value = Uint8Array | string +``` + +### Well-known + +The following fields are considered “non-standard”, but they are allowed, and +some utilities use them: + +* `map` ([`Map`][api-map]) + — source map; this type is equivalent to the `RawSourceMap` type from the + `source-map` module +* `result` (`unknown`) + — custom, non-string, compiled, representation; this is used by unified to + store non-string results; one example is when turning markdown into React + nodes +* `stored` (`boolean`) + — whether a file was saved to disk; this is used by vfile reporters + +There are also well-known fields on messages, see +[them in a similar section of +`vfile-message`](https://github.com/vfile/vfile-message#well-known). + +<a name="utilities"></a> + +## List of utilities + +* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile) + — transform from [Vinyl][] +* [`to-vfile`](https://github.com/vfile/to-vfile) + — create a file from a file path and read and write to the file system +* [`vfile-find-down`](https://github.com/vfile/vfile-find-down) + — find files by searching the file system downwards +* [`vfile-find-up`](https://github.com/vfile/vfile-find-up) + — find files by searching the file system upwards +* [`vfile-glob`](https://github.com/shinnn/vfile-glob) + — find files by glob patterns +* [`vfile-is`](https://github.com/vfile/vfile-is) + — check if a file passes a test +* [`vfile-location`](https://github.com/vfile/vfile-location) + — convert between positional and offset locations +* [`vfile-matter`](https://github.com/vfile/vfile-matter) + — parse the YAML front matter +* [`vfile-message`](https://github.com/vfile/vfile-message) + — create a file message +* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics) + — transform file messages to VS Code diagnostics +* [`vfile-mkdirp`](https://github.com/vfile/vfile-mkdirp) + — make sure the directory of a file exists on the file system +* [`vfile-rename`](https://github.com/vfile/vfile-rename) + — rename the path parts of a file +* [`vfile-sort`](https://github.com/vfile/vfile-sort) + — sort messages by line/column +* [`vfile-statistics`](https://github.com/vfile/vfile-statistics) + — count messages per category: failures, warnings, etc +* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint) + — convert to ESLint formatter compatible output + +> 👉 **Note**: see [unist][] for projects that work with nodes. + +## Reporters + +* [`vfile-reporter`][reporter] + — create a report +* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json) + — create a JSON report +* [`vfile-reporter-folder-json`](https://github.com/vfile/vfile-reporter-folder-json) + — create a JSON representation of vfiles +* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty) + — create a pretty report +* [`vfile-reporter-junit`](https://github.com/kellyselden/vfile-reporter-junit) + — create a jUnit report +* [`vfile-reporter-position`](https://github.com/Hocdoc/vfile-reporter-position) + — create a report with content excerpts + +> 👉 **Note**: want to make your own reporter? +> Reporters *must* accept `Array<VFile>` as their first argument, and return +> `string`. +> Reporters *may* accept other values too, in which case it’s suggested to stick +> to `vfile-reporter`s interface. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types +[`Compatible`][api-compatible], +[`Data`][api-data], +[`DataMap`][api-data-map], +[`Map`][api-map], +[`MessageOptions`][api-message-options], +[`Options`][api-options], +[`Reporter`][api-reporter], +[`ReporterSettings`][api-reporter-settings], and +[`Value`][api-value]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `vfile@^6`, +compatible with Node.js 16. + +## Contribute + +See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to +get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## Sponsor + +Support this effort and give back by sponsoring on [OpenCollective][collective]! + +<table> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +<td width="10%"></td> +<td width="10%"></td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="8"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## Acknowledgments + +The initial release of this project was authored by +[**@wooorm**](https://github.com/wooorm). + +Thanks to [**@contra**](https://github.com/contra), +[**@phated**](https://github.com/phated), and others for their work on +[Vinyl][], which was a huge inspiration. + +Thanks to +[**@brendo**](https://github.com/brendo), +[**@shinnn**](https://github.com/shinnn), +[**@KyleAMathews**](https://github.com/KyleAMathews), +[**@sindresorhus**](https://github.com/sindresorhus), and +[**@denysdovhan**](https://github.com/denysdovhan) +for contributing commits since! + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/vfile/vfile/workflows/main/badge.svg + +[build]: https://github.com/vfile/vfile/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile.svg + +[coverage]: https://codecov.io/github/vfile/vfile + +[downloads-badge]: https://img.shields.io/npm/dm/vfile.svg + +[downloads]: https://www.npmjs.com/package/vfile + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=vfile + +[size]: https://bundlejs.com/?q=vfile + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/vfile/vfile/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[health]: https://github.com/vfile/.github + +[contributing]: https://github.com/vfile/.github/blob/main/contributing.md + +[support]: https://github.com/vfile/.github/blob/main/support.md + +[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[unified]: https://github.com/unifiedjs/unified + +[vinyl]: https://github.com/gulpjs/vinyl + +[site]: https://unifiedjs.com + +[twitter]: https://twitter.com/unifiedjs + +[unist]: https://github.com/syntax-tree/unist#list-of-utilities + +[reporter]: https://github.com/vfile/vfile-reporter + +[vmessage]: https://github.com/vfile/vfile-message + +[vfile-message-options]: https://github.com/vfile/vfile-message#options + +[mdn-uint8-array]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array + +[source-map]: https://github.com/mozilla/source-map/blob/58819f0/source-map.d.ts#L15-L23 + +[file-url-to-path]: https://nodejs.org/api/url.html#url_url_fileurltopath_url + +[governance]: https://github.com/unifiedjs/collective + +[api-vfile-messages]: #filemessages + +[api-vfile-message]: #vfilemessagereason-options + +[api-vfile]: #vfileoptions + +[api-compatible]: #compatible + +[api-data]: #data + +[api-data-map]: #datamap + +[api-map]: #map + +[api-message-options]: #messageoptions + +[api-options]: #options + +[api-reporter]: #reporter + +[api-reporter-settings]: #reportersettings + +[api-value]: #value diff --git a/node_modules/zwitch/index.d.ts b/node_modules/zwitch/index.d.ts new file mode 100644 index 00000000..cee48bce --- /dev/null +++ b/node_modules/zwitch/index.d.ts @@ -0,0 +1,67 @@ +/** + * Handle values based on a field. + * + * @template {InvalidHandler} [Invalid=InvalidHandler] + * @template {UnknownHandler} [Unknown=UnknownHandler] + * @template {Record<string, Handler>} [Handlers=Record<string, Handler>] + * @param {string} key + * Field to switch on. + * @param {Options<Invalid, Unknown, Handlers>} [options] + * Configuration (required). + * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}} + */ +export function zwitch< + Invalid extends InvalidHandler = InvalidHandler, + Unknown extends UnknownHandler = UnknownHandler, + Handlers extends Record<string, Handler> = Record<string, Handler> +>( + key: string, + options?: Options<Invalid, Unknown, Handlers> | undefined +): { + (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType< + Handlers[keyof Handlers] + > + (...parameters: Parameters<Unknown>): ReturnType<Unknown> + unknown: Unknown + invalid: Invalid + handlers: Handlers +} +/** + * Handle a value, with a certain ID field set to a certain value. + * The ID field is passed to `zwitch`, and it’s value is this function’s + * place on the `handlers` record. + */ +export type Handler = (...parameters: any[]) => any +/** + * Handle values that do have a certain ID field, but it’s set to a value + * that is not listed in the `handlers` record. + */ +export type UnknownHandler = (value: unknown, ...rest: any[]) => any +/** + * Handle values that do not have a certain ID field. + */ +export type InvalidHandler = ( + value: unknown, + ...rest: any[] +) => void | null | undefined | never +/** + * Configuration (required). + */ +export type Options< + Invalid extends InvalidHandler = InvalidHandler, + Unknown extends UnknownHandler = UnknownHandler, + Handlers extends Record<string, Handler> = Record<string, Handler> +> = { + /** + * Handler to use for invalid values. + */ + invalid?: Invalid | undefined + /** + * Handler to use for unknown values. + */ + unknown?: Unknown | undefined + /** + * Handlers to use. + */ + handlers?: Handlers | undefined +} diff --git a/node_modules/zwitch/index.js b/node_modules/zwitch/index.js new file mode 100644 index 00000000..c6bf1b89 --- /dev/null +++ b/node_modules/zwitch/index.js @@ -0,0 +1,118 @@ +/** + * @callback Handler + * Handle a value, with a certain ID field set to a certain value. + * The ID field is passed to `zwitch`, and it’s value is this function’s + * place on the `handlers` record. + * @param {...any} parameters + * Arbitrary parameters passed to the zwitch. + * The first will be an object with a certain ID field set to a certain value. + * @returns {any} + * Anything! + */ + +/** + * @callback UnknownHandler + * Handle values that do have a certain ID field, but it’s set to a value + * that is not listed in the `handlers` record. + * @param {unknown} value + * An object with a certain ID field set to an unknown value. + * @param {...any} rest + * Arbitrary parameters passed to the zwitch. + * @returns {any} + * Anything! + */ + +/** + * @callback InvalidHandler + * Handle values that do not have a certain ID field. + * @param {unknown} value + * Any unknown value. + * @param {...any} rest + * Arbitrary parameters passed to the zwitch. + * @returns {void|null|undefined|never} + * This should crash or return nothing. + */ + +/** + * @template {InvalidHandler} [Invalid=InvalidHandler] + * @template {UnknownHandler} [Unknown=UnknownHandler] + * @template {Record<string, Handler>} [Handlers=Record<string, Handler>] + * @typedef Options + * Configuration (required). + * @property {Invalid} [invalid] + * Handler to use for invalid values. + * @property {Unknown} [unknown] + * Handler to use for unknown values. + * @property {Handlers} [handlers] + * Handlers to use. + */ + +const own = {}.hasOwnProperty + +/** + * Handle values based on a field. + * + * @template {InvalidHandler} [Invalid=InvalidHandler] + * @template {UnknownHandler} [Unknown=UnknownHandler] + * @template {Record<string, Handler>} [Handlers=Record<string, Handler>] + * @param {string} key + * Field to switch on. + * @param {Options<Invalid, Unknown, Handlers>} [options] + * Configuration (required). + * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}} + */ +export function zwitch(key, options) { + const settings = options || {} + + /** + * Handle one value. + * + * Based on the bound `key`, a respective handler will be called. + * If `value` is not an object, or doesn’t have a `key` property, the special + * “invalid” handler will be called. + * If `value` has an unknown `key`, the special “unknown” handler will be + * called. + * + * All arguments, and the context object, are passed through to the handler, + * and it’s result is returned. + * + * @this {unknown} + * Any context object. + * @param {unknown} [value] + * Any value. + * @param {...unknown} parameters + * Arbitrary parameters passed to the zwitch. + * @property {Handler} invalid + * Handle for values that do not have a certain ID field. + * @property {Handler} unknown + * Handle values that do have a certain ID field, but it’s set to a value + * that is not listed in the `handlers` record. + * @property {Handlers} handlers + * Record of handlers. + * @returns {unknown} + * Anything. + */ + function one(value, ...parameters) { + /** @type {Handler|undefined} */ + let fn = one.invalid + const handlers = one.handlers + + if (value && own.call(value, key)) { + // @ts-expect-error Indexable. + const id = String(value[key]) + // @ts-expect-error Indexable. + fn = own.call(handlers, id) ? handlers[id] : one.unknown + } + + if (fn) { + return fn.call(this, value, ...parameters) + } + } + + one.handlers = settings.handlers || {} + one.invalid = settings.invalid + one.unknown = settings.unknown + + // @ts-expect-error: matches! + return one +} diff --git a/node_modules/zwitch/license b/node_modules/zwitch/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/zwitch/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/zwitch/package.json b/node_modules/zwitch/package.json new file mode 100644 index 00000000..058a0c48 --- /dev/null +++ b/node_modules/zwitch/package.json @@ -0,0 +1,72 @@ +{ + "name": "zwitch", + "version": "2.0.4", + "description": "Handle values based on a property", + "license": "MIT", + "keywords": [ + "handle", + "switch", + "property" + ], + "repository": "wooorm/zwitch", + "bugs": "https://github.com/wooorm/zwitch/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^18.0.0", + "c8": "^7.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "tsd": "^0.24.0", + "type-coverage": "^2.0.0", + "typescript": "^4.0.0", + "xo": "^0.52.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && tsd && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreFiles": [ + "index.d.ts" + ] + } +} diff --git a/node_modules/zwitch/readme.md b/node_modules/zwitch/readme.md new file mode 100644 index 00000000..813dc3d4 --- /dev/null +++ b/node_modules/zwitch/readme.md @@ -0,0 +1,226 @@ +# zwitch + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Handle values based on a field. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`zwitch(key[, options])`](#zwitchkey-options) + * [`one(value[, rest…])`](#onevalue-rest) + * [`function handler(value[, rest…])`](#function-handlervalue-rest) +* [Types](#types) +* [Compatibility](#compatibility) +* [Related](#related) +* [Contribute](#contribute) +* [Security](#security) +* [License](#license) + +## What is this? + +This is a tiny package that lets you `switch` between some field on objects. + +## When should I use this? + +This package is very useful when mapping one AST to another. +It’s a lot like a `switch` statement on one field, but it’s extensible. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: + +```sh +npm install zwitch +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {zwitch} from 'https://esm.sh/zwitch@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {zwitch} from 'https://esm.sh/zwitch@2?bundle' +</script> +``` + +## Use + +```js +import {zwitch} from 'zwitch' + +const handle = zwitch('type', {invalid, unknown, handlers: {alpha: handleAlpha}}) + +handle({type: 'alpha'}) + +function handleAlpha() { /* … */ } +``` + +Or, with a `switch` statement: + +```js +const field = 'type' + +function handle(value) { + let fn = invalid + + if (value && typeof value === 'object' && field in value) { + switch (value[field]) { + case 'alpha': + fn = handleAlpha + break + default: + fn = unknown + break + } + } + + return fn.apply(this, arguments) +} + +handle({type: 'alpha'}) + +function handleAlpha() { /* … */ } +function unknown() { /* … */ } +function invalid() { /* … */ } +``` + +## API + +This package exports the identifier `zwitch`. +There is no default export. + +### `zwitch(key[, options])` + +Create a switch, based on a `key` (`string`). + +##### `options` + +Options can be omitted and added later to `one`. + +###### `options.handlers` + +Handlers to use, stored on `one.handlers` (`Record<string, Function>`, +optional). + +###### `options.unknown` + +Handler to use for unknown values, stored on `one.unknown` (`Function`, +optional). + +###### `options.invalid` + +Handler to use for invalid values, stored on `one.invalid` (`Function`, +optional). + +###### Returns + +See [`one`][one] (`Function`). + +### `one(value[, rest…])` + +Handle one value. +Based on the bound `key`, a respective handler will be called. +If `value` is not an object, or doesn’t have a `key` property, the special +“invalid” handler will be called. +If `value` has an unknown `key`, the special “unknown” handler will be called. + +All arguments, and the context object (`this`), are passed through to the +[handler][], and it’s result is returned. + +###### `one.handlers` + +Map of [handler][]s (`Record<string, Function>`). + +###### `one.invalid` + +Special [`handler`][handler] called if a value doesn’t have a `key` property. +If not set, `undefined` is returned for invalid values. + +###### `one.unknown` + +Special [`handler`][handler] called if a value does not have a matching +handler. +If not set, `undefined` is returned for unknown values. + +### `function handler(value[, rest…])` + +Handle one value. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the types `Handler`, `UnknownHandler`, `InvalidHandler`, and +`Options`. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Related + +* [`mapz`](https://github.com/wooorm/mapz) + — functional map + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## Security + +This package is safe. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/wooorm/zwitch/workflows/main/badge.svg + +[build]: https://github.com/wooorm/zwitch/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/zwitch.svg + +[coverage]: https://codecov.io/github/wooorm/zwitch + +[downloads-badge]: https://img.shields.io/npm/dm/zwitch.svg + +[downloads]: https://www.npmjs.com/package/zwitch + +[size-badge]: https://img.shields.io/bundlephobia/minzip/zwitch.svg + +[size]: https://bundlephobia.com/result?p=zwitch + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[license]: license + +[author]: https://wooorm.com + +[one]: #onevalue-rest + +[handler]: #function-handlervalue-rest diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..3f8d491b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1536 @@ +{ + "name": "gateway", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "react-markdown": "^9.1.0", + "remark-gfm": "^4.0.1" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT", + "peer": true + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", + "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-markdown": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.1.0.tgz", + "integrity": "sha512-xaijuJB0kzGiUdG7nc2MOMDUDBWPyGAjZtUrow9XxUeua8IqeP+VlIfAZ3bphpcLTnSZXz6z9jcVC/TCwbfgdw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..08b2436a --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "react-markdown": "^9.1.0", + "remark-gfm": "^4.0.1" + } +}