diff --git a/README-zh_CN.md b/README-zh_CN.md index 85fde690..4189c314 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -4,6 +4,12 @@ 本书完全免费且开源。 +## 翻译 + +本书已被翻译成多种语言版本,包括: + +* [中文](./README-zh_CN.md) + ## 下载 您还可以在这里下载 Epub 版本: @@ -14,6 +20,7 @@ - [简洁的TypeScript之书](#简洁的typescript之书) + - [翻译](#翻译) - [下载](#下载) - [目录表](#目录表) - [介绍](#介绍) diff --git a/tools/.vscode/launch.json b/tools/.vscode/launch.json index a6d6f72f..600d2b9c 100644 --- a/tools/.vscode/launch.json +++ b/tools/.vscode/launch.json @@ -22,6 +22,14 @@ "/**", "node_modules/**" ] + }, + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true } ] } \ No newline at end of file diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 00000000..3b3eece4 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,11 @@ +format: + npm run format + +check: + npm run check + +website: + python3 ./make-website-content.py + +books: + ./make-books.sh \ No newline at end of file diff --git a/tools/README.md b/tools/README.md index 7bedd480..c6c2bd9c 100644 --- a/tools/README.md +++ b/tools/README.md @@ -11,7 +11,16 @@ nvm use npm install ``` -## Formatting +## Commands + +Use `make` to run the main commands: + +- `make format`: Format Markdown files for books. +- `make check`: Run several checks to ensure the Markdown files are valid. +- `make website`: Create different Markdown pages for the website. +- `make books`: Create .epub books. + +### Formatting Consistent code formatting is crucial. To format all TypeScript snippets, we use Prettier. Execute the following command for formatting: @@ -19,7 +28,7 @@ Consistent code formatting is crucial. To format all TypeScript snippets, we use npm run format ``` -## Compilation +### Compilation To compile TypeScript snippets within the Markdown files, utilize the following command: @@ -27,7 +36,7 @@ To compile TypeScript snippets within the Markdown files, utilize the following npm run compile ``` -## Linting +### Linting To ensure that your Markdown files adhere to proper formatting rules, use the linting command: @@ -35,7 +44,7 @@ To ensure that your Markdown files adhere to proper formatting rules, use the li npm run lint:md ``` -## Linting and Formatting +### Linting and Formatting For a comprehensive process that includes linting all Markdown files, applying Prettier formatting to all TypeScript snippets, and compiling them using TypeScript, use the following command: @@ -43,13 +52,13 @@ For a comprehensive process that includes linting all Markdown files, applying P npm run check ``` -## Skipping Compilation +### Skipping Compilation If you have specific snippets in the Markdown files that you don't want to compile, simply add `` just before the TypeScript demarcation for those snippets. -## Epub Generation +### Epub Generation -To generate Epub files from your Markdown books, navigate to the `tools`` folder and run the following command: +To generate Epub files from your Markdown books, navigate to the `tools` folder and run the following command: ```shell make-books.sh diff --git a/tools/make-website-content.py b/tools/make-website-content.py new file mode 100644 index 00000000..fc5edf65 --- /dev/null +++ b/tools/make-website-content.py @@ -0,0 +1,139 @@ +""" +Generate multiple Markdown documents from a single Markdown file by splitting it based on headings. +This script is designed for creating pages on a website and provides results for multiple languages. +Note: the number of headings per language must be the same. +""" + +import os +import re +import shutil + +# INPUT_FILE_PATH = "./test-md/README.md" +# OUTPUT_DIR_PATH = "./test-md/en" +# INPUT_FILE_PATH_CN = "./test-md/README-zh_CN.md" +# OUTPUT_DIR_PATH_CN = "./test-md/zh-cn" + +INPUT_FILE_PATH = "../README.md" +OUTPUT_DIR_PATH = "../website/src/content/docs/book" + +INPUT_FILE_PATH_CN = "../README-zh_CN.md" +OUTPUT_DIR_PATH_CN = "../website/src/content/docs/zh-cn/book" + + +def manage_output_dir(path): + if os.path.exists(path): + shutil.rmtree(path) + os.makedirs(path) + + +def read_content_file(path): + with open(path, "r") as file: + lines = file.readlines() + return lines + + +def make_file_name(name): + content_sanitized = re.sub(r"[^a-zA-Z0-9]+", "-", name.lower()).strip("-") + return f"{content_sanitized}" + + +def make_output_path(output_dir, file_name): + return f"{output_dir}/{file_name}.md" + + +def is_line_header_1_to_2(line): + return re.match(r"^(#{1,2})\s+(.+)", line) + + +def make_file_output_path(output_dir, name): + file_name = make_file_name(name) + output_file_path = make_output_path(output_dir, file_name) + return output_file_path + + +def make_markdown_page_metadata(order, header): + return [ + "---\n", + f"title: {header}\n", + "sidebar:\n", + f" order: {order}\n", + f" label: {order}. {header}\n", + "---\n", + "\n", + ] + + +def save_content_to_file(path, lines): + with open(path, "w") as output_file: + output_file.writelines(lines) + + +def save_pages_to_files(data_pages, master_headers, output_dir): + for index, header in enumerate(master_headers): + file = make_file_output_path(output_dir, header) + save_content_to_file(file, data_pages[index]) + + +def find_master_headers(lines): + headers = [x for x in lines if is_line_header_1_to_2(x)] + headers_clean = list(map(lambda x: make_file_name(x), headers)) + return headers_clean + + +def remove_markdown_anchors(markdown_text): + pattern = r"\[(.*?)\]\(#[^\)]*\)" + replacement = r"\1" + transformed_text = re.sub(pattern, replacement, markdown_text) + return transformed_text + + +def split_content_by_headings(lines): + current_content = [] + in_page = False + header_index = -1 + content_result = [] + + for line in lines: + is_header_match = is_line_header_1_to_2(line) + if is_header_match: + header_text = is_header_match.group(2).strip() + header_index += 1 + if not in_page: + in_page = True + current_content.extend( + make_markdown_page_metadata(header_index + 1, header_text) + ) + else: + content_result.extend([current_content]) + current_content = [] + in_page = True + current_content.extend( + make_markdown_page_metadata(header_index + 1, header_text) + ) + else: + line_new = remove_markdown_anchors(line) + current_content.append(line_new) + + header_index += 1 + content_result.extend([current_content]) + + return content_result + + +content_lines_master = read_content_file(INPUT_FILE_PATH) +master_headers = find_master_headers(content_lines_master) + + +def process(base_input, base_output): + manage_output_dir(base_output) + content_lines = read_content_file(base_input) + data_pages = split_content_by_headings( + content_lines, + ) + save_pages_to_files(data_pages, master_headers, base_output) + print(f"A total of: {len(master_headers)} files were at: {base_output}") + + +process(INPUT_FILE_PATH, OUTPUT_DIR_PATH) + +process(INPUT_FILE_PATH_CN, OUTPUT_DIR_PATH_CN) diff --git a/tools/test-md/README-zh_CN.md b/tools/test-md/README-zh_CN.md new file mode 100644 index 00000000..62b5c78d --- /dev/null +++ b/tools/test-md/README-zh_CN.md @@ -0,0 +1,12 @@ +# 简洁 TypeScript 书 +TypeScript 有效开发简明指南。 **免费和开源**。 +## 创建文件和文件夹 +可使用 按钮访问文件资源管理器。 +## 切换到另一个文件 +您的所有文件和文件夹都在文件资源管理器中显示为树。 您可以通过单击树中的文件从一个文件切换到另一个文件。 +### 新标题 +一些家长内容。 +#### 嵌套内容 1 +更多内容在这里。 +##### 嵌套内容 2 +内容甚至更多。 \ No newline at end of file diff --git a/tools/test-md/README.md b/tools/test-md/README.md new file mode 100644 index 00000000..ad477b8b --- /dev/null +++ b/tools/test-md/README.md @@ -0,0 +1,12 @@ +# The Concise TypeScript Book +A Concise Guide to Effective Development in TypeScript. **Free and Open Source**. +## Create files and folders +The file explorer is accessible using the button. +## Switch to another file +All your files and folders are presented as a tree in the file explorer. You can switch from one to another by clicking a file in the tree. +### New title +Some parent content. +#### Nested content 1 +More content here. +##### Nested content 2 +Even more content. \ No newline at end of file diff --git a/website/.gitignore b/website/.gitignore new file mode 100644 index 00000000..6240da8b --- /dev/null +++ b/website/.gitignore @@ -0,0 +1,21 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/website/.nvmrc b/website/.nvmrc new file mode 100644 index 00000000..49d3df9f --- /dev/null +++ b/website/.nvmrc @@ -0,0 +1 @@ +v19.7.0 diff --git a/website/.prettierrc b/website/.prettierrc new file mode 100644 index 00000000..3e9b77a0 --- /dev/null +++ b/website/.prettierrc @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "printWidth": 80, + "arrowParens": "avoid" +} \ No newline at end of file diff --git a/website/.vscode/extensions.json b/website/.vscode/extensions.json new file mode 100644 index 00000000..22a15055 --- /dev/null +++ b/website/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/website/.vscode/launch.json b/website/.vscode/launch.json new file mode 100644 index 00000000..d6422097 --- /dev/null +++ b/website/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/website/README.md b/website/README.md new file mode 100644 index 00000000..b51abaab --- /dev/null +++ b/website/README.md @@ -0,0 +1,54 @@ +# Starlight Starter Kit: Basics + +[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) + +``` +npm create astro@latest -- --template starlight +``` + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) +[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs) + +> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! + +## 🚀 Project Structure + +Inside of your Astro + Starlight project, you'll see the following folders and files: + +``` +. +├── public/ +├── src/ +│ ├── assets/ +│ ├── content/ +│ │ ├── docs/ +│ │ └── config.ts +│ └── env.d.ts +├── astro.config.mjs +├── package.json +└── tsconfig.json +``` + +Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. + +Images can be added to `src/assets/` and embedded in Markdown with a relative link. + +Static assets, like favicons, can be placed in the `public/` directory. + +## 🧞 Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | + +## 👀 Want to learn more? + +Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). diff --git a/website/astro.config.mjs b/website/astro.config.mjs new file mode 100644 index 00000000..2f4303d7 --- /dev/null +++ b/website/astro.config.mjs @@ -0,0 +1,34 @@ +import { defineConfig } from 'astro/config'; +import starlight from '@astrojs/starlight'; + +// https://astro.build/config +export default defineConfig({ + site: 'https://gibbok.github.io/typescript-book', + integrations: [ + starlight({ + title: 'TypeScript Book', + customCss: ['./src/styles/custom.css'], + social: { + github: 'https://github.com/gibbok/typescript-book', + 'x.com': 'https://twitter.com/gibbok_coding', + }, + defaultLocale: 'root', + locales: { + root: { + label: 'English', + lang: 'en', + }, + 'zh-cn': { + label: '简体中文', + lang: 'zh-CN', + }, + }, + sidebar: [ + { + label: 'TypeScript Book', + autogenerate: { directory: 'book' }, + }, + ], + }), + ], +}); diff --git a/website/package-lock.json b/website/package-lock.json new file mode 100644 index 00000000..9390d09c --- /dev/null +++ b/website/package-lock.json @@ -0,0 +1,8077 @@ +{ + "name": "website", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "website", + "version": "0.0.1", + "dependencies": { + "@astrojs/check": "^0.4.1", + "@astrojs/starlight": "^0.15.3", + "astro": "^4.0.1", + "sharp": "^0.32.5", + "typescript": "^5.3.3" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@astrojs/check": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@astrojs/check/-/check-0.4.1.tgz", + "integrity": "sha512-XEsuU4TlWkgcsvdeessq5mXLXV1fejtxIioCPv/FfhTzb1bDYe2BtLiSBK+rFTyD9Hl686YOas9AGNMJcpoRsw==", + "dependencies": { + "@astrojs/language-server": "^2.6.2", + "chokidar": "^3.5.3", + "fast-glob": "^3.3.1", + "kleur": "^4.1.5", + "yargs": "^17.7.2" + }, + "bin": { + "astro-check": "dist/bin.js" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } + }, + "node_modules/@astrojs/compiler": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.4.1.tgz", + "integrity": "sha512-4M6G6UBI84gPYzyN6jSG3c+jeZ3dBVOnGPzp47SS5ayc2tsWhbXZ4nnNWGJU+ESiQ6ScjywJnpddxTO2w41Qeg==" + }, + "node_modules/@astrojs/internal-helpers": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.2.1.tgz", + "integrity": "sha512-06DD2ZnItMwUnH81LBLco3tWjcZ1lGU9rLCCBaeUCGYe9cI0wKyY2W3kDyoW1I6GmcWgt1fu+D1CTvz+FIKf8A==" + }, + "node_modules/@astrojs/language-server": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@astrojs/language-server/-/language-server-2.6.2.tgz", + "integrity": "sha512-RYzPRhS/WBXK5JtfR+0+nGj+N3VbJd5jU/uSNUev9baUx/RLmUwDk1f6Oy8QDEfDDLAr76Ig8YeDD/nxPdBSLw==", + "dependencies": { + "@astrojs/compiler": "^2.4.0", + "@jridgewell/sourcemap-codec": "^1.4.15", + "@volar/kit": "~1.11.1", + "@volar/language-core": "~1.11.1", + "@volar/language-server": "~1.11.1", + "@volar/language-service": "~1.11.1", + "@volar/source-map": "~1.11.1", + "@volar/typescript": "~1.11.1", + "fast-glob": "^3.2.12", + "muggle-string": "^0.3.1", + "volar-service-css": "0.0.17", + "volar-service-emmet": "0.0.17", + "volar-service-html": "0.0.17", + "volar-service-prettier": "0.0.17", + "volar-service-typescript": "0.0.17", + "volar-service-typescript-twoslash-queries": "0.0.17", + "vscode-html-languageservice": "^5.1.0", + "vscode-uri": "^3.0.8" + }, + "bin": { + "astro-ls": "bin/nodeServer.js" + }, + "peerDependencies": { + "prettier": "^3.0.0", + "prettier-plugin-astro": ">=0.11.0" + }, + "peerDependenciesMeta": { + "prettier": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + } + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-4.0.1.tgz", + "integrity": "sha512-RU4ESnqvyLpj8WZs0n5elS6idaDdtIIm7mIpMaRNPCebpxMjfcfdwcmBwz83ktAj5d2eO5bC3z92TcGdli+lRw==", + "dependencies": { + "@astrojs/prism": "^3.0.0", + "github-slugger": "^2.0.0", + "import-meta-resolve": "^4.0.0", + "mdast-util-definitions": "^6.0.0", + "rehype-raw": "^7.0.0", + "rehype-stringify": "^10.0.0", + "remark-gfm": "^4.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "remark-smartypants": "^2.0.0", + "shikiji": "^0.6.13", + "unified": "^11.0.4", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.1" + } + }, + "node_modules/@astrojs/mdx": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@astrojs/mdx/-/mdx-2.0.4.tgz", + "integrity": "sha512-8q8p7AfiGa6CEKUEEWDLZ7HsfonmZlzx8HITZp8eJnkh+n6mmD9vQTpuFNjJc3hiiMEEKLGTIjOUGAU4aGBkrA==", + "dependencies": { + "@astrojs/markdown-remark": "4.0.1", + "@mdx-js/mdx": "^3.0.0", + "acorn": "^8.11.2", + "es-module-lexer": "^1.4.1", + "estree-util-visit": "^2.0.0", + "github-slugger": "^2.0.0", + "gray-matter": "^4.0.3", + "hast-util-to-html": "^9.0.0", + "kleur": "^4.1.4", + "rehype-raw": "^7.0.0", + "remark-gfm": "^4.0.0", + "remark-smartypants": "^2.0.0", + "source-map": "^0.7.4", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.1" + }, + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "astro": "^4.0.0" + } + }, + "node_modules/@astrojs/prism": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.0.0.tgz", + "integrity": "sha512-g61lZupWq1bYbcBnYZqdjndShr/J3l/oFobBKPA3+qMat146zce3nz2kdO4giGbhYDt4gYdhmoBz0vZJ4sIurQ==", + "dependencies": { + "prismjs": "^1.29.0" + }, + "engines": { + "node": ">=18.14.1" + } + }, + "node_modules/@astrojs/sitemap": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.0.4.tgz", + "integrity": "sha512-RSqiqs0oD8zTGaClHM0YB8n7e5En+Ihi+6qKthWf47pRkzHpENwlPGvKuEL0kUFXq+GzYot9e2JYH58gtr2q0w==", + "dependencies": { + "sitemap": "^7.1.1", + "zod": "^3.22.4" + } + }, + "node_modules/@astrojs/starlight": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/@astrojs/starlight/-/starlight-0.15.3.tgz", + "integrity": "sha512-4lyVwn0SEOHN6fRS++hYLjPa/Ax6uw2g29z/Y9n1oWwGxnly0R1T1GsSXfciGE0o2fCLzbFLx8KffS/OZWUwIw==", + "dependencies": { + "@astrojs/mdx": "^2.0.0", + "@astrojs/sitemap": "^3.0.3", + "@pagefind/default-ui": "^1.0.3", + "@types/hast": "^3.0.3", + "@types/mdast": "^4.0.3", + "astro-expressive-code": "^0.30.1", + "bcp-47": "^2.1.0", + "hast-util-select": "^6.0.2", + "hastscript": "^8.0.0", + "mdast-util-directive": "^3.0.0", + "pagefind": "^1.0.3", + "rehype": "^13.0.1", + "remark-directive": "^3.0.0", + "unified": "^11.0.4", + "unist-util-remove": "^4.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.1" + }, + "peerDependencies": { + "astro": "^4.0.0" + } + }, + "node_modules/@astrojs/telemetry": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.0.4.tgz", + "integrity": "sha512-A+0c7k/Xy293xx6odsYZuXiaHO0PL+bnDoXOc47sGDF5ffIKdKQGRPFl2NMlCF4L0NqN4Ynbgnaip+pPF0s7pQ==", + "dependencies": { + "ci-info": "^3.8.0", + "debug": "^4.3.4", + "dlv": "^1.1.3", + "dset": "^3.1.2", + "is-docker": "^3.0.0", + "is-wsl": "^3.0.0", + "which-pm-runs": "^1.1.0" + }, + "engines": { + "node": ">=18.14.1" + } + }, + "node_modules/@astrojs/telemetry/node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "dependencies": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", + "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.7", + "@babel/parser": "^7.23.6", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "dependencies": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", + "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", + "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", + "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.23.4.tgz", + "integrity": "sha512-5xOpoPguCZCRbo/JeHlloSkTA8Bld1J/E1/kLfD1nsuiW1m8tduTA1ERCgIZokDflX/IBzKcqR3l7VlRgiIfHA==", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-jsx": "^7.23.3", + "@babel/types": "^7.23.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@ctrl/tinycolor": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", + "integrity": "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@emmetio/abbreviation": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz", + "integrity": "sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==", + "dependencies": { + "@emmetio/scanner": "^1.0.4" + } + }, + "node_modules/@emmetio/css-abbreviation": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@emmetio/css-abbreviation/-/css-abbreviation-2.1.8.tgz", + "integrity": "sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw==", + "dependencies": { + "@emmetio/scanner": "^1.0.4" + } + }, + "node_modules/@emmetio/scanner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@emmetio/scanner/-/scanner-1.0.4.tgz", + "integrity": "sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA==" + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@expressive-code/core": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/@expressive-code/core/-/core-0.30.2.tgz", + "integrity": "sha512-haWKg3hb1Pc9nwfE+ceolRRhU/dM4pBJtWvc08vXvmZh4fEZyvBS0B3qdbNncUif/1YEfxi73PMSk1HtctHmBg==", + "dependencies": { + "@ctrl/tinycolor": "^3.6.0", + "hast-util-to-html": "^8.0.4", + "hastscript": "^7.2.0", + "postcss": "^8.4.21", + "postcss-nested": "^6.0.1" + } + }, + "node_modules/@expressive-code/core/node_modules/@types/hast": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", + "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@expressive-code/core/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/@expressive-code/core/node_modules/hast-util-from-parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz", + "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/unist": "^2.0.0", + "hastscript": "^7.0.0", + "property-information": "^6.0.0", + "vfile": "^5.0.0", + "vfile-location": "^4.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hast-util-raw": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/parse5": "^6.0.0", + "hast-util-from-parse5": "^7.0.0", + "hast-util-to-parse5": "^7.0.0", + "html-void-elements": "^2.0.0", + "parse5": "^6.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hast-util-to-html": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz", + "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/unist": "^2.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-raw": "^7.0.0", + "hast-util-whitespace": "^2.0.0", + "html-void-elements": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hast-util-to-parse5": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hast-util-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/html-void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/@expressive-code/core/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/@expressive-code/core/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/unist-util-position": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/vfile-location": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.1.0.tgz", + "integrity": "sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==", + "dependencies": { + "@types/unist": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/core/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-frames": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-frames/-/plugin-frames-0.30.2.tgz", + "integrity": "sha512-vsY275FmVMPXz2n6lCirFArqUTogl2tVqWldhRaLUwz92Zm6y90nZrEKLQlZfdD0D86jrlW350SPRofVm/ISnw==", + "dependencies": { + "@expressive-code/core": "^0.30.2", + "hastscript": "^7.2.0" + } + }, + "node_modules/@expressive-code/plugin-frames/node_modules/@types/hast": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", + "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@expressive-code/plugin-frames/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/@expressive-code/plugin-frames/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-frames/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-shiki": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-shiki/-/plugin-shiki-0.30.2.tgz", + "integrity": "sha512-9tEHuJJpeln9LqyXk91YHs9DVEamde4mrXVT7XS0v3KgthAOqFyFeldVE1WJVN1sMqEP+c3W080g33+PjJOY6Q==", + "dependencies": { + "@expressive-code/core": "^0.30.2", + "shikiji": "^0.8.0" + } + }, + "node_modules/@expressive-code/plugin-shiki/node_modules/shikiji": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/shikiji/-/shikiji-0.8.7.tgz", + "integrity": "sha512-j5usxwI0yHkDTHOuhuSJl9+wT5CNYeYO82dJMSJBlJ/NYT5SIebGcPoL6y9QOyH15wGrJC4LOP2nz5k8mUDGRQ==", + "dependencies": { + "hast-util-to-html": "^9.0.0" + } + }, + "node_modules/@expressive-code/plugin-text-markers": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.30.2.tgz", + "integrity": "sha512-SUz6f2je7zgG6elcYmBdZczO4JfF/1VVCUTwWWdwuYHDSfyfpS9ySQBbERzH8zGGfT6FU62V0MwXzVxrNujeKA==", + "dependencies": { + "@expressive-code/core": "^0.30.2", + "hastscript": "^7.2.0", + "unist-util-visit-parents": "^5.1.3" + } + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/@types/hast": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", + "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@expressive-code/plugin-text-markers/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@mdx-js/mdx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.0.0.tgz", + "integrity": "sha512-Icm0TBKBLYqroYbNW3BPnzMGn+7mwpQOK310aZ7+fkCtiU3aqv2cdcX+nd0Ydo3wI5Rx8bX2Z2QmGb/XcAClCw==", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdx": "^2.0.0", + "collapse-white-space": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-build-jsx": "^3.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-util-to-js": "^2.0.0", + "estree-walker": "^3.0.0", + "hast-util-to-estree": "^3.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "markdown-extensions": "^2.0.0", + "periscopic": "^3.0.0", + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "source-map": "^0.7.0", + "unified": "^11.0.0", + "unist-util-position-from-estree": "^2.0.0", + "unist-util-stringify-position": "^4.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pagefind/darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.0.4.tgz", + "integrity": "sha512-2OcthvceX2xhm5XbgOmW+lT45oLuHqCmvFeFtxh1gsuP5cO8vcD8ZH8Laj4pXQFCcK6eAdSShx+Ztx/LsQWZFQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.0.4.tgz", + "integrity": "sha512-xkdvp0D9Ld/ZKsjo/y1bgfhTEU72ITimd2PMMQtts7jf6JPIOJbsiErCvm37m/qMFuPGEq/8d+fZ4pydOj08HQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/default-ui": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/default-ui/-/default-ui-1.0.4.tgz", + "integrity": "sha512-edkcaPSKq67C49Vehjo+LQCpT615v4d7JRhfGzFPccePvdklaL+VXrfghN/uIfsdoG+HoLI1PcYy2iFcB9CTkw==" + }, + "node_modules/@pagefind/linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.0.4.tgz", + "integrity": "sha512-jGBrcCzIrMnNxLKVtogaQyajVfTAXM59KlBEwg6vTn8NW4fQ6nuFbbhlG4dTIsaamjEM5e8ZBEAKZfTB/qd9xw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.0.4.tgz", + "integrity": "sha512-LIn/QcvcEtLEBqKe5vpSbSC2O3fvqbRCWOTIklslqSORisCsvzsWbP6j+LYxE9q0oWIfkdMoWV1vrE/oCKRxHg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/windows-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.0.4.tgz", + "integrity": "sha512-QlBCVeZfj9fc9sbUgdOz76ZDbeK4xZihOBAFqGuRJeChfM8pnVeH9iqSnXgO3+m9oITugTf7PicyRUFAG76xeQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.5.tgz", + "integrity": "sha512-idWaG8xeSRCfRq9KpRysDHJ/rEHBEXcHuJ82XY0yYFIWnLMjZv9vF/7DOq8djQ2n3Lk6+3qfSH8AqlmHlmi1MA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.5.tgz", + "integrity": "sha512-f14d7uhAMtsCGjAYwZGv6TwuS3IFaM4ZnGMUn3aCBgkcHAYErhV1Ad97WzBvS2o0aaDv4mVz+syiN0ElMyfBPg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.5.tgz", + "integrity": "sha512-ndoXeLx455FffL68OIUrVr89Xu1WLzAG4n65R8roDlCoYiQcGGg6MALvs2Ap9zs7AHg8mpHtMpwC8jBBjZrT/w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.5.tgz", + "integrity": "sha512-UmElV1OY2m/1KEEqTlIjieKfVwRg0Zwg4PLgNf0s3glAHXBN99KLpw5A5lrSYCa1Kp63czTpVll2MAqbZYIHoA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.5.tgz", + "integrity": "sha512-Q0LcU61v92tQB6ae+udZvOyZ0wfpGojtAKrrpAaIqmJ7+psq4cMIhT/9lfV6UQIpeItnq/2QDROhNLo00lOD1g==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.5.tgz", + "integrity": "sha512-dkRscpM+RrR2Ee3eOQmRWFjmV/payHEOrjyq1VZegRUa5OrZJ2MAxBNs05bZuY0YCtpqETDy1Ix4i/hRqX98cA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.5.tgz", + "integrity": "sha512-QaKFVOzzST2xzY4MAmiDmURagWLFh+zZtttuEnuNn19AiZ0T3fhPyjPPGwLNdiDT82ZE91hnfJsUiDwF9DClIQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.5.tgz", + "integrity": "sha512-HeGqmRJuyVg6/X6MpE2ur7GbymBPS8Np0S/vQFHDmocfORT+Zt76qu+69NUoxXzGqVP1pzaY6QIi0FJWLC3OPA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.5.tgz", + "integrity": "sha512-Dq1bqBdLaZ1Gb/l2e5/+o3B18+8TI9ANlA1SkejZqDgdU/jK/ThYaMPMJpVMMXy2uRHvGKbkz9vheVGdq3cJfA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.5.tgz", + "integrity": "sha512-ezyFUOwldYpj7AbkwyW9AJ203peub81CaAIVvckdkyH8EvhEIoKzaMFJj0G4qYJ5sw3BpqhFrsCc30t54HV8vg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.5.tgz", + "integrity": "sha512-aHSsMnUw+0UETB0Hlv7B/ZHOGY5bQdwMKJSzGfDfvyhnpmVxLMGnQPGNE9wgqkLUs3+gbG1Qx02S2LLfJ5GaRQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.5.tgz", + "integrity": "sha512-AiqiLkb9KSf7Lj/o1U3SEP9Zn+5NuVKgFdRIZkvd4N0+bYrTOovVd0+LmYCPQGbocT4kvFyK+LXCDiXPBF3fyA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.5.tgz", + "integrity": "sha512-1q+mykKE3Vot1kaFJIDoUFv5TuW+QQVaf2FmTT9krg86pQrGStOSJJ0Zil7CFagyxDuouTepzt5Y5TVzyajOdQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/acorn": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", + "integrity": "sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.5.tgz", + "integrity": "sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "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==", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.3.tgz", + "integrity": "sha512-pvQ+TKeRHeiUGRhvYwRrQ/ISnohKkSJR14fT2yqyZ4e9K5vqc7hrtY2Y1Dw0ZwAzQ6DQsxsaCUuSIIi8v0Cq6w==", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.3.tgz", + "integrity": "sha512-2fYGlaDy/qyLlhidX42wAH0KBi2TCjKMH8CHmBXgRlJ3Y+OXTiqsPQ6IWarZKwF1JoUcAJdPogv1d4b0COTpmQ==", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", + "integrity": "sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdx": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.10.tgz", + "integrity": "sha512-Rllzc5KHk0Al5/WANwgSPl1/CwjqCy+AZrGd78zuK+jO9aDM6ffblZ+zIjgPNAaEBmlO0RYDvLNh7wD0zKVgEg==" + }, + "node_modules/@types/ms": { + "version": "0.7.34", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" + }, + "node_modules/@types/nlcst": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/nlcst/-/nlcst-1.0.4.tgz", + "integrity": "sha512-ABoYdNQ/kBSsLvZAekMhIPMQ3YUZvavStpKYs7BjLLuKVmIMA0LUgZ7b54zzuWJRbHF80v1cNf4r90Vd6eMQDg==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@types/nlcst/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/@types/node": { + "version": "20.11.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.4.tgz", + "integrity": "sha512-6I0fMH8Aoy2lOejL3s4LhyIYX34DPwY8bl5xlNjBvUEk8OHrcuzsFt+Ied4LvJihbtXPM+8zUqdydfIti86v9g==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + }, + "node_modules/@types/sax": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/sax/-/sax-1.2.7.tgz", + "integrity": "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/unist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" + }, + "node_modules/@volar/kit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/kit/-/kit-1.11.1.tgz", + "integrity": "sha512-nqO+Hl9f1ygOK/3M7Hpnw0lhKvuMFhh823nilStpkTmm5WfrUnE+4WaQkb3dC6LM3TZq74j2m88yxRC+Z3sZZw==", + "dependencies": { + "@volar/language-service": "1.11.1", + "typesafe-path": "^0.2.2", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "typescript": "*" + } + }, + "node_modules/@volar/language-core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.11.1.tgz", + "integrity": "sha512-dOcNn3i9GgZAcJt43wuaEykSluAuOkQgzni1cuxLxTV0nJKanQztp7FxyswdRILaKH+P2XZMPRp2S4MV/pElCw==", + "dependencies": { + "@volar/source-map": "1.11.1" + } + }, + "node_modules/@volar/language-server": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/language-server/-/language-server-1.11.1.tgz", + "integrity": "sha512-XYG4HcML2qimQV9UouQ7c1GuuqQw1NXoNDxAOAcfyYlz43P+HgzGQx4QEou+QMGHJeYIN86foDvkTN3fcopw9A==", + "dependencies": { + "@volar/language-core": "1.11.1", + "@volar/language-service": "1.11.1", + "@volar/typescript": "1.11.1", + "@vscode/l10n": "^0.0.16", + "path-browserify": "^1.0.1", + "request-light": "^0.7.0", + "vscode-languageserver": "^9.0.1", + "vscode-languageserver-protocol": "^3.17.5", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" + } + }, + "node_modules/@volar/language-service": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-1.11.1.tgz", + "integrity": "sha512-dKo8z1UzQRPHnlXxwfONGrasS1wEWXMoLQiohZ8KgWqZALbekZCwdGImLZD4DeFGNjk3HTTdfeCzo3KjwohjEQ==", + "dependencies": { + "@volar/language-core": "1.11.1", + "@volar/source-map": "1.11.1", + "vscode-languageserver-protocol": "^3.17.5", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" + } + }, + "node_modules/@volar/source-map": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.11.1.tgz", + "integrity": "sha512-hJnOnwZ4+WT5iupLRnuzbULZ42L7BWWPMmruzwtLhJfpDVoZLjNBxHDi2sY2bgZXCKlpU5XcsMFoYrsQmPhfZg==", + "dependencies": { + "muggle-string": "^0.3.1" + } + }, + "node_modules/@volar/typescript": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.11.1.tgz", + "integrity": "sha512-iU+t2mas/4lYierSnoFOeRFQUhAEMgsFuQxoxvwn5EdQopw43j+J27a4lt9LMInx1gLJBC6qL14WYGlgymaSMQ==", + "dependencies": { + "@volar/language-core": "1.11.1", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@vscode/emmet-helper": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@vscode/emmet-helper/-/emmet-helper-2.9.2.tgz", + "integrity": "sha512-MaGuyW+fa13q3aYsluKqclmh62Hgp0BpKIqS66fCxfOaBcVQ1OnMQxRRgQUYnCkxFISAQlkJ0qWWPyXjro1Qrg==", + "dependencies": { + "emmet": "^2.4.3", + "jsonc-parser": "^2.3.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-languageserver-types": "^3.15.1", + "vscode-uri": "^2.1.2" + } + }, + "node_modules/@vscode/emmet-helper/node_modules/vscode-uri": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==" + }, + "node_modules/@vscode/l10n": { + "version": "0.0.16", + "resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.16.tgz", + "integrity": "sha512-JT5CvrIYYCrmB+dCana8sUqJEcGB1ZDXNLMQ2+42bW995WmNoenijWMUdZfwmuQUTQcEVVIa2OecZzTYWUW9Cg==" + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/array-iterate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-2.0.1.tgz", + "integrity": "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/astring": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/astring/-/astring-1.8.6.tgz", + "integrity": "sha512-ISvCdHdlTDlH5IpxQJIex7BWBywFWgjJSVdwst+/iQCoEYnyOaQ95+X1JGshuBjGp6nxKUy1jMgE3zPqN7fQdg==", + "bin": { + "astring": "bin/astring" + } + }, + "node_modules/astro": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/astro/-/astro-4.1.3.tgz", + "integrity": "sha512-9i8l0mEnpAOAi9F3DMkHGaZ4q56TGtt71XaAxhPXAlhZrVR/6ruobCyYdYwL1Fo0ATpuGXdaod1I7FFxFMcQbw==", + "dependencies": { + "@astrojs/compiler": "^2.3.4", + "@astrojs/internal-helpers": "0.2.1", + "@astrojs/markdown-remark": "4.0.1", + "@astrojs/telemetry": "3.0.4", + "@babel/core": "^7.23.3", + "@babel/generator": "^7.23.3", + "@babel/parser": "^7.23.3", + "@babel/plugin-transform-react-jsx": "^7.22.5", + "@babel/traverse": "^7.23.3", + "@babel/types": "^7.23.3", + "@types/babel__core": "^7.20.4", + "acorn": "^8.11.2", + "aria-query": "^5.3.0", + "axobject-query": "^4.0.0", + "boxen": "^7.1.1", + "chokidar": "^3.5.3", + "ci-info": "^4.0.0", + "clsx": "^2.0.0", + "common-ancestor-path": "^1.0.1", + "cookie": "^0.6.0", + "debug": "^4.3.4", + "deterministic-object-hash": "^2.0.1", + "devalue": "^4.3.2", + "diff": "^5.1.0", + "dlv": "^1.1.3", + "dset": "^3.1.3", + "es-module-lexer": "^1.4.1", + "esbuild": "^0.19.6", + "estree-walker": "^3.0.3", + "execa": "^8.0.1", + "fast-glob": "^3.3.2", + "flattie": "^1.1.0", + "github-slugger": "^2.0.0", + "gray-matter": "^4.0.3", + "html-escaper": "^3.0.3", + "http-cache-semantics": "^4.1.1", + "js-yaml": "^4.1.0", + "kleur": "^4.1.4", + "magic-string": "^0.30.3", + "mdast-util-to-hast": "13.0.2", + "mime": "^3.0.0", + "ora": "^7.0.1", + "p-limit": "^5.0.0", + "p-queue": "^8.0.1", + "path-to-regexp": "^6.2.1", + "preferred-pm": "^3.1.2", + "probe-image-size": "^7.2.3", + "prompts": "^2.4.2", + "rehype": "^13.0.1", + "resolve": "^1.22.4", + "semver": "^7.5.4", + "server-destroy": "^1.0.1", + "shikiji": "^0.6.13", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0", + "tsconfck": "^3.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.1", + "vite": "^5.0.10", + "vitefu": "^0.2.5", + "which-pm": "^2.1.1", + "yargs-parser": "^21.1.1", + "zod": "^3.22.4" + }, + "bin": { + "astro": "astro.js" + }, + "engines": { + "node": ">=18.14.1", + "npm": ">=6.14.0" + }, + "optionalDependencies": { + "sharp": "^0.32.6" + } + }, + "node_modules/astro-expressive-code": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.30.2.tgz", + "integrity": "sha512-W35TZcsYT5WTcLh+HeSZGK9zvkRvzE0PM1dVWX1EwKfgdGyUMb7W8L3XWkzsnaA9VxdkbCNr4y8PJ7KMRLEf6g==", + "dependencies": { + "remark-expressive-code": "^0.30.2" + }, + "peerDependencies": { + "astro": "^3.3.0 || ^4.0.0-beta" + } + }, + "node_modules/axobject-query": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", + "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/base-64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", + "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bcp-47": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.0.tgz", + "integrity": "sha512-9IIS3UPrvIa1Ej+lVDdDwO7zLehjqsaByECw0bu2RRGP73jALm6FYbzI5gWbgHLvNdkvfXB5YrSbocZdOS0c0w==", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/bcp-47-match": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz", + "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, + "node_modules/boxen": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-7.1.1.tgz", + "integrity": "sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog==", + "dependencies": { + "ansi-align": "^3.0.1", + "camelcase": "^7.0.1", + "chalk": "^5.2.0", + "cli-boxes": "^3.0.0", + "string-width": "^5.1.2", + "type-fest": "^2.13.0", + "widest-line": "^4.0.1", + "wrap-ansi": "^8.1.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/boxen/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/boxen/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/camelcase": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz", + "integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001577", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001577.tgz", + "integrity": "sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "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==", + "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==", + "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==", + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/ci-info": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", + "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/cliui/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/clsx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", + "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/collapse-white-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", + "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/color/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-selector-parser": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-3.0.4.tgz", + "integrity": "sha512-pnmS1dbKsz6KA4EW4BznyPL2xxkNDRg62hcD0v8g6DEw2W7hxOln5M953jsp9hmw5Dg57S6o/A8GOn37mbAgcQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/deterministic-object-hash": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", + "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", + "dependencies": { + "base-64": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/devalue": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-4.3.2.tgz", + "integrity": "sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==" + }, + "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==", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/diff": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", + "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/direction": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/direction/-/direction-2.0.1.tgz", + "integrity": "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==", + "bin": { + "direction": "cli.js" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" + }, + "node_modules/dset": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.3.tgz", + "integrity": "sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "node_modules/electron-to-chromium": { + "version": "1.4.632", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.632.tgz", + "integrity": "sha512-JGmudTwg7yxMYvR/gWbalqqQiyu7WTFv2Xu3vw4cJHXPFxNgAk0oy8UHaer8nLF4lZJa+rNoj6GsrKIVJTV6Tw==" + }, + "node_modules/emmet": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/emmet/-/emmet-2.4.6.tgz", + "integrity": "sha512-dJfbdY/hfeTyf/Ef7Y7ubLYzkBvPQ912wPaeVYpAxvFxkEBf/+hJu4H6vhAvFN6HlxqedlfVn2x1S44FfQ97pg==", + "dependencies": { + "@emmetio/abbreviation": "^2.3.3", + "@emmetio/css-abbreviation": "^2.1.8" + } + }, + "node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.4.1.tgz", + "integrity": "sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==" + }, + "node_modules/esbuild": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estree-util-attach-comments": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz", + "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==", + "dependencies": { + "@types/estree": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-build-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz", + "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-walker": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "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==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-to-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz", + "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "astring": "^1.8.0", + "source-map": "^0.7.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-visit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", + "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/expressive-code": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/expressive-code/-/expressive-code-0.30.2.tgz", + "integrity": "sha512-xnQIUxFduqomZLP7oJEzA4+yi9Yy3lH3ahvbpjVFA7kn9sxHsv5ZamJC0JCctnkAerwomKu9S7rnhqhLT73T2g==", + "dependencies": { + "@expressive-code/core": "^0.30.2", + "@expressive-code/plugin-frames": "^0.30.2", + "@expressive-code/plugin-shiki": "^0.30.2", + "@expressive-code/plugin-text-markers": "^0.30.2" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-yarn-workspace-root2": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root2/-/find-yarn-workspace-root2-1.2.16.tgz", + "integrity": "sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==", + "dependencies": { + "micromatch": "^4.0.2", + "pkg-dir": "^4.2.0" + } + }, + "node_modules/flattie": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.0.tgz", + "integrity": "sha512-xU99gDEnciIwJdGcBmNHnzTJ/w5AT+VFJOu6sTB6WM8diOYNA3Sa+K1DiEBQ7XH4QikQq3iFW1U+jRVcotQnBw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + }, + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==" + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/gray-matter": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", + "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", + "dependencies": { + "js-yaml": "^3.13.1", + "kind-of": "^6.0.2", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/gray-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/gray-matter/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hast-util-from-html": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz", + "integrity": "sha512-RXQBLMl9kjKVNkJTIO6bZyb2n+cUH8LFaSSzo82jiLT6Tfc+Pt7VQCS+/h3YwG4jaNE2TA2sdJisGWR+aJrp0g==", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.1.0", + "hast-util-from-parse5": "^8.0.0", + "parse5": "^7.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-from-parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.1.tgz", + "integrity": "sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "hastscript": "^8.0.0", + "property-information": "^6.0.0", + "vfile": "^6.0.0", + "vfile-location": "^5.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-has-property": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz", + "integrity": "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-parse-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", + "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-raw": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.0.1.tgz", + "integrity": "sha512-5m1gmba658Q+lO5uqL5YNGQWeh1MYWZbZmWrM5lncdcuiXuo5E2HT/CIOp0rLF8ksfSwiCVJ3twlgVRyTGThGA==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "@ungap/structured-clone": "^1.0.0", + "hast-util-from-parse5": "^8.0.0", + "hast-util-to-parse5": "^8.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "parse5": "^7.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-select": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hast-util-select/-/hast-util-select-6.0.2.tgz", + "integrity": "sha512-hT/SD/d/Meu+iobvgkffo1QecV8WeKWxwsNMzcTJsKw1cKTQKSR/7ArJeURLNJF9HDjp9nVoORyNNJxrvBye8Q==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "bcp-47-match": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "css-selector-parser": "^3.0.0", + "devlop": "^1.0.0", + "direction": "^2.0.0", + "hast-util-has-property": "^3.0.0", + "hast-util-to-string": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "not": "^0.1.0", + "nth-check": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-estree": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.0.tgz", + "integrity": "sha512-lfX5g6hqVh9kjS/B9E2gSkvHH4SZNiQFiqWS0x9fENzEl+8W12RqdRxX6d/Cwxi30tPQs3bIO+aolQJNp1bIyw==", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-attach-comments": "^3.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": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-object": "^0.4.0", + "unist-util-position": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-html": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.0.tgz", + "integrity": "sha512-IVGhNgg7vANuUA2XKrT6sOIIPgaYZnmLx3l/CCOAK0PtgfoHrZwX7jCSYyFxHTrGmC6S9q8aQQekjp4JPZF+cw==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-raw": "^9.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.0.tgz", + "integrity": "sha512-H/y0+IWPdsLLS738P8tDnrQ8Z+dj12zQQ6WC11TIM21C8WFVoIxcqWXf2H3hiTVZjF1AWqoimGwrTWecWrnmRQ==", + "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": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-object": "^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-to-jsx-runtime/node_modules/inline-style-parser": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.2.tgz", + "integrity": "sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ==" + }, + "node_modules/hast-util-to-jsx-runtime/node_modules/style-to-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.5.tgz", + "integrity": "sha512-rDRwHtoDD3UMMrmZ6BzOW0naTjMsVZLIjsGleSKS/0Oz+cgCfAPRspaqJuE8rDzpKha/nEvnM0IF4seEAZUTKQ==", + "dependencies": { + "inline-style-parser": "0.2.2" + } + }, + "node_modules/hast-util-to-parse5": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz", + "integrity": "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.0.tgz", + "integrity": "sha512-OGkAxX1Ua3cbcW6EJ5pT/tslVb90uViVkcJ4ZZIMW/R33DX/AkcJcRrPebPwJkHYwlDHXz4aIwvAAaAdtrACFA==", + "dependencies": { + "@types/hast": "^3.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==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hastscript": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-8.0.0.tgz", + "integrity": "sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^4.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-escaper": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", + "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==" + }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/import-meta-resolve": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", + "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/inline-style-parser": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", + "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==" + }, + "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==", + "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==", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "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==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-reference": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", + "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/load-yaml-file": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/load-yaml-file/-/load-yaml-file-0.2.0.tgz", + "integrity": "sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==", + "dependencies": { + "graceful-fs": "^4.1.5", + "js-yaml": "^3.13.0", + "pify": "^4.0.1", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/load-yaml-file/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/load-yaml-file/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/markdown-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz", + "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/markdown-table": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", + "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-definitions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", + "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-directive": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.0.0.tgz", + "integrity": "sha512-JUpYOqKI4mM3sZcNxmF/ox04XYFFkNwr0CFlrQIkCwbvH0xzMCqkMqAde9wRd80VAhaUrwFwKm2nxretdT1h7Q==", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.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-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.1.tgz", + "integrity": "sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==", + "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-find-and-replace/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==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz", + "integrity": "sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==", + "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.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.0.0.tgz", + "integrity": "sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==", + "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.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.0.tgz", + "integrity": "sha512-FyzMsduZZHSc3i0Px3PQcBT4WJY/X/RCtEJKuybiC6sjPqLv7h1yqAkmILZtuxMSsUyaLUWNp71+vQH2zqp5cg==", + "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.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.0.0.tgz", + "integrity": "sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==", + "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==", + "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==", + "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==", + "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": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", + "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^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.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.0.tgz", + "integrity": "sha512-fGCu8eWdKUKNu5mohVGkhBXCXGnOTLuFqOvGMvdikr+J1w7lDJgxThOKpwRWzzbyXAU2hhSwsmssOY4yTokluw==", + "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.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.0.0.tgz", + "integrity": "sha512-XZuPPzQNBPAlaqsTTgRrcJnyFbSOBovSadFgbFu8SnuNgm+6Bdx1K+IWoitsmj6Lq6MNtI+ytOqwN70n//NaBA==", + "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-remove-position": "^5.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==", + "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.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.0.0.tgz", + "integrity": "sha512-xadSsJayQIucJ9n053dfQwVu1kuXg7jCTdYsMK8rqzKZh52nLfSH/k0sAxE0u+pj/zKZX+o5wB+ML5mRayOxFA==", + "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.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.0.2.tgz", + "integrity": "sha512-U5I+500EOOw9e3ZrclN3Is3fRpw8c19SMyNZlZ2IS+7vLsNzb2Om11VpIVOR+/0137GhZsFEF6YiKD5+0Hr2Og==", + "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" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.0.tgz", + "integrity": "sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==", + "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-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==", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromark": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.0.tgz", + "integrity": "sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.0.tgz", + "integrity": "sha512-jThOz/pVmAYUtkroV3D5c1osFXAMv9e0ypGDOIZuCeAe91/sD6BoE2Sjzt30yuXtwOYUmySOhMas/PVyh02itA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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-directive": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-3.0.0.tgz", + "integrity": "sha512-61OI07qpQrERc+0wEysLHMvoiO3s2R56x5u7glHq2Yqq6EHbH4dW25G9GfDdGCDYqA21KE6DWgNSzxSwHc2hSg==", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "parse-entities": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "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==", + "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.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.0.0.tgz", + "integrity": "sha512-rTHfnpt/Q7dEAK1Y5ii0W8bhfJlVJFnJMHIPisfPK3gpVNuOP0VnRl96+YJ3RYWV/P4gFeQoGKNlT3RhuvpqAg==", + "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.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.0.0.tgz", + "integrity": "sha512-6Rzu0CYRKDv3BfLAUnZsSlzx3ak6HAoI85KTiijuKIz5UxZxbUI+pD6oHgw+6UtQuiRwnGRhzMmPRv4smcz0fg==", + "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.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-c3BR1ClMp5fxxmwP6AoOY2fXO9U8uFMKs4ADD66ahLTNcwzSCyRVU4k7LPV5Nxo/VJiR4TdzxRQY2v3qIUceCw==", + "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.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.0.0.tgz", + "integrity": "sha512-PoHlhypg1ItIucOaHmKE8fbin3vTLpDOUg8KAr8gRCF1MOZI9Nquq2i/44wFvviM4WuxJzc3demT8Y3dkfvYrw==", + "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==", + "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.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.0.1.tgz", + "integrity": "sha512-cY5PzGcnULaN5O7T+cOzfMoHjBW7j+T9D2sucA5d/KbsBTPcYdebm9zUd9zzdgJGCwahV+/W78Z3nbulBYVbTw==", + "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-mdx-expression": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz", + "integrity": "sha512-sI0nwhUDz97xyzqJAbHQhp5TfaxEvZZZ2JDqUo+7NvyIYG6BZ5CPPqj2ogUoPJlmXHBnyZUzISg9+oUmU6tUjQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-mdx-jsx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.0.tgz", + "integrity": "sha512-uvhhss8OGuzR4/N17L1JwvmJIpPhAd8oByMawEKx6NVdBCbesjH4t+vjEp3ZXft9DwvlKSD07fCeI44/N0Vf2w==", + "dependencies": { + "@types/acorn": "^4.0.0", + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "micromark-factory-mdx-expression": "^2.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", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdx-md": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", + "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", + "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", + "dependencies": { + "acorn": "^8.0.0", + "acorn-jsx": "^5.0.0", + "micromark-extension-mdx-expression": "^3.0.0", + "micromark-extension-mdx-jsx": "^3.0.0", + "micromark-extension-mdx-md": "^2.0.0", + "micromark-extension-mdxjs-esm": "^3.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-mdxjs-esm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", + "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.0.tgz", + "integrity": "sha512-j9DGrQLm/Uhl2tCzcbLhy5kXsgkHUrjJHg4fFAeoMRwJmJerT9aw4FEhIbZStWN8A3qMwOp1uzHr4UL8AInxtA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.0.tgz", + "integrity": "sha512-RR3i96ohZGde//4WSe/dJsxOX6vxIg9TimLAS3i4EhBAFx8Sm5SmqVfR8E87DPSR31nEAjZfbt91OMZWcNgdZw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.1.tgz", + "integrity": "sha512-F0ccWIUHRLRrYp5TC9ZYXmZo+p2AM13ggbsW4T0b5CRKP8KHVRB8t4pwtBgTxtjRmwrK0Irwm7vs2JOZabHZfg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.0.tgz", + "integrity": "sha512-TKr+LIDX2pkBJXFLzpyPyljzYK3MtmllMUMODTQJIUfDGncESaqB90db9IAUcz4AZAJFdd8U9zOp9ty1458rxg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.0.tgz", + "integrity": "sha512-jY8CSxmpWLOxS+t8W+FG3Xigc0RDQA9bKMY/EwILvsesiRniiVMejYTE4wumNc2f4UbAa4WsHqe3J1QS1sli+A==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.0.tgz", + "integrity": "sha512-28kbwaBjc5yAI1XadbdPYHX/eDnqaUFVikLwrO7FDnKG7lpgxnvk/XGRhX/PN0mOZ+dBSZ+LgunHS+6tYQAzhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.0.1.tgz", + "integrity": "sha512-3wgnrmEAJ4T+mGXAUfMvMAbxU9RDG43XmGce4j6CwPtVxB3vfwXSZ6KhFwDzZ3mZHhmPimMAXg71veiBGzeAZw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.0.tgz", + "integrity": "sha512-anK8SWmNphkXdaKgz5hJvGa7l00qmcaUQoMYsBwDlSKFKjc6gjGXPDw3FNL3Nbwq5L8gE+RCbGqTw49FK5Qyvg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.0.tgz", + "integrity": "sha512-S0ze2R9GH+fu41FA7pbSqNWObo/kzwf8rN/+IGlW/4tC6oACOs8B++bh+i9bVyNnwCcuksbFwsBme5OCKXCwIw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.0.tgz", + "integrity": "sha512-vZZio48k7ON0fVS3CUgFatWHoKbbLTK/rT7pzpJ4Bjp5JjkZeasRfrS9wsBdDJK2cJLHMckXZdzPSSr1B8a4oQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.1.tgz", + "integrity": "sha512-bmkNc7z8Wn6kgjZmVHOX3SowGmVdhYS7yBpMnuMnPzDq/6xwVA604DuOXMZTO1lvq01g+Adfa0pE2UKGlxL1XQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.0.tgz", + "integrity": "sha512-r4Sc6leeUTn3P6gk20aFMj2ntPwn6qpDZqWvYmAG6NgvFTIlj4WtrAudLi65qYoaGdXYViXYw2pkmn7QnIFasA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-events-to-acorn": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.2.tgz", + "integrity": "sha512-Fk+xmBrOv9QZnEDguL9OI9/NQQp6Hz4FuQ4YmCb/5V7+9eAh1s6AYSvL20kHkD67YIg7EpE54TiSlcsf3vyZgA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/acorn": "^4.0.0", + "@types/estree": "^1.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.0.tgz", + "integrity": "sha512-xNn4Pqkj2puRhKdKTm8t1YHC/BAjx6CEwRFXntTaRf/x16aqka6ouVoutm+QdkISTlT7e2zU7U4ZdlDLJd2Mcw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.0.tgz", + "integrity": "sha512-2xhYT0sfo85FMrUPtHcPo2rrp1lwbDEEzpx7jiH2xXJLqBuy4H0GgXk5ToU8IEwoROtXuL8ND0ttVa4rNqYK3w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.0.tgz", + "integrity": "sha512-6KU6qO7DZ7GJkaCgwBNtplXCvGkJToU86ybBAUdavvgsCiG8lSSvYxr9MhwmQ+udpzywHsl4RpGJsYWG1pDOcA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.0.tgz", + "integrity": "sha512-vc93L1t+gpR3p8jxeVdaYlbV2jTYteDje19rNSS/H5dlhxUYll5Fy6vJ2cDwP8RnsXi818yGty1ayP55y3W6fg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "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.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/muggle-string": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.3.1.tgz", + "integrity": "sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==" + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, + "node_modules/needle": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.9.1.tgz", + "integrity": "sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==", + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, + "node_modules/needle/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nlcst-to-string": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-3.1.1.tgz", + "integrity": "sha512-63mVyqaqt0cmn2VcI2aH6kxe1rLAmSROqHMA0i4qqg1tidkfExgpb0FGMikMCn86mw5dFtBtEANfmSSK7TjNHw==", + "dependencies": { + "@types/nlcst": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/node-abi": { + "version": "3.54.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz", + "integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", + "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==" + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/not": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/not/-/not-0.1.0.tgz", + "integrity": "sha512-5PDmaAsVfnWUgTUbJ3ERwn7u79Z0dYxN9ErxCpVJJqe2RK0PJ3z+iFUxuqjwtlDDegXvtWoxD/3Fzxox7tFGWA==" + }, + "node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz", + "integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==", + "dependencies": { + "chalk": "^5.3.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.9.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.3.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "string-width": "^6.1.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/string-width": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", + "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^10.2.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.0.1.tgz", + "integrity": "sha512-NXzu9aQJTAzbBqOt2hwsR63ea7yvxJc0PwN/zobNAudYfb1B7R08SzB4TsLeSbUCuG467NhnoT0oO6w1qRO+BA==", + "dependencies": { + "eventemitter3": "^5.0.1", + "p-timeout": "^6.1.2" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", + "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/pagefind": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.0.4.tgz", + "integrity": "sha512-oRIizYe+zSI2Jw4zcMU0ebDZm27751hRFiSOBLwc1OIYMrsZKk+3m8p9EVaOmc6zZdtqwwdilNUNxXvBeHcP9w==", + "bin": { + "pagefind": "lib/runner/bin.cjs" + }, + "optionalDependencies": { + "@pagefind/darwin-arm64": "1.0.4", + "@pagefind/darwin-x64": "1.0.4", + "@pagefind/linux-arm64": "1.0.4", + "@pagefind/linux-x64": "1.0.4", + "@pagefind/windows-x64": "1.0.4" + } + }, + "node_modules/parse-entities": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", + "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities": "^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.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/parse-latin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-5.0.1.tgz", + "integrity": "sha512-b/K8ExXaWC9t34kKeDV8kGXBkXZ1HCSAZRYE7HR14eA1GlXX5L8iWhs8USJNhQU9q5ci413jCKF0gOyovvyRBg==", + "dependencies": { + "nlcst-to-string": "^3.0.0", + "unist-util-modify-children": "^3.0.0", + "unist-util-visit-children": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-to-regexp": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" + }, + "node_modules/periscopic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz", + "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^3.0.0", + "is-reference": "^3.0.0" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/postcss": { + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-nested": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", + "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", + "dependencies": { + "postcss-selector-parser": "^6.0.11" + }, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.15", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", + "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuild-install/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/prebuild-install/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/prebuild-install/node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/prebuild-install/node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/preferred-pm": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-3.1.2.tgz", + "integrity": "sha512-nk7dKrcW8hfCZ4H6klWcdRknBOXWzNQByJ0oJyX97BOupsYD+FzLS4hflgEu/uPUEHZCuRfMxzCBsuWd7OzT8Q==", + "dependencies": { + "find-up": "^5.0.0", + "find-yarn-workspace-root2": "1.2.16", + "path-exists": "^4.0.0", + "which-pm": "2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/preferred-pm/node_modules/which-pm": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-2.0.0.tgz", + "integrity": "sha512-Lhs9Pmyph0p5n5Z3mVnN0yWcbQYUAD7rbQUiMsQxOJ3T57k7RFe35SUwWMf7dsbDZks1uOmw4AecB/JMDj3v/w==", + "dependencies": { + "load-yaml-file": "^0.2.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8.15" + } + }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/probe-image-size": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/probe-image-size/-/probe-image-size-7.2.3.tgz", + "integrity": "sha512-HubhG4Rb2UH8YtV4ba0Vp5bQ7L78RTONYu/ujmCu5nBI8wGv24s4E9xSKBi0N1MowRpxk76pFCpJtW0KPzOK0w==", + "dependencies": { + "lodash.merge": "^4.6.2", + "needle": "^2.5.2", + "stream-parser": "~0.3.1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/prompts/node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "engines": { + "node": ">=6" + } + }, + "node_modules/property-information": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.4.0.tgz", + "integrity": "sha512-9t5qARVofg2xQqKtytzt+lZ4d1Qvj8t5B8fEwXK6qOfgRLgH/b13QlgEyDh033NOS31nXeFbYv7CLUDG1CeifQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rehype": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.1.tgz", + "integrity": "sha512-AcSLS2mItY+0fYu9xKxOu1LhUZeBZZBx8//5HKzF+0XP+eP8+6a5MXn2+DW2kfXR6Dtp1FEXMVrjyKAcvcU8vg==", + "dependencies": { + "@types/hast": "^3.0.0", + "rehype-parse": "^9.0.0", + "rehype-stringify": "^10.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-parse": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.0.tgz", + "integrity": "sha512-WG7nfvmWWkCR++KEkZevZb/uw41E8TsH4DsY9UxsTbIXCVGbAs4S+r8FrQ+OtH5EEQAs+5UxKC42VinkmpA1Yw==", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-from-html": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-raw": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", + "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-raw": "^9.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-stringify": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.0.tgz", + "integrity": "sha512-1TX1i048LooI9QoecrXy7nGFFbFSufxVRAfc6Y9YMRAi56l+oB0zP51mLSV312uRuvVLPV1opSlJmslozR1XHQ==", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-to-html": "^9.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-directive": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-3.0.0.tgz", + "integrity": "sha512-l1UyWJ6Eg1VPU7Hm/9tt0zKtReJQNOA4+iDMAxTyZNWnJnFlbS/7zhiel/rogTLQ2vMYwDzSJa4BiVNqGlqIMA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-directive": "^3.0.0", + "micromark-extension-directive": "^3.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/remark-expressive-code/-/remark-expressive-code-0.30.2.tgz", + "integrity": "sha512-b6JnytW+CChkp2f29DtQsoFo80SKAJibvalm0SvmuReqQvN6OndPAvF7q5M9NCIYH/WB5H75G/kzSaeas+9Dyg==", + "dependencies": { + "expressive-code": "^0.30.2", + "hast-util-to-html": "^8.0.4", + "unist-util-visit": "^4.1.2" + } + }, + "node_modules/remark-expressive-code/node_modules/@types/hast": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", + "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/remark-expressive-code/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/remark-expressive-code/node_modules/hast-util-from-parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz", + "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/unist": "^2.0.0", + "hastscript": "^7.0.0", + "property-information": "^6.0.0", + "vfile": "^5.0.0", + "vfile-location": "^4.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hast-util-raw": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/parse5": "^6.0.0", + "hast-util-from-parse5": "^7.0.0", + "hast-util-to-parse5": "^7.0.0", + "html-void-elements": "^2.0.0", + "parse5": "^6.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hast-util-to-html": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz", + "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/unist": "^2.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-raw": "^7.0.0", + "hast-util-whitespace": "^2.0.0", + "html-void-elements": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hast-util-to-parse5": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hast-util-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/html-void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/remark-expressive-code/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/remark-expressive-code/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/unist-util-position": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/vfile-location": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.1.0.tgz", + "integrity": "sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==", + "dependencies": { + "@types/unist": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-expressive-code/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.0.tgz", + "integrity": "sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==", + "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-mdx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.0.0.tgz", + "integrity": "sha512-O7yfjuC6ra3NHPbRVxfflafAj3LTwx3b73aBvkEFU5z4PsD6FD4vrqJAkE5iNGLz71GdjXfgRqm3SQ0h0VuE7g==", + "dependencies": { + "mdast-util-mdx": "^3.0.0", + "micromark-extension-mdxjs": "^3.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==", + "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.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.0.tgz", + "integrity": "sha512-z3tJrAs2kIs1AqIIy6pzHmAHlF1hWQ+OdY4/hv+Wxe35EhyLKcajL33iUEn3ScxtFox9nUvRufR/Zre8Q08H/g==", + "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-smartypants": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-2.1.0.tgz", + "integrity": "sha512-qoF6Vz3BjU2tP6OfZqHOvCU0ACmu/6jhGaINSQRI9mM7wCxNQTKB3JUAN4SVoN2ybElEDTxBIABRep7e569iJw==", + "dependencies": { + "retext": "^8.1.0", + "retext-smartypants": "^5.2.0", + "unist-util-visit": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "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==", + "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/request-light": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.7.0.tgz", + "integrity": "sha512-lMbBMrDoxgsyO+yB3sDcrDuX85yYt7sS8BfQd11jtbW/z5ZWgLZRcEGLsLoYw7I0WSUGQBs8CC8ScIxkTX1+6Q==" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/retext": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/retext/-/retext-8.1.0.tgz", + "integrity": "sha512-N9/Kq7YTn6ZpzfiGW45WfEGJqFf1IM1q8OsRa1CGzIebCJBNCANDRmOrholiDRGKo/We7ofKR4SEvcGAWEMD3Q==", + "dependencies": { + "@types/nlcst": "^1.0.0", + "retext-latin": "^3.0.0", + "retext-stringify": "^3.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/retext-latin/-/retext-latin-3.1.0.tgz", + "integrity": "sha512-5MrD1tuebzO8ppsja5eEu+ZbBeUNCjoEarn70tkXOS7Bdsdf6tNahsv2bY0Z8VooFF6cw7/6S+d3yI/TMlMVVQ==", + "dependencies": { + "@types/nlcst": "^1.0.0", + "parse-latin": "^5.0.0", + "unherit": "^3.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/retext-latin/node_modules/unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dependencies": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/retext-smartypants/-/retext-smartypants-5.2.0.tgz", + "integrity": "sha512-Do8oM+SsjrbzT2UNIKgheP0hgUQTDDQYyZaIY3kfq0pdFzoPk+ZClYJ+OERNXveog4xf1pZL4PfRxNoVL7a/jw==", + "dependencies": { + "@types/nlcst": "^1.0.0", + "nlcst-to-string": "^3.0.0", + "unified": "^10.0.0", + "unist-util-visit": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/retext-smartypants/node_modules/unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dependencies": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/retext-stringify/-/retext-stringify-3.1.0.tgz", + "integrity": "sha512-767TLOaoXFXyOnjx/EggXlb37ZD2u4P1n0GJqVdpipqACsQP+20W+BNpMYrlJkq7hxffnFk+jc6mAK9qrbuB8w==", + "dependencies": { + "@types/nlcst": "^1.0.0", + "nlcst-to-string": "^3.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/retext-stringify/node_modules/unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dependencies": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/retext/node_modules/unified": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "dependencies": { + "@types/unist": "^2.0.0", + "bail": "^2.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext/node_modules/vfile": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^3.0.0", + "vfile-message": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext/node_modules/vfile-message": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.5.tgz", + "integrity": "sha512-E4vQW0H/mbNMw2yLSqJyjtkHY9dslf/p0zuT1xehNRqUTBOFMqEjguDvqhXr7N7r/4ttb2jr4T41d3dncmIgbQ==", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.9.5", + "@rollup/rollup-android-arm64": "4.9.5", + "@rollup/rollup-darwin-arm64": "4.9.5", + "@rollup/rollup-darwin-x64": "4.9.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.5", + "@rollup/rollup-linux-arm64-gnu": "4.9.5", + "@rollup/rollup-linux-arm64-musl": "4.9.5", + "@rollup/rollup-linux-riscv64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-musl": "4.9.5", + "@rollup/rollup-win32-arm64-msvc": "4.9.5", + "@rollup/rollup-win32-ia32-msvc": "4.9.5", + "@rollup/rollup-win32-x64-msvc": "4.9.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" + }, + "node_modules/section-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", + "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", + "dependencies": { + "extend-shallow": "^2.0.1", + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/server-destroy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz", + "integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==" + }, + "node_modules/sharp": { + "version": "0.32.6", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz", + "integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==", + "hasInstallScript": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.2", + "node-addon-api": "^6.1.0", + "prebuild-install": "^7.1.1", + "semver": "^7.5.4", + "simple-get": "^4.0.1", + "tar-fs": "^3.0.4", + "tunnel-agent": "^0.6.0" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/shikiji": { + "version": "0.6.13", + "resolved": "https://registry.npmjs.org/shikiji/-/shikiji-0.6.13.tgz", + "integrity": "sha512-4T7X39csvhT0p7GDnq9vysWddf2b6BeioiN3Ymhnt3xcy9tXmDcnsEFVxX18Z4YcQgEE/w48dLJ4pPPUcG9KkA==", + "dependencies": { + "hast-util-to-html": "^9.0.0" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" + }, + "node_modules/sitemap": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-7.1.1.tgz", + "integrity": "sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==", + "dependencies": { + "@types/node": "^17.0.5", + "@types/sax": "^1.2.1", + "arg": "^5.0.0", + "sax": "^1.2.4" + }, + "bin": { + "sitemap": "dist/cli.js" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=5.6.0" + } + }, + "node_modules/sitemap/node_modules/@types/node": { + "version": "17.0.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" + }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dependencies": { + "bl": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stream-parser": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", + "integrity": "sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==", + "dependencies": { + "debug": "2" + } + }, + "node_modules/stream-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/stream-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/streamx": { + "version": "2.15.6", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", + "integrity": "sha512-q+vQL4AAz+FdfT137VF69Cc/APqUbxy+MDOImRrMvchJpigHj9GksgDU2LYbO9rx7RX6osWgxJB2WxhYv4SZAw==", + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.0.0.tgz", + "integrity": "sha512-GPQHj7row82Hjo9hKZieKcHIhaAIKOJvFSIZXuCU9OASVZrMNUaZuz++SPVrBjnLsnk4k+z9f2EIypgxf2vNFw==", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", + "integrity": "sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-bom-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", + "integrity": "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/style-to-object": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.4.tgz", + "integrity": "sha512-HYNoHZa2GorYNyqiCaBgsxvcJIn7OHq6inEga+E6Ke3m5JkoqpQbnFssk4jwe+K7AhGa2fcha4wSOf1Kn01dMg==", + "dependencies": { + "inline-style-parser": "0.1.1" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "dependencies": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "node_modules/tar-stream": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", + "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz", + "integrity": "sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/tsconfck": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.0.1.tgz", + "integrity": "sha512-7ppiBlF3UEddCLeI1JRx5m2Ryq+xk4JrZuq4EuYXykipebaq1dV0Fhgr1hb7CkmHt32QSgOZlcqVLEtHBG4/mg==", + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typesafe-path": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/typesafe-path/-/typesafe-path-0.2.2.tgz", + "integrity": "sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA==" + }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-auto-import-cache": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/typescript-auto-import-cache/-/typescript-auto-import-cache-0.3.2.tgz", + "integrity": "sha512-+laqe5SFL1vN62FPOOJSUDTZxtgsoOXjneYOXIpx5rQ4UMiN89NAtJLpqLqyebv9fgQ/IMeeTX+mQyRnwvJzvg==", + "dependencies": { + "semver": "^7.3.8" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/unherit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-3.0.1.tgz", + "integrity": "sha512-akOOQ/Yln8a2sgcLj4U0Jmx0R5jpIg2IUyRrWOzmEbjBtGzBdHtSeFKgoEcoH4KYIG/Pb8GQ/BwtYm0GCq1Sqg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.4.tgz", + "integrity": "sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ==", + "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.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-modify-children": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-3.1.1.tgz", + "integrity": "sha512-yXi4Lm+TG5VG+qvokP6tpnk+r1EPwyYL04JWDxLvgvPV40jANh7nm3udk65OOWquvbMDe+PL9+LmkxDpTv/7BA==", + "dependencies": { + "@types/unist": "^2.0.0", + "array-iterate": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-modify-children/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "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==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz", + "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-remove/-/unist-util-remove-4.0.0.tgz", + "integrity": "sha512-b4gokeGId57UVRX/eVKej5gXqGlc9+trkORhFJpu9raqZkZhU0zm8Doi05+HaiBsMEIJowL+2WtQ5ItjsngPXg==", + "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-remove-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz", + "integrity": "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.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==", + "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==", + "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-children": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-2.0.2.tgz", + "integrity": "sha512-+LWpMFqyUwLGpsQxpumsQ9o9DG2VGLFrpz+rpVXYIEdPy57GSy5HioC0g3bg/8WP9oCLlapQtklOzQ8uLS496Q==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-children/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/vfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.1.tgz", + "integrity": "sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-location": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.2.tgz", + "integrity": "sha512-NXPYyxyBSH7zB5U6+3uDdd6Nybz6o6/od9rk8bp9H8GR3L+cm/fC0uUTbqBmUTnMCUDslAGBOIKNfvvb+gGlDg==", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "5.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz", + "integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==", + "dependencies": { + "esbuild": "^0.19.3", + "postcss": "^8.4.32", + "rollup": "^4.2.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", + "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/volar-service-css": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-css/-/volar-service-css-0.0.17.tgz", + "integrity": "sha512-bEDJykygMzn2+a9ud6KwZZLli9eqarxApAXZuf2CqJJh6Trw1elmbBCo9SlPfqMrIhpFnwV0Sa+Xoc9x5WPeGw==", + "dependencies": { + "vscode-css-languageservice": "^6.2.10", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "@volar/language-service": "~1.11.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, + "node_modules/volar-service-emmet": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-emmet/-/volar-service-emmet-0.0.17.tgz", + "integrity": "sha512-C6hVnuQL52MqaydkrblYUbzIo5ZmIGo1hR8wmpcCjs5uNcjqn8aPqZRfznhLiUSaPHpFC+zQxJwFcZI9/u2iKQ==", + "dependencies": { + "@vscode/emmet-helper": "^2.9.2", + "volar-service-html": "0.0.17" + }, + "peerDependencies": { + "@volar/language-service": "~1.11.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, + "node_modules/volar-service-html": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-html/-/volar-service-html-0.0.17.tgz", + "integrity": "sha512-OGkP+ZTo13j/+enafGe+esXvda/W4eU78YNLbbHxtV3rnX4odVrewenLJmXiECg6wdQz/PG8rLijZqQnDUYkfw==", + "dependencies": { + "vscode-html-languageservice": "^5.1.0", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "@volar/language-service": "~1.11.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, + "node_modules/volar-service-prettier": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-prettier/-/volar-service-prettier-0.0.17.tgz", + "integrity": "sha512-YYnzZ+OT0M3Bx+xKuoAfs/uVuxk7ofz4dkZDQqjwa9iC63Ay4YGqONtmHd+xsO3lufkEBXlAQCbofDeZbSz3YQ==", + "peerDependencies": { + "@volar/language-service": "~1.11.0", + "prettier": "^2.2 || ^3.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + }, + "prettier": { + "optional": true + } + } + }, + "node_modules/volar-service-typescript": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-typescript/-/volar-service-typescript-0.0.17.tgz", + "integrity": "sha512-Krs8pOIo2yoBVoJ91hKT1czhWt9ek7EbuK3MxxgvDYdd4HYHOtHi1eOlb7bFnZMNgFcwsL48yQI9vbPm160s9A==", + "dependencies": { + "path-browserify": "^1.0.1", + "semver": "^7.5.4", + "typescript-auto-import-cache": "^0.3.0", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-nls": "^5.2.0", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "@volar/language-service": "~1.11.0", + "@volar/typescript": "~1.11.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, + "node_modules/volar-service-typescript-twoslash-queries": { + "version": "0.0.17", + "resolved": "https://registry.npmjs.org/volar-service-typescript-twoslash-queries/-/volar-service-typescript-twoslash-queries-0.0.17.tgz", + "integrity": "sha512-6FHXK5AWeFzCL6uGmEcbkZmQsaQ0m9IjbeLdgOIQ4KGvauqT2aA1BhdfDJu6vRAFIfXe7xjEJ85keIlHl72tSA==", + "peerDependencies": { + "@volar/language-service": "~1.11.0" + }, + "peerDependenciesMeta": { + "@volar/language-service": { + "optional": true + } + } + }, + "node_modules/vscode-css-languageservice": { + "version": "6.2.11", + "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-6.2.11.tgz", + "integrity": "sha512-qn49Wa6K94LnizpVxmlYrcPf1Cb36gq1nNueW0COhi4shylXBzET5wuDbH8ZWQlJD0HM5Mmnn7WE9vQVVs+ULA==", + "dependencies": { + "@vscode/l10n": "^0.0.16", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-languageserver-types": "3.17.5", + "vscode-uri": "^3.0.8" + } + }, + "node_modules/vscode-html-languageservice": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-5.1.1.tgz", + "integrity": "sha512-JenrspIIG/Q+93R6G3L6HdK96itSisMynE0glURqHpQbL3dKAKzdm8L40lAHNkwJeBg+BBPpAshZKv/38onrTQ==", + "dependencies": { + "@vscode/l10n": "^0.0.16", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-languageserver-types": "^3.17.5", + "vscode-uri": "^3.0.8" + } + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz", + "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==", + "dependencies": { + "vscode-languageserver-protocol": "3.17.5" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", + "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "node_modules/vscode-nls": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.2.0.tgz", + "integrity": "sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==" + }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, + "node_modules/web-namespaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", + "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-pm": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-2.1.1.tgz", + "integrity": "sha512-xzzxNw2wMaoCWXiGE8IJ9wuPMU+EYhFksjHxrRT8kMT5SnocBPRg69YAMtyV4D12fP582RA+k3P8H9J5EMdIxQ==", + "dependencies": { + "load-yaml-file": "^0.2.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8.15" + } + }, + "node_modules/which-pm-runs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz", + "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/widest-line": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", + "integrity": "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==", + "dependencies": { + "string-width": "^5.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/widest-line/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "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==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/website/package.json b/website/package.json new file mode 100644 index 00000000..d3cd77d7 --- /dev/null +++ b/website/package.json @@ -0,0 +1,19 @@ +{ + "name": "website", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro check && astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/check": "^0.4.1", + "@astrojs/starlight": "^0.15.3", + "astro": "^4.0.1", + "sharp": "^0.32.5", + "typescript": "^5.3.3" + } +} \ No newline at end of file diff --git a/website/public/favicon.svg b/website/public/favicon.svg new file mode 100644 index 00000000..cba5ac14 --- /dev/null +++ b/website/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/website/src/assets/houston.webp b/website/src/assets/houston.webp new file mode 100644 index 00000000..930c1649 Binary files /dev/null and b/website/src/assets/houston.webp differ diff --git a/website/src/content/config.ts b/website/src/content/config.ts new file mode 100644 index 00000000..9df91b60 --- /dev/null +++ b/website/src/content/config.ts @@ -0,0 +1,7 @@ +import { defineCollection } from 'astro:content'; +import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'; + +export const collections = { + docs: defineCollection({ schema: docsSchema() }), + i18n: defineCollection({ type: 'data', schema: i18nSchema() }), +}; diff --git a/website/src/content/docs/book/about-the-author.md b/website/src/content/docs/book/about-the-author.md new file mode 100644 index 00000000..5d04c0cf --- /dev/null +++ b/website/src/content/docs/book/about-the-author.md @@ -0,0 +1,17 @@ +--- +title: About the Author +sidebar: + order: 6 + label: 6. About the Author +--- + + +Simone Poggiali is an experienced Senior Front-end Developer with a passion for writing professional-grade code since the 90s. Throughout his international career, he has contributed to numerous projects for a wide range of clients, from startups to large organizations. Notable companies such as HelloFresh, Siemens, O2, and Leroy Merlin have benefited from his expertise and dedication. + +You can reach Simone Poggiali on the following platforms: + +* LinkedIn: +* GitHub: +* Twitter: +* Email: gibbok.coding📧gmail.com + diff --git a/website/src/content/docs/book/any-type.md b/website/src/content/docs/book/any-type.md new file mode 100644 index 00000000..20c2d5f2 --- /dev/null +++ b/website/src/content/docs/book/any-type.md @@ -0,0 +1,22 @@ +--- +title: Any type +sidebar: + order: 44 + label: 44. Any type +--- + + +The `any` type is a special type (universal supertype) that can be used to represent any type of value (primitives, objects, arrays, functions, errors, symbols). It is often used in situations where the type of a value is not known at compile time, or when working with values from external APIs or libraries that do not have TypeScript typings. + +By utilizing `any` type, you are indicating to the TypeScript compiler that values should be represented without any limitations. In order to maximizing type safety in your code consider the following: + +* Limit the usage of `any` to specific cases where the type is truly unknown. +* Do not return `any` types from a function as you will lose type safety in the code using that function weakening your type safety. +* Instead of `any` use `@ts-ignore` if you need to silence the compiler. + +```typescript +let value: any; +value = true; // Valid +value = 7; // Valid +``` + diff --git a/website/src/content/docs/book/assignments.md b/website/src/content/docs/book/assignments.md new file mode 100644 index 00000000..c0bdd1b8 --- /dev/null +++ b/website/src/content/docs/book/assignments.md @@ -0,0 +1,22 @@ +--- +title: Assignments +sidebar: + order: 21 + label: 21. Assignments +--- + + +TypeScript narrowing using assignments is a way to narrow the type of a variable based on the value assigned to it. When a variable is assigned a value, TypeScript infers its type based on the assigned value, and it narrows the type of the variable to match the inferred type. + +```typescript +let value: string | number; +value = 'hello'; +if (typeof value === 'string') { + console.log(value.toUpperCase()); +} +value = 42; +if (typeof value === 'number') { + console.log(value.toFixed(2)); +} +``` + diff --git a/website/src/content/docs/book/built-in-type-primitives.md b/website/src/content/docs/book/built-in-type-primitives.md new file mode 100644 index 00000000..3a61b0e8 --- /dev/null +++ b/website/src/content/docs/book/built-in-type-primitives.md @@ -0,0 +1,21 @@ +--- +title: Built-in Type Primitives +sidebar: + order: 49 + label: 49. Built-in Type Primitives +--- + + +TypeScript has several built-in type primitives that can be used to define variables, function parameters, and return types: + +* `number`: Represents numeric values, including integers and floating-point numbers. +* `string`: Represents textual data +* `boolean`: Represents logical values, which can be either true or false. +* `null`: Represents the absence of a value. +* `undefined`: Represents a value that has not been assigned or has not been defined. +* `symbol`: Represents a unique identifier. Symbols are typically used as keys for object properties. +* `bigint`: Represents arbitrary-precision integers. +* `any`: Represents a dynamic or unknown type. Variables of type any can hold values of any type, and they bypass type checking. +* `void`: Represents the absence of any type. It is commonly used as the return type of functions that do not return a value. +* `never`: Represents a type for values that never occur. It is typically used as the return type of functions that throw an error or enter an infinite loop. + diff --git a/website/src/content/docs/book/class.md b/website/src/content/docs/book/class.md new file mode 100644 index 00000000..3e7a6ceb --- /dev/null +++ b/website/src/content/docs/book/class.md @@ -0,0 +1,679 @@ +--- +title: Class +sidebar: + order: 54 + label: 54. Class +--- + + +### Class Common Syntax + +The `class` keyword is used in TypeScript to define a class. Below, you can see an example: + +```typescript +class Person { + private name: string; + private age: number; + constructor(name: string, age: number) { + this.name = name; + this.age = age; + } + public sayHi(): void { + console.log( + `Hello, my name is ${this.name} and I am ${this.age} years old.` + ); + } +} +``` + +The `class` keyword is used to define a class named "Person". + +The class has two private properties: name of type `string` and age of type `number`. + +The constructor is defined using the `constructor` keyword. It takes name and age as parameters and assigns them to the corresponding properties. + +The class has a `public` method named sayHi that logs a greeting message. + +To create an instance of a class in TypeScript, you can use the `new` keyword followed by the class name, followed by parentheses `()`. For instance: + + +```typescript +const myObject = new Person('John Doe', 25); +myObject.sayHi(); // Output: Hello, my name is John Doe and I am 25 years old. +``` + +### Constructor + +Constructors are special methods within a class that are used to initialize the object's properties when an instance of the class is created. + +```typescript +class Person { + public name: string; + public age: number; + + constructor(name: string, age: number) { + this.name = name; + this.age = age; + } + + sayHello() { + console.log( + `Hello, my name is ${this.name} and I'm ${this.age} years old.` + ); + } +} + +const john = new Person('Simon', 17); +john.sayHello(); +``` + +It is possible to overload a constructor using the following syntax: + +```typescript +type Sex = 'm' | 'f'; + +class Person { + name: string; + age: number; + sex: Sex; + + constructor(name: string, age: number, sex?: Sex); + constructor(name: string, age: number, sex: Sex) { + this.name = name; + this.age = age; + this.sex = sex ?? 'm'; + } +} + +const p1 = new Person('Simon', 17); +const p2 = new Person('Alice', 22, 'f'); +``` + +In TypeScript, it is possible to define multiple constructor overloads, but you can have only one implementation that must be compatible with all the overloads, this can be achieved by using an optional parameter. + +```typescript +class Person { + name: string; + age: number; + + constructor(); + constructor(name: string); + constructor(name: string, age: number); + constructor(name?: string, age?: number) { + this.name = name ?? 'Unknown'; + this.age = age ?? 0; + } + + displayInfo() { + console.log(`Name: ${this.name}, Age: ${this.age}`); + } +} + +const person1 = new Person(); +person1.displayInfo(); // Name: Unknown, Age: 0 + +const person2 = new Person('John'); +person2.displayInfo(); // Name: John, Age: 0 + +const person3 = new Person('Jane', 25); +person3.displayInfo(); // Name: Jane, Age: 25 +``` + +### Private and Protected Constructors + +In TypeScript, constructors can be marked as private or protected, which restricts their accessibility and usage. + +Private Constructors: +Can be called only within the class itself. Private constructors are often used in scenarios where you want to enforce a singleton pattern or restrict the creation of instances to a factory method within the class + +Protected Constructors: +Protected constructors are useful when you want to create a base class that should not be instantiated directly but can be extended by subclasses. + +```typescript +class BaseClass { + protected constructor() {} +} + +class DerivedClass extends BaseClass { + private value: number; + + constructor(value: number) { + super(); + this.value = value; + } +} + +// Attempting to instantiate the base class directly will result in an error +// const baseObj = new BaseClass(); // Error: Constructor of class 'BaseClass' is protected. + +// Create an instance of the derived class +const derivedObj = new DerivedClass(10); +``` + +### Access Modifiers + +Access Modifiers `private`, `protected`, and `public` are used to control the visibility and accessibility of class members, such as properties and methods, in TypeScript classes. These modifiers are essential for enforcing encapsulation and establishing boundaries for accessing and modifying the internal state of a class. + +The `private` modifier restricts access to the class member only within the containing class. + +The `protected` modifier allows access to the class member within the containing class and its derived classes. + +The `public` modifier provides unrestricted access to the class member, allowing it to be accessed from anywhere." + +### Get & Set + +Getters and setters are special methods that allow you to define custom access and modification behavior for class properties. They enable you to encapsulate the internal state of an object and provide additional logic when getting or setting the values of properties. +In TypeScript, getters and setters are defined using the `get` and `set` keywords respectively. Here's an example: + +```typescript +class MyClass { + private _myProperty: string; + + constructor(value: string) { + this._myProperty = value; + } + get myProperty(): string { + return this._myProperty; + } + set myProperty(value: string) { + this._myProperty = value; + } +} +``` + +### Auto-Accessors in Classes + +TypeScript version 4.9 adds support for auto-accessors, a forthcoming ECMAScript feature. They resemble class properties but are declared with the "accessor" keyword. + +```typescript +class Animal { + accessor name: string; + + constructor(name: string) { + this.name = name; + } +} +``` + +Auto-accessors are "de-sugared" into private `get` and `set` accessors, operating on an inaccessible property. + + +```typescript +class Animal { + #__name: string; + + get name() { + return this.#__name; + } + set name(value: string) { + this.#__name = name; + } + + constructor(name: string) { + this.name = name; + } +} +``` + +### this + +In TypeScript, the `this` keyword refers to the current instance of a class within its methods or constructors. It allows you to access and modify the properties and methods of the class from within its own scope. +It provides a way to access and manipulate the internal state of an object within its own methods. + +```typescript +class Person { + private name: string; + constructor(name: string) { + this.name = name; + } + public introduce(): void { + console.log(`Hello, my name is ${this.name}.`); + } +} + +const person1 = new Person('Alice'); +person1.introduce(); // Hello, my name is Alice. +``` + +### Parameter Properties + +Parameter properties allow you to declare and initialize class properties directly within the constructor parameters avoiding boilerplate code, example: + +```typescript +class Person { + constructor( + private name: string, + public age: number + ) { + // The "private" and "public" keywords in the constructor + // automatically declare and initialize the corresponding class properties. + } + public introduce(): void { + console.log( + `Hello, my name is ${this.name} and I am ${this.age} years old.` + ); + } +} +const person = new Person('Alice', 25); +person.introduce(); +``` + +### Abstract Classes + +Abstract Classes are used in TypeScript mainly for inheritance, they provide a way to define common properties and methods that can be inherited by subclasses. +This is useful when you want to define common behavior and enforce that subclasses implement certain methods. They provide a way to create a hierarchy of classes where the abstract base class provides a shared interface and common functionality for the subclasses. + +```typescript +abstract class Animal { + protected name: string; + + constructor(name: string) { + this.name = name; + } + + abstract makeSound(): void; +} + +class Cat extends Animal { + makeSound(): void { + console.log(`${this.name} meows.`); + } +} + +const cat = new Cat('Whiskers'); +cat.makeSound(); // Output: Whiskers meows. +``` + +### With Generics + +Classes with generics allow you to define reusable classes which can work with different types. + +```typescript +class Container { + private item: T; + + constructor(item: T) { + this.item = item; + } + + getItem(): T { + return this.item; + } + + setItem(item: T): void { + this.item = item; + } +} + +const container1 = new Container(42); +console.log(container1.getItem()); // 42 + +const container2 = new Container('Hello'); +container2.setItem('World'); +console.log(container2.getItem()); // World +``` + +### Decorators + +Decorators provide a mechanism to add metadata, modify behavior, validate, or extend the functionality of the target element. They are functions that execute at runtime. Multiple decorators can be applied to a declaration. + +Decorators are experimental features, and the following examples are only compatible with TypeScript version 5 or above using ES6. + +For TypeScript versions prior to 5, they should be enabled using the `experimentalDecorators` property in your `tsconfig.json` or by using `--experimentalDecorators` in your command line (but the following example won't work). + +Some of the common use cases for decorators include: + +* Watching property changes. +* Watching method calls. +* Adding extra properties or methods. +* Runtime validation. +* Automatic serialization and deserialization. +* Logging. +* Authorization and authentication. +* Error guarding. + +Note: Decorators for version 5 do not allow decorating parameters. + +Types of decorators: + +#### Class Decorators + +Class Decorators are useful for extending an existing class, such as adding properties or methods, or collecting instances of a class. In the following example, we add a `toString` method that converts the class into a string representation. + +```typescript +type Constructor = new (...args: any[]) => T; + +function toString( + Value: Class, + context: ClassDecoratorContext +) { + return class extends Value { + constructor(...args: any[]) { + super(...args); + console.log(JSON.stringify(this)); + console.log(JSON.stringify(context)); + } + }; +} + +@toString +class Person { + name: string; + + constructor(name: string) { + this.name = name; + } + + greet() { + return 'Hello, ' + this.name; + } +} +const person = new Person('Simon'); +/* Logs: +{"name":"Simon"} +{"kind":"class","name":"Person"} +*/ +``` + +#### Property Decorator + +Property decorators are useful for modifying the behavior of a property, such as changing the initialization values. In the following code, we have a script that sets a property to always be in uppercase: + +```typescript +function upperCase( + target: undefined, + context: ClassFieldDecoratorContext +) { + return function (this: T, value: string) { + return value.toUpperCase(); + }; +} + +class MyClass { + @upperCase + prop1 = 'hello!'; +} + +console.log(new MyClass().prop1); // Logs: HELLO! +``` + +#### Method Decorator + +Method decorators allow you to change or enhance the behavior of methods. Below is an example of a simple logger: + +```typescript +function log( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext< + This, + (this: This, ...args: Args) => Return + > +) { + const methodName = String(context.name); + + function replacementMethod(this: This, ...args: Args): Return { + console.log(`LOG: Entering method '${methodName}'.`); + const result = target.call(this, ...args); + console.log(`LOG: Exiting method '${methodName}'.`); + return result; + } + + return replacementMethod; +} + +class MyClass { + @log + sayHello() { + console.log('Hello!'); + } +} + +new MyClass().sayHello(); +``` + +It logs: + +```shell +LOG: Entering method 'sayHello'. +Hello! +LOG: Exiting method 'sayHello'. +``` + +#### Getter and Setter Decorators + +Getter and setter decorators allow you to change or enhance the behavior of class accessors. They are useful, for instance, for validating property assignments. Here's a simple example for a getter decorator: + +```typescript +function range(min: number, max: number) { + return function ( + target: (this: This) => Return, + context: ClassGetterDecoratorContext + ) { + return function (this: This): Return { + const value = target.call(this); + if (value < min || value > max) { + throw 'Invalid'; + } + Object.defineProperty(this, context.name, { + value, + enumerable: true, + }); + return value; + }; + }; +} + +class MyClass { + private _value = 0; + + constructor(value: number) { + this._value = value; + } + @range(1, 100) + get getValue(): number { + return this._value; + } +} + +const obj = new MyClass(10); +console.log(obj.getValue); // Valid: 10 + +const obj2 = new MyClass(999); +console.log(obj2.getValue); // Throw: Invalid! +``` + +#### Decorator Metadata + +Decorator Metadata simplifies the process for decorators to apply and utilize metadata in any class. They can access a new metadata property on the context object, which can serve as a key for both primitives and objects. +Metadata information can be accessed on the class via `Symbol.metadata`. + +Metadata can be used for various purposes, such as debugging, serialization, or dependency injection with decorators. + +```typescript +//@ts-ignore +Symbol.metadata ??= Symbol('Symbol.metadata'); // Simple polify + +type Context = + | ClassFieldDecoratorContext + | ClassAccessorDecoratorContext + | ClassMethodDecoratorContext; // Context contains property metadata: DecoratorMetadata + +function setMetadata(_target: any, context: Context) { + // Set the metadata object with a primitive value + context.metadata[context.name] = true; +} + +class MyClass { + @setMetadata + a = 123; + + @setMetadata + accessor b = 'b'; + + @setMetadata + fn() {} +} + +const metadata = MyClass[Symbol.metadata]; // Get metadata information + +console.log(JSON.stringify(metadata)); // {"bar":true,"baz":true,"foo":true} +``` + +### Inheritance + +Inheritance refers to the mechanism by which a class can inherit properties and methods from another class, known as the base class or superclass. The derived class, also called the child class or subclass, can extend and specialize the functionality of the base class by adding new properties and methods or overriding existing ones. + +```typescript +class Animal { + name: string; + + constructor(name: string) { + this.name = name; + } + + speak(): void { + console.log('The animal makes a sound'); + } +} + +class Dog extends Animal { + breed: string; + + constructor(name: string, breed: string) { + super(name); + this.breed = breed; + } + + speak(): void { + console.log('Woof! Woof!'); + } +} + +// Create an instance of the base class +const animal = new Animal('Generic Animal'); +animal.speak(); // The animal makes a sound + +// Create an instance of the derived class +const dog = new Dog('Max', 'Labrador'); +dog.speak(); // Woof! Woof!" +``` + +TypeScript does not support multiple inheritance in the traditional sense and instead allows inheritance from a single base class. +TypeScript supports multiple interfaces. An interface can define a contract for the structure of an object, and a class can implement multiple interfaces. This allows a class to inherit behavior and structure from multiple sources. + +```typescript +interface Flyable { + fly(): void; +} + +interface Swimmable { + swim(): void; +} + +class FlyingFish implements Flyable, Swimmable { + fly() { + console.log('Flying...'); + } + + swim() { + console.log('Swimming...'); + } +} + +const flyingFish = new FlyingFish(); +flyingFish.fly(); +flyingFish.swim(); +``` + +The `class` keyword in TypeScript, similar to JavaScript, is often referred to as syntactic sugar. It was introduced in ECMAScript 2015 (ES6) to offer a more familiar syntax for creating and working with objects in a class-based manner. However, it's important to note that TypeScript, being a superset of JavaScript, ultimately compiles down to JavaScript, which remains prototype-based at its core. + +### Statics + +TypeScript has static members. To access the static members of a class, you can use the class name followed by a dot, without the need to create an object. + +```typescript +class OfficeWorker { + static memberCount: number = 0; + + constructor(private name: string) { + OfficeWorker.memberCount++; + } +} + +const w1 = new OfficeWorker('James'); +const w2 = new OfficeWorker('Simon'); +const total = OfficeWorker.memberCount; +console.log(total); // 2 +``` + +### Property initialization + +There are several ways how you can initialize properties for a class in TypeScript: + +Inline: + +In the following example these initial values will be used when an instance of the class is created. + +```typescript +class MyClass { + property1: string = 'default value'; + property2: number = 42; +} +``` + +In the constructor: + +```typescript +class MyClass { + property1: string; + property2: number; + + constructor() { + this.property1 = 'default value'; + this.property2 = 42; + } +} +``` + +Using constructor parameters: + +```typescript +class MyClass { + constructor( + private property1: string = 'default value', + public property2: number = 42 + ) { + // There is no need to assign the values to the properties explicitly. + } + log() { + console.log(this.property2); + } +} +const x = new MyClass(); +x.log(); +``` + +### Method overloading + +Method overloading allows a class to have multiple methods with the same name but different parameter types or a different number of parameters. This allows us to call a method in different ways based on the arguments passed. + +```typescript +class MyClass { + add(a: number, b: number): number; // Overload signature 1 + add(a: string, b: string): string; // Overload signature 2 + + add(a: number | string, b: number | string): number | string { + if (typeof a === 'number' && typeof b === 'number') { + return a + b; + } + if (typeof a === 'string' && typeof b === 'string') { + return a.concat(b); + } + throw new Error('Invalid arguments'); + } +} + +const r = new MyClass(); +console.log(r.add(10, 5)); // Logs 15 +``` + diff --git a/website/src/content/docs/book/common-built-in-js-objects.md b/website/src/content/docs/book/common-built-in-js-objects.md new file mode 100644 index 00000000..7ff017d0 --- /dev/null +++ b/website/src/content/docs/book/common-built-in-js-objects.md @@ -0,0 +1,29 @@ +--- +title: Common Built-in JS Objects +sidebar: + order: 50 + label: 50. Common Built-in JS Objects +--- + + +TypeScript is a superset of JavaScript, it includes all the commonly used built-in JavaScript objects. You can find an extensive list of these objects on the Mozilla Developer Network (MDN) documentation website: + + +Here is a list of some commonly used built-in JavaScript objects: + +* Function +* Object +* Boolean +* Error +* Number +* BigInt +* Math +* Date +* String +* RegExp +* Array +* Map +* Set +* Promise +* Intl + diff --git a/website/src/content/docs/book/conditional-types.md b/website/src/content/docs/book/conditional-types.md new file mode 100644 index 00000000..88fe9ea1 --- /dev/null +++ b/website/src/content/docs/book/conditional-types.md @@ -0,0 +1,20 @@ +--- +title: Conditional Types +sidebar: + order: 39 + label: 39. Conditional Types +--- + + +Conditional Types are a way to create a type that depends on a condition, where the type to be created is determined based on the result of the condition. They are defined using the `extends` keyword and a ternary operator to conditionally choose between two types. + +```typescript +type IsArray = T extends any[] ? true : false; + +const myArray = [1, 2, 3]; +const myNumber = 42; + +type IsMyArrayAnArray = IsArray; // Type true +type IsMyNumberAnArray = IsArray; // Type false +``` + diff --git a/website/src/content/docs/book/control-flow-analysis.md b/website/src/content/docs/book/control-flow-analysis.md new file mode 100644 index 00000000..2f39a693 --- /dev/null +++ b/website/src/content/docs/book/control-flow-analysis.md @@ -0,0 +1,58 @@ +--- +title: Control Flow Analysis +sidebar: + order: 22 + label: 22. Control Flow Analysis +--- + + +Control Flow Analysis in TypeScript is a way to statically analyze the code flow to infer the types of variables, allowing the compiler to narrow the types of those variables as needed, based on the results of the analysis. + +Prior to TypeScript 4.4, code flow analysis would only be applied to code within an if statement, but from TypeScript 4.4, it can also be applied to conditional expressions and discriminant property accesses indirectly referenced through const variables. + +For example: + +```typescript +const f1 = (x: unknown) => { + const isString = typeof x === 'string'; + if (isString) { + x.length; + } +}; + +const f2 = ( + obj: { kind: 'foo'; foo: string } | { kind: 'bar'; bar: number } +) => { + const isFoo = obj.kind === 'foo'; + if (isFoo) { + obj.foo; + } else { + obj.bar; + } +}; +``` + +Some examples where narrowing does not occur: + + +```typescript +const f1 = (x: unknown) => { + let isString = typeof x === 'string'; + if (isString) { + x.length; // Error, no narrowing because isString it is not const + } +}; + +const f6 = ( + obj: { kind: 'foo'; foo: string } | { kind: 'bar'; bar: number } +) => { + const isFoo = obj.kind === 'foo'; + obj = obj; + if (isFoo) { + obj.foo; // Error, no narrowing because obj is assigned in function body + } +}; +``` + +Notes: Up to five levels of indirection are analyzed in conditional expressions. + diff --git a/website/src/content/docs/book/differences-between-type-and-interface.md b/website/src/content/docs/book/differences-between-type-and-interface.md new file mode 100644 index 00000000..17096b2f --- /dev/null +++ b/website/src/content/docs/book/differences-between-type-and-interface.md @@ -0,0 +1,96 @@ +--- +title: Differences between Type and Interface +sidebar: + order: 53 + label: 53. Differences between Type and Interface +--- + + +Declaration merging (augmentation): + +Interfaces support declaration merging, which means that you can define multiple interfaces with the same name, and TypeScript will merge them into a single interface with the combined properties and methods. On the other hand, types do not support declaration merging. This can be helpful when you want to add extra functionality or customize existing types without modifying the original definitions or patching missing or incorrect types. + +```typescript +interface A { + x: string; +} +interface A { + y: string; +} +const j: A = { + x: 'xx', + y: 'yy', +}; +``` + +Extending other types/interfaces: + +Both types and interfaces can extend other types/interfaces, but the syntax is different. With interfaces, you use the `extends` keyword to inherit properties and methods from other interfaces. However, an interface cannot extend a complex type like a union type. + +```typescript +interface A { + x: string; + y: number; +} +interface B extends A { + z: string; +} +const car: B = { + x: 'x', + y: 123, + z: 'z', +}; +``` + +For types, you use the & operator to combine multiple types into a single type (intersection). + +```typescript +interface A { + x: string; + y: number; +} + +type B = A & { + j: string; +}; + +const c: B = { + x: 'x', + y: 123, + j: 'j', +}; +``` + +Union and Intersection Types: + +Types are more flexible when it comes to defining Union and Intersection Types. With the `type` keyword, you can easily create union types using the `|` operator and intersection types using the `&` operator. While interfaces can also represent union types indirectly, they don't have built-in support for intersection types. + +```typescript +type Department = 'dep-x' | 'dep-y'; // Union + +type Person = { + name: string; + age: number; +}; + +type Employee = { + id: number; + department: Department; +}; + +type EmployeeInfo = Person & Employee; // Intersection +``` + +Example with interfaces: + +```typescript +interface A { + x: 'x'; +} +interface B { + y: 'y'; +} + +type C = A | B; // Union of interfaces +``` + diff --git a/website/src/content/docs/book/discriminated-unions.md b/website/src/content/docs/book/discriminated-unions.md new file mode 100644 index 00000000..1fbcae10 --- /dev/null +++ b/website/src/content/docs/book/discriminated-unions.md @@ -0,0 +1,39 @@ +--- +title: Discriminated Unions +sidebar: + order: 24 + label: 24. Discriminated Unions +--- + + +Discriminated Unions in TypeScript are a type of union type that uses a common property, known as the discriminant, to narrow down the set of possible types for the union. + +```typescript +type Square = { + kind: 'square'; // Discriminant + size: number; +}; + +type Circle = { + kind: 'circle'; // Discriminant + radius: number; +}; + +type Shape = Square | Circle; + +const area = (shape: Shape) => { + switch (shape.kind) { + case 'square': + return Math.pow(shape.size, 2); + case 'circle': + return Math.PI * Math.pow(shape.radius, 2); + } +}; + +const square: Square = { kind: 'square', size: 5 }; +const circle: Circle = { kind: 'circle', radius: 2 }; + +console.log(area(square)); // 25 +console.log(area(circle)); // 12.566370614359172 +``` + diff --git a/website/src/content/docs/book/distributive-conditional-types.md b/website/src/content/docs/book/distributive-conditional-types.md new file mode 100644 index 00000000..e1a2c9a9 --- /dev/null +++ b/website/src/content/docs/book/distributive-conditional-types.md @@ -0,0 +1,17 @@ +--- +title: Distributive Conditional Types +sidebar: + order: 40 + label: 40. Distributive Conditional Types +--- + + +Distributive Conditional Types are a feature that allow a type to be distributed over a union of types, by applying a transformation to each member of the union individually. +This can be especially useful when working with mapped types or higher-order types. + +```typescript +type Nullable = T extends any ? T | null : never; +type NumberOrBool = number | boolean; +type NullableNumberOrBool = Nullable; // number | boolean | null +``` + diff --git a/website/src/content/docs/book/downloads.md b/website/src/content/docs/book/downloads.md new file mode 100644 index 00000000..cc22e5dd --- /dev/null +++ b/website/src/content/docs/book/downloads.md @@ -0,0 +1,12 @@ +--- +title: Downloads +sidebar: + order: 3 + label: 3. Downloads +--- + + +You can also download the Epub version here: + + + diff --git a/website/src/content/docs/book/enums.md b/website/src/content/docs/book/enums.md new file mode 100644 index 00000000..ece7d377 --- /dev/null +++ b/website/src/content/docs/book/enums.md @@ -0,0 +1,167 @@ +--- +title: Enums +sidebar: + order: 19 + label: 19. Enums +--- + + +In TypeScript, an `enum` is a set of named constant values. + +```typescript +enum Color { + Red = '#ff0000', + Green = '#00ff00', + Blue = '#0000ff', +} +``` + +Enums can be defined in different ways: + +### Numeric enums + +In TypeScript, a Numeric Enum is an Enum where each constant is assigned a numeric value, starting from 0 by default. + +```typescript +enum Size { + Small, // value starts from 0 + Medium, + Large, +} +``` + +It is possible to specify custom values by explicitly assigning them: + +```typescript +enum Size { + Small = 10, + Medium, + Large, +} +console.log(Size.Medium); // 11 +``` + +### String enums + +In TypeScript, a String enum is an Enum where each constant is assigned a string value. + +```typescript +enum Language { + English = 'EN', + Spanish = 'ES', +} +``` + +Note: TypeScript allows the usage of heterogeneous Enums where string and numeric members can coexist. + +### Constant enums + +A constant enum in TypeScript is a special type of Enum where all the values are known at compile time and are inlined wherever the enum is used, resulting in more efficient code. + +```typescript +const enum Language { + English = 'EN', + Spanish = 'ES', +} +console.log(Language.English); +``` + +Will be compiled into: + +```typescript +console.log('EN' /* Language.English */); +``` + +Notes: +Const Enums have hardcoded values, erasing the Enum, which can be more efficient in self-contained libraries but is generally not desirable. Also, Const enums cannot have computed members. + +### Reverse mapping + +In TypeScript, reverse mappings in Enums refer to the ability to retrieve the Enum member name from its value. By default, Enum members have forward mappings from name to value, but reverse mappings can be created by explicitly setting values for each member. Reverse mappings are useful when you need to look up an Enum member by its value, or when you need to iterate over all the Enum members. Note that only numeric enums members will generate reverse mappings, while String Enum members do not get a reverse mapping generated at all. + +The following enum: + +```typescript +enum Grade { + A = 90, + B = 80, + C = 70, + F = 'fail', +} +``` + +Compiles to: + + +```javascript +'use strict'; +var Grade; +(function (Grade) { + Grade[(Grade['A'] = 90)] = 'A'; + Grade[(Grade['B'] = 80)] = 'B'; + Grade[(Grade['C'] = 70)] = 'C'; + Grade['F'] = 'fail'; +})(Grade || (Grade = {})); +``` + +Therefore, mapping values to keys works for numeric enum members, but not for string enum members: + + +```typescript +enum Grade { + A = 90, + B = 80, + C = 70, + F = 'fail', +} +const myGrade = Grade.A; +console.log(Grade[myGrade]); // A +console.log(Grade[90]); // A + +const failGrade = Grade.F; +console.log(failGrade); // fail +console.log(Grade[failGrade]); // Element implicitly has an 'any' type because index expression is not of type 'number'. +``` + +### Ambient enums + +An ambient enum in TypeScript is a type of Enum that is defined in a declaration file (*.d.ts) without an associated implementation. It allows you to define a set of named constants that can be used in a type-safe way across different files without having to import the implementation details in each file. + +### Computed and constant members + +In TypeScript, a computed member is a member of an Enum that has a value calculated at runtime, while a constant member is a member whose value is set at compile-time and cannot be changed during runtime. Computed members are allowed in regular Enums, while constant members are allowed in both regular and const enums. + +```typescript +// Constant members +enum Color { + Red = 1, + Green = 5, + Blue = Red + Green, +} +console.log(Color.Blue); // 6 generation at compilation time +``` + +```typescript +// Computed members +enum Color { + Red = 1, + Green = Math.pow(2, 2), + Blue = Math.floor(Math.random() * 3) + 1, +} +console.log(Color.Blue); // random number generated at run time +``` + +Enums are denoted by unions comprising their member types. The values of each member can be determined through constant or non-constant expressions, with members possessing constant values being assigned literal types. To illustrate, consider the declaration of type E and its subtypes E.A, E.B, and E.C. In this case, E represents the union E.A | E.B | E.C. + +```typescript +const identity = (value: number) => value; + +enum E { + A = 2 * 5, // Numeric literal + B = 'bar', // String literal + C = identity(42), // Opaque computed +} + +console.log(E.C); //42 +``` + diff --git a/website/src/content/docs/book/erased-structural-types.md b/website/src/content/docs/book/erased-structural-types.md new file mode 100644 index 00000000..ec555f51 --- /dev/null +++ b/website/src/content/docs/book/erased-structural-types.md @@ -0,0 +1,28 @@ +--- +title: Erased Structural Types +sidebar: + order: 56 + label: 56. Erased Structural Types +--- + + +In TypeScript, objects do not have to match a specific, exact type. For instance, if we create an object that fulfills an interface's requirements, we can utilize that object in places where that interface is required, even if there was no explicit connection between them. +Example: + +```typescript +type NameProp1 = { + prop1: string; +}; + +function log(x: NameProp1) { + console.log(x.prop1); +} + +const obj = { + prop2: 123, + prop1: 'Origin', +}; + +log(obj); // Valid +``` + diff --git a/website/src/content/docs/book/exhaustiveness-checking.md b/website/src/content/docs/book/exhaustiveness-checking.md new file mode 100644 index 00000000..1e0c2c2b --- /dev/null +++ b/website/src/content/docs/book/exhaustiveness-checking.md @@ -0,0 +1,30 @@ +--- +title: Exhaustiveness checking +sidebar: + order: 26 + label: 26. Exhaustiveness checking +--- + + +Exhaustiveness checking is a feature in TypeScript that ensures all possible cases of a discriminated union are handled in a `switch` statement or an `if` statement. + +```typescript +type Direction = 'up' | 'down'; + +const move = (direction: Direction) => { + switch (direction) { + case 'up': + console.log('Moving up'); + break; + case 'down': + console.log('Moving down'); + break; + default: + const exhaustiveCheck: never = direction; + console.log(exhaustiveCheck); // This line will never be executed + } +}; +``` + +The `never` type is used to ensure that the default case is exhaustive and that TypeScript will raise an error if a new value is added to the Direction type without being handled in the switch statement. + diff --git a/website/src/content/docs/book/exploring-the-type-system.md b/website/src/content/docs/book/exploring-the-type-system.md new file mode 100644 index 00000000..a9ff92dd --- /dev/null +++ b/website/src/content/docs/book/exploring-the-type-system.md @@ -0,0 +1,817 @@ +--- +title: Exploring the Type System +sidebar: + order: 9 + label: 9. Exploring the Type System +--- + + +### The TypeScript Language Service + +The TypeScript Language Service, also known as tsserver, offers various features such as error reporting, diagnostics, compile-on-save, renaming, go to definition, completion lists, signature help, and more. It is primarily used by integrated development environments (IDEs) to provide IntelliSense support. It seamlessly integrates with Visual Studio Code and is utilized by tools like Conquer of Completion (Coc). + +Developers can leverage a dedicated API and create their own custom language service plugins to enhance the TypeScript editing experience. This can be particularly useful for implementing special linting features or enabling auto-completion for a custom templating language. + + +An example of a real-world custom plugin is "typescript-styled-plugin", which provides syntax error reporting and IntelliSense support for CSS properties in styled components. + + +For more information and quick start guides, you can refer to the official TypeScript Wiki on GitHub: + +### Structural Typing + +TypeScript is based on a structural type system. This means that the compatibility and equivalence of types are determined by the type's actual structure or definition, rather than its name or place of declaration, as in nominative type systems like C# or C. + +TypeScript's structural type system was designed based on how JavaScript's dynamic duck typing system works during runtime. + +The following example is valid TypeScript code. As you can observe, "X" and "Y" have the same member "a," even though they have different declaration names. The types are determined by their structures, and in this case, since the structures are the same, they are compatible and valid. + +```typescript +type X = { + a: string; +}; +type Y = { + a: string; +}; +const x: X = { a: 'a' }; +const y: Y = x; // Valid +``` + +### TypeScript Fundamental Comparison Rules + +The TypeScript comparison process is recursive and executed on types nested at any level. + +A type "X" is compatible with "Y" if "Y" has at least the same members as "X". + +```typescript +type X = { + a: string; +}; +const y = { a: 'A', b: 'B' }; // Valid, as it has at least the same members as X +const r: X = y; +``` + +Function parameters are compared by types, not by their names: + +```typescript +type X = (a: number) => void; +type Y = (a: number) => void; +let x: X = (j: number) => undefined; +let y: Y = (k: number) => undefined; +y = x; // Valid +x = y; // Valid +``` + +Function return types must be the same: + + +```typescript +type X = (a: number) => undefined; +type Y = (a: number) => number; +let x: X = (a: number) => undefined; +let y: Y = (a: number) => 1; +y = x; // Invalid +x = y; // Invalid +``` + +The return type of a source function must be a subtype of the return type of a target function: + + +```typescript +let x = () => ({ a: 'A' }); +let y = () => ({ a: 'A', b: 'B' }); +x = y; // Valid +y = x; // Invalid member b is missing +``` + +Discarding function parameters is allowed, as it is a common practice in JavaScript, for instance using "Array.prototype.map()": + +```typescript +[1, 2, 3].map((element, _index, _array) => element + 'x'); +``` + +Therefore, the following type declarations are completely valid: + +```typescript +type X = (a: number) => undefined; +type Y = (a: number, b: number) => undefined; +let x: X = (a: number) => undefined; +let y: Y = (a: number) => undefined; // Missing b parameter +y = x; // Valid +``` + +Any additional optional parameters of the source type are valid: + +```typescript +type X = (a: number, b?: number, c?: number) => undefined; +type Y = (a: number) => undefined; +let x: X = a => undefined; +let y: Y = a => undefined; +y = x; // Valid +x = y; //Valid +``` + +Any optional parameters of the target type without corresponding parameters in the source type are valid and not an error: + +```typescript +type X = (a: number) => undefined; +type Y = (a: number, b?: number) => undefined; +let x: X = a => undefined; +let y: Y = a => undefined; +y = x; // Valid +x = y; // Valid +``` + +The rest parameter is treated as an infinite series of optional parameters: + +```typescript +type X = (a: number, ...rest: number[]) => undefined; +let x: X = a => undefined; //valid +``` + +Functions with overloads are valid if the overload signature is compatible with its implementation signature: + + +```typescript +function x(a: string): void; +function x(a: string, b: number): void; +function x(a: string, b?: number): void { + console.log(a, b); +} +x('a'); // Valid +x('a', 1); // Valid + +function y(a: string): void; // Invalid, not compatible with implementation signature +function y(a: string, b: number): void; +function y(a: string, b: number): void { + console.log(a, b); +} +y('a'); +y('a', 1); +``` + +Function parameter comparison succeeds if the source and target parameters are assignable to supertypes or subtypes (bivariance). + +```typescript +// Supertype +class X { + a: string; + constructor(value: string) { + this.a = value; + } +} +// Subtype +class Y extends X {} +// Subtype +class Z extends X {} + +type GetA = (x: X) => string; +const getA: GetA = x => x.a; + +// Bivariance does accept supertypes +console.log(getA(new X('x'))); // Valid +console.log(getA(new Y('Y'))); // Valid +console.log(getA(new Z('z'))); // Valid +``` + +Enums are comparable and valid with numbers and vice versa, but comparing Enum values from different Enum types is invalid. + + +```typescript +enum X { + A, + B, +} +enum Y { + A, + B, + C, +} +const xa: number = X.A; // Valid +const ya: Y = 0; // Valid +X.A === Y.A; // Invalid +``` + +Instances of a class are subject to a compatibility check for their private and protected members: + + +```typescript +class X { + public a: string; + constructor(value: string) { + this.a = value; + } +} + +class Y { + private a: string; + constructor(value: string) { + this.a = value; + } +} + +let x: X = new Y('y'); // Invalid +``` + +The comparison check does not take into consideration the different inheritance hierarchy, for instance: + +```typescript +class X { + public a: string; + constructor(value: string) { + this.a = value; + } +} +class Y extends X { + public a: string; + constructor(value: string) { + super(value); + this.a = value; + } +} +class Z { + public a: string; + constructor(value: string) { + this.a = value; + } +} +let x: X = new X('x'); +let y: Y = new Y('y'); +let z: Z = new Z('z'); +x === y; // Valid +x === z; // Valid even if z is from a different inheritance hierarchy +``` + +Generics are compared using their structures based on the resulting type after applying the generic parameter, only the final result is compared as a non-generic type. + + +```typescript +interface X { + a: T; +} +let x: X = { a: 1 }; +let y: X = { a: 'a' }; +x === y; // Invalid as the type argument is used in the final structure +``` + +```typescript +interface X {} +const x: X = 1; +const y: X = 'a'; +x === y; // Valid as the type argument is not used in the final structure +``` + +When generics do not have their type argument specified, all the unspecified arguments are treated as types with "any": + +```typescript +type X = (x: T) => T; +type Y = (y: K) => K; +let x: X = x => x; +let y: Y = y => y; +x = y; // Valid +``` + +Remember: + + +```typescript +let a: number = 1; +let b: number = 2; +a = b; // Valid, everything is assignable to itself + +let c: any; +c = 1; // Valid, all types are assignable to any + +let d: unknown; +d = 1; // Valid, all types are assignable to unknown + +let e: unknown; +let e1: unknown = e; // Valid, unknown is only assignable to itself and any +let e2: any = e; // Valid +let e3: number = e; // Invalid + +let f: never; +f = 1; // Invalid, nothing is assignable to never + +let g: void; +let g1: any; +g = 1; // Invalid, void is not assignable to or from anything expect any +g = g1; // Valid +``` + +Please note that when "strictNullChecks" is enabled, "null" and "undefined" are treated similarly to "void"; otherwise, they are similar to "never". + +### Types as Sets + +In TypeScript, a type is a set of possible values. This set is also referred to as the domain of the type. Each value of a type can be viewed as an element in a set. A type establishes the constraints that every element in the set must satisfy to be considered a member of that set. +The primary task of TypeScript is to check and verify whether one set is a subset of another. + +TypeScript supports various types of sets: + +| Set term | TypeScript | Notes | +| ------------------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Empty set | never | "never" contains anything apart itself | +| Single element set | undefined / null / literal type | | +| Finite set | boolean / union | | +| Infinite set | string / number / object | | +| Universal set | any / unknown | Every element is a member of "any" and every set is a subset of it / "unknown" is a type-safe counterpart of "any" | + +Here few examples: + +| TypeScript | Set term | Example | +| --------------------- | ---------------------- | ------------------------------------------------------------------------------- | +| never | ∅ (empty set) | const x: never = 'x'; // Error: Type 'string' is not assignable to type 'never' | +| | | +| Literal type | Single element set | type X = 'X'; | +| | | type Y = 7; | +| | | +| Value assignable to T | Value ∈ T (member of) | type XY = 'X' \| 'Y'; | +| | | const x: XY = 'X'; | +| | | +| T1 assignable to T2 | T1 ⊆ T2 (subset of) | type XY = 'X' \| 'Y'; | +| | | const x: XY = 'X'; | +| | | const j: XY = 'J'; // Type '"J"' is not assignable to type 'XY'. | +| | | | +| T1 extends T2 | T1 ⊆ T2 (subset of) | type X = 'X' extends string ? true : false; | +| | | +| T1 \| T2 | T1 ∪ T2 (union) | type XY = 'X' \| 'Y'; | +| | | type JK = 1 \| 2; | +| | | +| T1 & T2 | T1 ∩ T2 (intersection) | type X = { a: string } | +| | | type Y = { b: string } | +| | | type XY = X & Y | +| | | const x: XY = { a: 'a', b: 'b' } | +| | | +| unknown | Universal set | const x: unknown = 1 | + +An union, (T1 | T2) creates a wider set (both): + +```typescript +type X = { + a: string; +}; +type Y = { + b: string; +}; +type XY = X | Y; +const r: XY = { a: 'a', b: 'x' }; // Valid +``` + +An intersection, (T1 & T2) create a narrower set (only shared): + + +```typescript +type X = { + a: string; +}; +type Y = { + a: string; + b: string; +}; +type XY = X & Y; +const r: XY = { a: 'a' }; // Invalid +const j: XY = { a: 'a', b: 'b' }; // Valid +``` + +The `extends` keyword could be considered as a "subset of" in this context. It sets a constraint for a type. The extends used with a generic, take the generic as an infinite set and it will constrain it to a more specific type. +Please note that `extends` has nothing to do with hierarchy in a OOP sense (there is no this concept in TypeScript). +TypeScript works with sets and does not have a strict hierarchy, infact, as in the example below, two types could overlap without either being a subtype of the other type (TypeScript considers the structure, shape of the objects). + +```typescript +interface X { + a: string; +} +interface Y extends X { + b: string; +} +interface Z extends Y { + c: string; +} +const z: Z = { a: 'a', b: 'b', c: 'c' }; +interface X1 { + a: string; +} +interface Y1 { + a: string; + b: string; +} +interface Z1 { + a: string; + b: string; + c: string; +} +const z1: Z1 = { a: 'a', b: 'b', c: 'c' }; + +const r: Z1 = z; // Valid +``` + +### Assign a type: Type Declarations and Type Assertions + +A type can be assigned in different ways in TypeScript: + +#### Type Declaration + +In the following example, we use x: X (": Type") to declare a type for the variable x. + +```typescript +type X = { + a: string; +}; + +// Type declaration +const x: X = { + a: 'a', +}; +``` + +If the variable is not in the specified format, TypeScript will report an error. For instance: + + +```typescript +type X = { + a: string; +}; + +const x: X = { + a: 'a', + b: 'b', // Error: Object literal may only specify known properties +}; +``` + +#### Type Assertion + +It is possible to add an assertion by using the `as` keyword. This tells the compiler that the developer has more information about a type and silences any errors that may occur. + +For example: + +```typescript +type X = { + a: string; +}; +const x = { + a: 'a', + b: 'b', +} as X; +``` + +In the above example, the object x is asserted to have the type X using the as keyword. This informs the TypeScript compiler that the object conforms to the specified type, even though it has an additional property b not present in the type definition. + +Type assertions are useful in situations where a more specific type needs to be specified, especially when working with the DOM. For instance: + +```typescript +const myInput = document.getElementById('my_input') as HTMLInputElement; +``` + +Here, the type assertion as HTMLInputElement is used to tell TypeScript that the result of getElementById should be treated as an HTMLInputElement. +Type assertions can also be used to remap keys, as shown in the example below with template literals: + +```typescript +type J = { + [Property in keyof Type as `prefix_${string & + Property}`]: () => Type[Property]; +}; +type X = { + a: string; + b: number; +}; +type Y = J; +``` + +In this example, the type `J` uses a mapped type with a template literal to remap the keys of Type. It creates new properties with a "prefix_" added to each key, and their corresponding values are functions returning the original property values. + +It is worth noting that when using a type assertion, TypeScript will not execute excess property checking. Therefore, it is generally preferable to use a Type Declaration when the structure of the object is known in advance. + +#### Ambient Declarations + +Ambient declarations are files that describe types for JavaScript code, they have a file name format as `.d.ts.`. They are usually imported and used to annotate existing JavaScript libraries or to add types to existing JS files in your project. + +Many common libraries types can be found at: + + +and can be installed using: + +```shell +npm install --save-dev @types/library-name +``` + +For your defined Ambient Declarations, you can import using the "triple-slash" reference: + + +```typescript +/// +``` + +You can use Ambient Declarations even within JavaScript files using `// @ts-check`. + +### Property Checking and Excess Property Checking + +TypeScript is based on a structural type system but excess property checking is a property of TypeScript which allows it to check whether an object has the exact properties specified in the type. + +Excess Property Checking is performed when assigning object literals to variables or when passing them as arguments to the function's excess property, for instance. + + +```typescript +type X = { + a: string; +}; +const y = { a: 'a', b: 'b' }; +const x: X = y; // Valid because structural typing +const w: X = { a: 'a', b: 'b' }; // Invalid because excess property checking +``` + +### Weak Types + +A type is considered weak when it contains nothing but a set of all-optional properties: + +```typescript +type X = { + a?: string; + b?: string; +}; +``` + +TypeScript considers an error to assign anything to a weak type when there is no overlap, for instance, the following throws an error: + + +```typescript +type Options = { + a?: string; + b?: string; +}; + +const fn = (options: Options) => undefined; + +fn({ c: 'c' }); // Invalid +``` + +Although not recommended, if needed, it is possible to bypass this check by using type assertion: + +```typescript +type Options = { + a?: string; + b?: string; +}; +const fn = (options: Options) => undefined; +fn({ c: 'c' } as Options); // Valid +``` + +Or by adding `unknown` to the index signature to the weak type: + +```typescript +type Options = { + [prop: string]: unknown; + a?: string; + b?: string; +}; + +const fn = (options: Options) => undefined; +fn({ c: 'c' }); // Valid +``` + +### Strict Object Literal Checking (Freshness) + +Strict object literal checking, sometimes referred to as "freshness", is a feature in TypeScript that helps catch excess or misspelled properties that would otherwise go unnoticed in normal structural type checks. + +When creating an object literal, the TypeScript compiler considers it "fresh." If the object literal is assigned to a variable or passed as a parameter, TypeScript will throw an error if the object literal specifies properties that do not exist in the target type. + +However, "freshness" disappears when an object literal is widened or a type assertion is used. + +Here are some examples to illustrate: + + +```typescript +type X = { a: string }; +type Y = { a: string; b: string }; + +let x: X; +x = { a: 'a', b: 'b' }; // Freshness check: Invalid assignment +var y: Y; +y = { a: 'a', bx: 'bx' }; // Freshness check: Invalid assignment + +const fn = (x: X) => console.log(x.a); + +fn(x); +fn(y); // Widening: No errors, structurally type compatible + +fn({ a: 'a', bx: 'b' }); // Freshness check: Invalid argument + +let c: X = { a: 'a' }; +let d: Y = { a: 'a', b: '' }; +c = d; // Widening: No Freshness check +``` + +### Type Inference + +TypeScript can infer types when no annotation is provided during: + +* Variable initialization. +* Member initialization. +* Setting defaults for parameters. +* Function return type. + +For example: + +```typescript +let x = 'x'; // The type inferred is string +``` + +The TypeScript compiler analyzes the value or expression and determines its type based on the available information. + +### More Advanced Inferences + +When multiple expressions are used in type inference, TypeScript looks for the "best common types." For instance: + +```typescript +let x = [1, 'x', 1, null]; // The type inferred is: (string | number | null)[] +``` + +If the compiler cannot find the best common types, it returns a union type. For example: + +```typescript +let x = [new RegExp('x'), new Date()]; // Type inferred is: (RegExp | Date)[] +``` + +TypeScript utilizes "contextual typing" based on the variable's location to infer types. In the following example, the compiler knows that `e` is of type `MouseEvent` because of the `click` event type defined in the lib.d.ts file, which contains ambient declarations for various common JavaScript constructs and the DOM: + +```typescript +window.addEventListener('click', function (e) {}); // The inferred type of e is MouseEvent +``` + +### Type Widening + +Type widening is the process in which TypeScript assigns a type to a variable initialized when no type annotation was provided. It allows narrow to wider types but not vice versa. +In the following example: + + +```typescript +let x = 'x'; // TypeScript infers as string, a wide type +let y: 'y' | 'x' = 'y'; // y types is a union of literal types +y = x; // Invalid Type 'string' is not assignable to type '"x" | "y"'. +``` + +TypeScript assigns `string` to `x` based on the single value provided during initialization (`x`), this is an example of widening. + +TypeScript provides ways to have control of the widening process, for instance using "const". + +### Const + +Using the `const` keyword when declaring a variable results in a narrower type inference in TypeScript. + +For example: + +```typescript +const x = 'x'; // TypeScript infers the type of x as 'x', a narrower type +let y: 'y' | 'x' = 'y'; +y = x; // Valid: The type of x is inferred as 'x' +``` + +By using `const` to declare the variable x, its type is narrowed to the specific literal value 'x'. Since the type of x is narrowed, it can be assigned to the variable y without any error. +The reason the type can be inferred is because `const` variables cannot be reassigned, so their type can be narrowed down to a specific literal type, in this case, the literal type 'x'. + +#### Const Modifier on Type Parameters + +From version 5.0 of TypeScript, it is possible to specify the `const` attribute on a generic type parameter. This allows for inferring the most precise type possible. Let's see an example without using `const`: + +```typescript +function identity(value: T) { + // No const here + return value; +} +const values = identity({ a: 'a', b: 'b' }); // Type infered is: { a: string; b: string; } +``` + +As you can see, the properties `a` and `b` are inferred with a type of `string` . + +Now, let's see the difference with the `const` version: + +```typescript +function identity(value: T) { + // Using const modifier on type parameters + return value; +} +const values = identity({ a: 'a', b: 'b' }); // Type infered is: { a: "a"; b: "b"; } +``` + +Now we can see that the properties `a` and `b` are inferred as `const`, so `a` and `b` are treated as string literals rather than just `string` types. + +#### Const assertion + +This feature allows you to declare a variable with a more precise literal type based on its initialization value, signifying to the compiler that the value should be treated as an immutable literal. Here are a few examples: + +On a single property: + +```typescript +const v = { + x: 3 as const, +}; +v.x = 3; +``` + +On an entire object: + +```typescript +const v = { + x: 1, + y: 2, +} as const; +``` + +This can be particularly useful when defining the type for a tuple: + +```typescript +const x = [1, 2, 3]; // number[] +const y = [1, 2, 3] as const; // Tuple of readonly [1, 2, 3] +``` + +### Explicit Type Annotation + +We can be specific and pass a type, in the following example property `x` is of type `number`: + +```typescript +const v = { + x: 1, // Inferred type: number (widening) +}; +v.x = 3; // Valid +``` + +We can make the type annotation more specific by using a union of literal types: + + +```typescript +const v: { x: 1 | 2 | 3 } = { + x: 1, // x is now a union of literal types: 1 | 2 | 3 +}; +v.x = 3; // Valid +v.x = 100; // Invalid +``` + +### Type Narrowing + +Type Narrowing is the process in TypeScript where a general type is narrowed down to a more specific type. This occurs when TypeScript analyzes the code and determines that certain conditions or operations can refine the type information. + +Narrowing types can occur in different ways, including: + +#### Conditions + +By using conditional statements, such as `if` or `switch`, TypeScript can narrow down the type based on the outcome of the condition. For example: + +```typescript +let x: number | undefined = 10; + +if (x !== undefined) { + x += 100; // The type is number, which had been narrowed by the condition +} +``` + +#### Throwing or returning + +Throwing an error or returning early from a branch can be used to help TypeScript narrow down a type. For example: + +```typescript +let x: number | undefined = 10; + +if (x === undefined) { + throw 'error'; +} +x += 100; +``` + +Other ways to narrow down types in TypeScript include: + +* `instanceof` operator: Used to check if an object is an instance of a specific class. +* `in` operator: Used to check if a property exists in an object. +* `typeof` operator: Used to check the type of a value at runtime. +* Built-in functions like `Array.isArray()`: Used to check if a value is an array. + +#### Discriminated Union + +Using a "Discriminated Union" is a pattern in TypeScript where an explicit "tag" is added to objects to distinguish between different types within a union. This pattern is also referred to as a "tagged union." In the following example, the "tag" is represented by the property "type": + +```typescript +type A = { type: 'type_a'; value: number }; +type B = { type: 'type_b'; value: string }; + +const x = (input: A | B): string | number => { + switch (input.type) { + case 'type_a': + return input.value + 100; // type is A + case 'type_b': + return input.value + 'extra'; // type is B + } +}; +``` + +#### User-Defined Type Guards + +In cases where TypeScript is unable to determine a type, it is possible to write a helper function known as a "user-defined type guard." In the following example, we will utilize a Type Predicate to narrow down the type after applying certain filtering: + +```typescript +const data = ['a', null, 'c', 'd', null, 'f']; + +const r1 = data.filter(x => x != null); // The type is (string | null)[], TypeScript was not able to infer the type properly + +const isValid = (item: string | null): item is string => item !== null; // Custom type guard + +const r2 = data.filter(isValid); // The type is fine now string[], by using the predicate type guard we were able to narrow the type +``` + diff --git a/website/src/content/docs/book/extending-types.md b/website/src/content/docs/book/extending-types.md new file mode 100644 index 00000000..4664bc85 --- /dev/null +++ b/website/src/content/docs/book/extending-types.md @@ -0,0 +1,56 @@ +--- +title: Extending Types +sidebar: + order: 15 + label: 15. Extending Types +--- + + +It is possible to extend an `interface` (copy members from another type): + +```typescript +interface X { + a: string; +} +interface Y extends X { + b: string; +} +``` + +It is also possible to extend from multiple types: + +```typescript +interface A { + a: string; +} +interface B { + b: string; +} +interface Y extends A, B { + y: string; +} +``` + +The `extends` keyword works only on interfaces and classes, for types use an intersection: + +```typescript +type A = { + a: number; +}; +type B = { + b: number; +}; +type C = A & B; +``` + +It is possible to extend a type using an inference but not vice versa: + +```typescript +type A = { + a: string; +}; +interface B extends A { + b: string; +} +``` + diff --git a/website/src/content/docs/book/fixed-length-tuple.md b/website/src/content/docs/book/fixed-length-tuple.md new file mode 100644 index 00000000..c106ad48 --- /dev/null +++ b/website/src/content/docs/book/fixed-length-tuple.md @@ -0,0 +1,18 @@ +--- +title: Fixed Length Tuple +sidebar: + order: 30 + label: 30. Fixed Length Tuple +--- + + +A Fixed Length Tuple is a specific type of tuple that enforces a fixed number of elements of specific types, and disallows any modifications to the length of the tuple once it is defined. + +Fixed Length Tuples are useful when you need to represent a collection of values with a specific number of elements and specific types, and you want to ensure that the length and types of the tuple cannot be changed inadvertently. + + +```typescript +const x = [10, 'hello'] as const; +x.push(2); // Error +``` + diff --git a/website/src/content/docs/book/generics.md b/website/src/content/docs/book/generics.md new file mode 100644 index 00000000..0a85e8ae --- /dev/null +++ b/website/src/content/docs/book/generics.md @@ -0,0 +1,105 @@ +--- +title: Generics +sidebar: + order: 55 + label: 55. Generics +--- + + +Generics allow you to create reusable components and functions that can work with multiple types. With generics, you can parameterize types, functions, and interfaces, allowing them to operate on different types without explicitly specifying them beforehand. + +Generics allow you to make code more flexible and reusable. + +### Generic Type + +To define a generic type, you use angle brackets (`<>`) to specify the type parameters, for instance: + +```typescript +function identity(arg: T): T { + return arg; +} +const a = identity('x'); +const b = identity(123); + +const getLen = (data: ReadonlyArray) => data.length; +const len = getLen([1, 2, 3]); +``` + +### Generic Classes + +Generics can be applied also to classes, in this way they can work with multiple types by using type parameters. This is useful to create reusable class definitions that can operate on different data types while maintaining type safety. + +```typescript +class Container { + private item: T; + + constructor(item: T) { + this.item = item; + } + + getItem(): T { + return this.item; + } +} + +const numberContainer = new Container(123); +console.log(numberContainer.getItem()); // 123 + +const stringContainer = new Container('hello'); +console.log(stringContainer.getItem()); // hello +``` + +### Generic Constraints + +Generic parameters can be constrained using the `extends` keyword followed by a type or interface that the type parameter must satisfy. + +In the following example T it is must containing a properly `length` in order to be valid: + + +```typescript +const printLen = (value: T): void => { + console.log(value.length); +}; + +printLen('Hello'); // 5 +printLen([1, 2, 3]); // 3 +printLen({ length: 10 }); // 10 +printLen(123); // Invalid +``` + +An interesting feature of generic introduced in version 3.4 RC is Higher order function type inference which introduced propagated generic type arguments: + +```typescript +declare function pipe( + ab: (...args: A) => B, + bc: (b: B) => C +): (...args: A) => C; + +declare function list(a: T): T[]; +declare function box(x: V): { value: V }; + +const listBox = pipe(list, box); // (a: T) => { value: T[] } +const boxList = pipe(box, list); // (x: V) => { value: V }[] +``` + +This functionality allows more easily typed safe pointfree style programming which is common in functional programming. + +### Generic contextual narrowing + +Contextual narrowing for generics is the mechanism in TypeScript that allows the compiler to narrow down the type of a generic parameter based on the context in which it is used, it is useful when working with generic types in conditional statements: + +```typescript +function process(value: T): void { + if (typeof value === 'string') { + // Value is narrowed down to type 'string' + console.log(value.length); + } else if (typeof value === 'number') { + // Value is narrowed down to type 'number' + console.log(value.toFixed(2)); + } +} + +process('hello'); // 5 +process(3.14159); // 3.14 +``` + diff --git a/website/src/content/docs/book/getting-started-with-typescript.md b/website/src/content/docs/book/getting-started-with-typescript.md new file mode 100644 index 00000000..e93cf0b8 --- /dev/null +++ b/website/src/content/docs/book/getting-started-with-typescript.md @@ -0,0 +1,183 @@ +--- +title: Getting Started With TypeScript +sidebar: + order: 8 + label: 8. Getting Started With TypeScript +--- + + +### Installation + +Visual Studio Code provides excellent support for the TypeScript language but does not include the TypeScript compiler. To install the TypeScript compiler, you can use a package manager like npm or yarn: + +```shell +npm install typescript --save-dev +``` + +or + +```shell +yarn add typescript --dev +``` + +Make sure to commit the generated lockfile to ensure that every team member uses the same version of TypeScript. + +To run the TypeScript compiler, you can use the following commands + +```shell +npx tsc +``` + +or + +```shell +yarn tsc +``` + +It is recommended to install TypeScript project-wise rather than globally, as it provides a more predictable build process. However, for one-off occasions, you can use the following command: + +```shell +npx tsc +``` + +or installing it globally: + +```shell +npm install -g typescript +``` + +If you are using Microsoft Visual Studio, you can obtain TypeScript as a package in NuGet for your MSBuild projects. In the NuGet Package Manager Console, run the following command: + +```shell +Install-Package Microsoft.TypeScript.MSBuild +``` + +During the TypeScript installation, two executables are installed: "tsc" as the TypeScript compiler and "tsserver" as the TypeScript standalone server. The standalone server contains the compiler and language services that can be utilized by editors and IDEs to provide intelligent code completion. + +Additionally, there are several TypeScript-compatible transpilers available, such as Babel (via a plugin) or swc. These transpilers can be used to convert TypeScript code into other target languages or versions. + +### Configuration + +TypeScript can be configured using the tsc CLI options or by utilizing a dedicated configuration file called tsconfig.json placed in the root of the project. + +To generate a tsconfig.json file prepopulated with recommended settings, you can use the following command: + +```shell +tsc --init +``` + +When executing the `tsc` command locally, TypeScript will compile the code using the configuration specified in the nearest tsconfig.json file. + +Here are some examples of CLI commands that run with the default settings: + +```shell +tsc main.ts // Compile a specific file (main.ts) to JavaScript +tsc src/*.ts // Compile any .ts files under the 'src' folder to JavaScript +tsc app.ts util.ts --outfile index.js // Compile two TypeScript files (app.ts and util.ts) into a single JavaScript file (index.js) +``` + +### TypeScript Configuration File ​​tsconfig.json + +A tsconfig.json file is used to configure the TypeScript Compiler (tsc). Usually, it is added to the root of the project, together with the `package.json` file. + +Notes: + +* tsconfig.json accepts comments even if it is in json format. +* It is advisable to use this configuration file instead of the command-line options. + +At the following link you can find the complete documentation and its schema: + + + + + +The following represents a list of the common and useful configurations: + +#### target + +The "target" property is used to specify which version of JavaScript ECMAScript version your TypeScript should emit/compile into. For modern browsers ES6 is a good option, for older browsers, ES5 is recommended. + +#### lib + +The "lib" property is used to specify which library files to include at compilation time. TypeScript automatically includes APIs for features specified in the "target" property, but it is possible to omit or pick specific libraries for particular needs. For instance, if you are working on a server project, you could exclude the "DOM" library, which is useful only in a browser environment. + +#### strict + +The "strict" property enables stronger guarantees and enhances type safety. It is advisable to always include this property in your project's tsconfig.json file. Enabling the "strict" property allows TypeScript to: + +* Emit code using "use strict" for each source file. +* Consider "null" and "undefined" in the type checking process. +* Disable the usage of the "any" type when no type annotations are present. +* Raise an error on the usage of the "this" expression, which would otherwise imply the "any" type. + +#### module + +The "module" property sets the module system supported for the compiled program. During runtime, a module loader is used to locate and execute dependencies based on the specified module system. + +The most common module loaders used in JavaScript are Node.js CommonJS for server-side applications and RequireJS for AMD modules in browser-based web applications. TypeScript can emit code for various module systems, including UMD, System, ESNext, ES2015/ES6, and ES2020. + +Note: The module system should be chosen based on the target environment and the module loading mechanism available in that environment. + +#### moduleResolution + +The "moduleResolution" property specifies the module resolution strategy. Use "node" for modern TypeScript code, the "classic" strategy is used only for old versions of TypeScript (before 1.6). + +#### esModuleInterop + +The "esModuleInterop" property allows import default from CommonJS modules that did not export using the "default" property, this property provides a shim to ensure compatibility in the emitted JavaScript. After enabling this option we can use `import MyLibrary from "my-library"` instead of `import * as MyLibrary from "my-library"`. + +#### jsx + +The "jsx" property applies only to .tsx files used in ReactJS and controls how JSX constructs are compiled into JavaScript. A common option is "preserve" which will compile to a .jsx file keeping unchanged the JSX so it can be passed to different tools like Babel for further transformations. + +#### skipLibCheck + +The "skipLibCheck'' property will prevent TypeScript from type-checking the entire imported third-party packages. This property will reduce the compile time of a project. TypeScript will still check your code against the type definitions provided by these packages. + +#### files + +The "files" property indicates to the compiler a list of files that must always be included in the program. + +#### include + + +The "include" property indicates to the compiler a list of files that we would like to include. This property allows glob-like patterns, such as "\*_" for any subdirectory, "_" for any file name, and "?" for optional characters. + + +#### exclude + +The "exclude" property indicates to the compiler a list of files that should not be included in the compilation. This can include files such as "node_modules" or test files. +Note: tsconfig.json allows comments. + +### importHelpers + +TypeScript uses helper code when generating code for certain advanced or down-leveled JavaScript features. By default, these helpers are duplicated in files using them. The `importHelpers` option imports these helpers from the `tslib` module instead, making the JavaScript output more efficient. + +### Migration to TypeScript Advice + +For large projects, it is recommended to adopt a gradual transition where TypeScript and JavaScript code will initially coexist. Only small projects can be migrated to TypeScript in one go. + +The first step of this transition is to introduce TypeScript into the build chain process. This can be done by using the "allowJs" compiler option, which permits .ts and .tsx files to coexist with existing JavaScript files. As TypeScript will fall back to a type of "any" for a variable when it cannot infer the type from JavaScript files, it is recommended to disable "noImplicitAny" in your compiler options at the beginning of the migration. + +The second step is to ensure that your JavaScript tests work alongside TypeScript files so that you can run tests as you convert each module. If you are using Jest, consider using `ts-jest`, which allows you to test TypeScript projects with Jest. + +The third step is to include type declarations for third-party libraries in your project. These declarations can be found either bundled or on DefinitelyTyped. You can search for them using and install them using: + +```shell +npm install --save-dev @types/package-name or yarn add --dev @types/package-name. +``` + +The fourth step is to migrate module by module with a bottom-up approach, following your Dependency Graph starting with the leaves. The idea is to start converting Modules that do not depend on other Modules. To visualize the dependency graphs, you can use the "madge" tool. + +Good candidate modules for these initial conversions are utility functions and code related to external APIs or specifications. It is possible to automatically generate TypeScript type definitions from Swagger contracts, GraphQL or JSON schemas to be included in your project. + +When there are no specifications or official schemas available, you can generate types from raw data, such as JSON returned by a server. However, it is recommended to generate types from specifications instead of data to avoid missing edge cases. + +During the migration, refrain from code refactoring and focus only on adding types to your modules. + +The fifth step is to enable "noImplicitAny," which will enforce that all types are known and defined, providing a better TypeScript experience for your project. + +During the migration, you can use the `@ts-check` directive, which enables TypeScript type checking in a JavaScript file. This directive provides a loose version of type checking and can be initially used to identify issues in JavaScript files. When `@ts-check` is included in a file, TypeScript will try to deduce definitions using JSDoc-style comments. However, consider using JSDoc annotations only at a very early stage of the migration. + +Consider keeping the default value of `noEmitOnError` in your tsconfig.json as false. This will allow you to output JavaScript source code even if errors are reported. + diff --git a/website/src/content/docs/book/index-signatures.md b/website/src/content/docs/book/index-signatures.md new file mode 100644 index 00000000..98121318 --- /dev/null +++ b/website/src/content/docs/book/index-signatures.md @@ -0,0 +1,22 @@ +--- +title: Index Signatures +sidebar: + order: 14 + label: 14. Index Signatures +--- + + +In TypeScript we can use as index signature `string`, `number`, and `symbol`: + +```typescript +type K = { + [name: string | number]: string; +}; +const k: K = { x: 'x', 1: 'b' }; +console.log(k['x']); +console.log(k[1]); +console.log(k['1']); // Same result as k[1] +``` + +Please note that JavaScript automatically converts an index with `number` to an index with `string` so `k[1]` or `k["1"]` return the same value. + diff --git a/website/src/content/docs/book/infer-type-inference-in-conditional-types.md b/website/src/content/docs/book/infer-type-inference-in-conditional-types.md new file mode 100644 index 00000000..d55a4a10 --- /dev/null +++ b/website/src/content/docs/book/infer-type-inference-in-conditional-types.md @@ -0,0 +1,16 @@ +--- +title: infer Type Inference in Conditional Types +sidebar: + order: 41 + label: 41. infer Type Inference in Conditional Types +--- + + +The `infer`keyword is used in conditional types to infer (extract) the type of a generic parameter from a type that depends on it. This allows you to write more flexible and reusable type definitions. + +```typescript +type ElementType = T extends (infer U)[] ? U : never; +type Numbers = ElementType; // number +type Strings = ElementType; // string +``` + diff --git a/website/src/content/docs/book/interface-and-type.md b/website/src/content/docs/book/interface-and-type.md new file mode 100644 index 00000000..bf72b916 --- /dev/null +++ b/website/src/content/docs/book/interface-and-type.md @@ -0,0 +1,87 @@ +--- +title: Interface and Type +sidebar: + order: 48 + label: 48. Interface and Type +--- + + +### Common Syntax + +In TypeScript, interfaces define the structure of objects, specifying the names and types of properties or methods that an object must have. The common syntax for defining an interface in TypeScript is as follows: + + +```typescript +interface InterfaceName { + property1: Type1; + // ... + method1(arg1: ArgType1, arg2: ArgType2): ReturnType; + // ... +} +``` + +Similarly for type definition: + + +```typescript +type TypeName = { + property1: Type1; + // ... + method1(arg1: ArgType1, arg2: ArgType2): ReturnType; + // ... +}; +``` + +`interface InterfaceName` or `type TypeName`: Defines the name of the interface. +`property1`: `Type1`: Specifies the properties of the interface along with their corresponding types. Multiple properties can be defined, each separated by a semicolon. +`method1(arg1: ArgType1, arg2: ArgType2): ReturnType;`: Specifies the methods of the interface. Methods are defined with their names, followed by a parameter list in parentheses and the return type. Multiple methods can be defined, each separated by a semicolon. + +Example interface: + +```typescript +interface Person { + name: string; + age: number; + greet(): void; +} +``` + +Example of type: + +```typescript +type TypeName = { + property1: string; + method1(arg1: string, arg2: string): string; +}; +``` + +In TypeScript, types are used to define the shape of data and enforce type checking. There are several common syntaxes for defining types in TypeScript, depending on the specific use case. Here are some examples: + +### Basic Types + +```typescript +let myNumber: number = 123; // number type +let myBoolean: boolean = true; // boolean type +let myArray: string[] = ['a', 'b']; // array of strings +let myTuple: [string, number] = ['a', 123]; // tuple +``` + +### Objects and Interfaces + +```typescript +const x: { name: string; age: number } = { name: 'Simon', age: 7 }; +``` + +### Union and Intersection Types + +```typescript +type MyType = string | number; // Union type +let myUnion: MyType = 'hello'; // Can be a string +myUnion = 123; // Or a number + +type TypeA = { name: string }; +type TypeB = { age: number }; +type CombinedType = TypeA & TypeB; // Intersection type +let myCombined: CombinedType = { name: 'John', age: 25 }; // Object with both name and age properties +``` + diff --git a/website/src/content/docs/book/intersection-types.md b/website/src/content/docs/book/intersection-types.md new file mode 100644 index 00000000..c169008f --- /dev/null +++ b/website/src/content/docs/book/intersection-types.md @@ -0,0 +1,27 @@ +--- +title: Intersection Types +sidebar: + order: 32 + label: 32. Intersection Types +--- + + +An Intersection Type is a type that represents a value that has all the properties of two or more types. Intersection Types are denoted using the `&` symbol between each type. + +```typescript +type X = { + a: string; +}; + +type Y = { + b: string; +}; + +type J = X & Y; // Intersection + +const j: J = { + a: 'a', + b: 'b', +}; +``` + diff --git a/website/src/content/docs/book/introduction.md b/website/src/content/docs/book/introduction.md new file mode 100644 index 00000000..8c65272d --- /dev/null +++ b/website/src/content/docs/book/introduction.md @@ -0,0 +1,12 @@ +--- +title: Introduction +sidebar: + order: 5 + label: 5. Introduction +--- + + +Welcome to The Concise TypeScript Book! This guide equips you with essential knowledge and practical skills for effective TypeScript development. Discover key concepts and techniques to write clean, robust code. Whether you're a beginner or an experienced developer, this book serves as both a comprehensive guide and a handy reference for leveraging TypeScript's power in your projects. + +This book covers TypeScript 5.2. + diff --git a/website/src/content/docs/book/literal-inference.md b/website/src/content/docs/book/literal-inference.md new file mode 100644 index 00000000..4b25b95f --- /dev/null +++ b/website/src/content/docs/book/literal-inference.md @@ -0,0 +1,52 @@ +--- +title: Literal Inference +sidebar: + order: 17 + label: 17. Literal Inference +--- + + +Literal Inference is a feature in TypeScript that allows the type of a variable or parameter to be inferred based on its value. + +In the following example we can see that TypeScript considers `x` a literal type as the value cannot be changed any time later, when instead `y` is inferred as string as it can be modified any time later. + +```typescript +const x = 'x'; // Literal type of 'x', because this value cannot be changed +let y = 'y'; // Type string, as we can change this value +``` + +In the following example we can see that `o.x` was inferred as a `string` (and not a literal of `a`) as TypeScript considers that the value can be changed any time later. + + +```typescript +type X = 'a' | 'b'; + +let o = { + x: 'a', // This is a wider string +}; + +const fn = (x: X) => `${x}-foo`; + +console.log(fn(o.x)); // Argument of type 'string' is not assignable to parameter of type 'X' +``` + +As you can see the code throws an error when passing `o.x` to `fn` as X is a narrower type. + +We can solve this issue by using type assertion using `const` or the `X` type: + + +```typescript +let o = { + x: 'a' as const, +}; +``` + +or: + + +```typescript +let o = { + x: 'a' as X, +}; +``` + diff --git a/website/src/content/docs/book/literal-types.md b/website/src/content/docs/book/literal-types.md new file mode 100644 index 00000000..cf8490e8 --- /dev/null +++ b/website/src/content/docs/book/literal-types.md @@ -0,0 +1,27 @@ +--- +title: Literal Types +sidebar: + order: 16 + label: 16. Literal Types +--- + + +A Literal Type is a single element set from a collective type, it defines a very exact value that is a JavaScript primitive. + +Literal Types in TypeScript are numbers, strings, and booleans. + +Example of literals: + +```typescript +const a = 'a'; // String literal type +const b = 1; // Numeric literal type +const c = true; // Boolean literal type +``` + +String, Numeric, and Boolean Literal Types are used in the union, type guard, and type aliases. +In the following example you can see a type alias union, `O` can be the only value specified and not any other string: + +```typescript +type O = 'a' | 'b' | 'c'; +``` + diff --git a/website/src/content/docs/book/mapped-type-modifiers.md b/website/src/content/docs/book/mapped-type-modifiers.md new file mode 100644 index 00000000..a7011ebd --- /dev/null +++ b/website/src/content/docs/book/mapped-type-modifiers.md @@ -0,0 +1,24 @@ +--- +title: Mapped Type Modifiers +sidebar: + order: 38 + label: 38. Mapped Type Modifiers +--- + + +Mapped Type Modifiers in TypeScript enable the transformation of properties within an existing type: + +* `readonly` or `+readonly`: This renders a property in the mapped type as read-only. +* `-readonly`: This allows a property in the mapped type to be mutable. +* `?`: This designates a property in the mapped type as optional. + +Examples: + +```typescript +type ReadOnly = { readonly [P in keyof T]: T[P] }; // All properties marked as read-only + +type Mutable = { -readonly [P in keyof T]: T[P] }; // All properties marked as mutable + +type MyPartial = { [P in keyof T]?: T[P] }; // All properties marked as optional +``` + diff --git a/website/src/content/docs/book/mapped-types.md b/website/src/content/docs/book/mapped-types.md new file mode 100644 index 00000000..eb2be1ba --- /dev/null +++ b/website/src/content/docs/book/mapped-types.md @@ -0,0 +1,28 @@ +--- +title: Mapped Types +sidebar: + order: 37 + label: 37. Mapped Types +--- + + +Mapped Types in TypeScript allow you to create new types based on an existing type by transforming each property using a mapping function. By mapping existing types, you can create new types that represent the same information in a different format. To create a mapped type, you access the properties of an existing type using the `keyof` operator and then alter them to produce a new type. +In the following example: + +```typescript +type MyMappedType = { + [P in keyof T]: T[P][]; +}; +type MyType = { + foo: string; + bar: number; +}; +type MyNewType = MyMappedType; +const x: MyNewType = { + foo: ['hello', 'world'], + bar: [1, 2, 3], +}; +``` + +we define MyMappedType to map over T's properties, creating a new type with each property as an array of its original type. Using this, we create MyNewType to represent the same info as MyType, but with each property as an array. + diff --git a/website/src/content/docs/book/merging-and-extension.md b/website/src/content/docs/book/merging-and-extension.md new file mode 100644 index 00000000..22266436 --- /dev/null +++ b/website/src/content/docs/book/merging-and-extension.md @@ -0,0 +1,50 @@ +--- +title: Merging and Extension +sidebar: + order: 52 + label: 52. Merging and Extension +--- + + +Merging and extension refer to two different concepts related to working with types and interfaces. + +Merging allows you to combine multiple declarations of the same name into a single definition, for example, when you define an interface with the same name multiple times: + +```typescript +interface X { + a: string; +} + +interface X { + b: number; +} + +const person: X = { + a: 'a', + b: 7, +}; +``` + +Extension refers to the ability to extend or inherit from existing types or interfaces to create new ones. It is a mechanism to add additional properties or methods to an existing type without modifying its original definition. Example: + +```typescript +interface Animal { + name: string; + eat(): void; +} + +interface Bird extends Animal { + sing(): void; +} + +const dog: Bird = { + name: 'Bird 1', + eat() { + console.log('Eating'); + }, + sing() { + console.log('Singing'); + }, +}; +``` + diff --git a/website/src/content/docs/book/named-tuple-type-labeled.md b/website/src/content/docs/book/named-tuple-type-labeled.md new file mode 100644 index 00000000..f14f8158 --- /dev/null +++ b/website/src/content/docs/book/named-tuple-type-labeled.md @@ -0,0 +1,17 @@ +--- +title: Named Tuple Type (Labeled) +sidebar: + order: 29 + label: 29. Named Tuple Type (Labeled) +--- + + +Tuple types can include optional labels or names for each element. These labels are for readability and tooling assistance, and do not affect the operations you can perform with them. + +```typescript +type T = string; +type Tuple1 = [T, T]; +type Tuple2 = [a: T, b: T]; +type Tuple3 = [a: T, T]; // Named Tuple plus Anonymous Tuple +``` + diff --git a/website/src/content/docs/book/namespacing.md b/website/src/content/docs/book/namespacing.md new file mode 100644 index 00000000..b27a1f6a --- /dev/null +++ b/website/src/content/docs/book/namespacing.md @@ -0,0 +1,26 @@ +--- +title: Namespacing +sidebar: + order: 57 + label: 57. Namespacing +--- + + +In TypeScript, namespaces are used to organize code into logical containers, preventing naming collisions and providing a way to group related code together. +The usage of the `export` keywords allows access to the namespace in "outside" modules. + +```typescript +export namespace MyNamespace { + export interface MyInterface1 { + prop1: boolean; + } + export interface MyInterface2 { + prop2: string; + } +} + +const a: MyNamespace.MyInterface1 = { + prop1: true, +}; +``` + diff --git a/website/src/content/docs/book/narrowing.md b/website/src/content/docs/book/narrowing.md new file mode 100644 index 00000000..fe00ffe0 --- /dev/null +++ b/website/src/content/docs/book/narrowing.md @@ -0,0 +1,107 @@ +--- +title: Narrowing +sidebar: + order: 20 + label: 20. Narrowing +--- + + +TypeScript narrowing is the process of refining the type of a variable within a conditional block. This is useful when working with union types, where a variable can have more than one type. + +TypeScript recognizes several ways to narrow the type: + +### typeof type guards + +The typeof type guard is one specific type guard in TypeScript that checks the type of a variable based on its built-in JavaScript type. + +```typescript +const fn = (x: number | string) => { + if (typeof x === 'number') { + return x + 1; // x is number + } + return -1; +}; +``` + +### Truthiness narrowing + +Truthiness narrowing in TypeScript works by checking whether a variable is truthy or falsy to narrow its type accordingly. + +```typescript +const toUpperCase = (name: string | null) => { + if (name) { + return name.toUpperCase(); + } else { + return null; + } +}; +``` + +### Equality narrowing + +Equality narrowing in TypeScript works by checking whether a variable is equal to a specific value or not, to narrow its type accordingly. + +It is used in conjunction with `switch` statements and equality operators such as `===`, `!==`, `==`, and `!=` to narrow down types. + +```typescript +const checkStatus = (status: 'success' | 'error') => { + switch (status) { + case 'success': + return true; + case 'error': + return null; + } +}; +``` + +### In Operator narrowing + +The `in` Operator narrowing in TypeScript is a way to narrow the type of a variable based on whether a property exists within the variable's type. + +```typescript +type Dog = { + name: string; + breed: string; +}; + +type Cat = { + name: string; + likesCream: boolean; +}; + +const getAnimalType = (pet: Dog | Cat) => { + if ('breed' in pet) { + return 'dog'; + } else { + return 'cat'; + } +}; +``` + +### instanceof narrowing + +The `instanceof` operator narrowing in TypeScript is a way to narrow the type of a variable based on its constructor function, by checking if an object is an instance of a certain class or interface. + +```typescript +class Square { + constructor(public width: number) {} +} +class Rectangle { + constructor( + public width: number, + public height: number + ) {} +} +function area(shape: Square | Rectangle) { + if (shape instanceof Square) { + return shape.width * shape.width; + } else { + return shape.width * shape.height; + } +} +const square = new Square(5); +const rectangle = new Rectangle(5, 10); +console.log(area(square)); // 25 +console.log(area(rectangle)); // 50 +``` + diff --git a/website/src/content/docs/book/never-type.md b/website/src/content/docs/book/never-type.md new file mode 100644 index 00000000..67a28855 --- /dev/null +++ b/website/src/content/docs/book/never-type.md @@ -0,0 +1,47 @@ +--- +title: Never type +sidebar: + order: 47 + label: 47. Never type +--- + + +The `never` type represents values that never occur. It is used to denote functions or expressions that never return or throw an error. + +For instance an infinite loop: + +```typescript +const infiniteLoop = (): never => { + while (true) { + // do something + } +}; +``` + +Throwing an error: + +```typescript +const throwError = (message: string): never => { + throw new Error(message); +}; +``` + +The `never` type is useful in ensuring type safety and catching potential errors in your code. It helps TypeScript analyze and infer more precise types when used in combination with other types and control flow statements, for instance: + +```typescript +type Direction = 'up' | 'down'; +const move = (direction: Direction): void => { + switch (direction) { + case 'up': + // move up + break; + case 'down': + // move down + break; + default: + const exhaustiveCheck: never = direction; + throw new Error(`Unhandled direction: ${exhaustiveCheck}`); + } +}; +``` + diff --git a/website/src/content/docs/book/object-types.md b/website/src/content/docs/book/object-types.md new file mode 100644 index 00000000..698fe6cc --- /dev/null +++ b/website/src/content/docs/book/object-types.md @@ -0,0 +1,38 @@ +--- +title: Object Types +sidebar: + order: 27 + label: 27. Object Types +--- + + +In TypeScript, object types describe the shape of an object. They specify the names and types of the object's properties, as well as whether those properties are required or optional. + +In TypeScript, you can define object types in two primary ways: + +Interface which defines the shape of an object by specifying the names, types, and optionality of its properties. + +```typescript +interface User { + name: string; + age: number; + email?: string; +} +``` + +Type alias, similar to an interface, defines the shape of an object. However, it can also create a new custom type that is based on an existing type or a combination of existing types. This includes defining union types, intersection types, and other complex types. + +```typescript +type Point = { + x: number; + y: number; +}; +``` + +It also possible to define a type anonymously: + +```typescript +const sum = (x: { a: number; b: number }) => x.a + x.b; +console.log(sum({ a: 5, b: 1 })); +``` + diff --git a/website/src/content/docs/book/optional-properties.md b/website/src/content/docs/book/optional-properties.md new file mode 100644 index 00000000..9991df0b --- /dev/null +++ b/website/src/content/docs/book/optional-properties.md @@ -0,0 +1,27 @@ +--- +title: Optional Properties +sidebar: + order: 12 + label: 12. Optional Properties +--- + + +An object can specify Optional Properties by adding a question mark `?` to the end of the property name: + +```typescript +type X = { + a: number; + b?: number; // Optional +}; +``` + +It is possible to specify a default value when a property is optional" + +```typescript +type X = { + a: number; + b?: number; +}; +const x = ({ a, b = 100 }: X) => a + b; +``` + diff --git a/website/src/content/docs/book/others.md b/website/src/content/docs/book/others.md new file mode 100644 index 00000000..cf3eb8a9 --- /dev/null +++ b/website/src/content/docs/book/others.md @@ -0,0 +1,931 @@ +--- +title: Others +sidebar: + order: 61 + label: 61. Others +--- + + +### Errors and Exception Handling + +TypeScript allows you to catch and handle errors using standard JavaScript error handling mechanisms: + +Try-Catch-Finally Blocks: + +```typescript +try { + // Code that might throw an error +} catch (error) { + // Handle the error +} finally { + // Code that always executes, finally is optional +} +``` + +You can also handle different types of error: + +```typescript +try { + // Code that might throw different types of errors +} catch (error) { + if (error instanceof TypeError) { + // Handle TypeError + } else if (error instanceof RangeError) { + // Handle RangeError + } else { + // Handle other errors + } +} +``` + +Custom Error Types: + +It is possible to specify more specific error by extending on the Error `class`: + +```typescript +class CustomError extends Error { + constructor(message: string) { + super(message); + this.name = 'CustomError'; + } +} + +throw new CustomError('This is a custom error.'); +``` + +### Mixin classes + +Mixin classes allow you to combine and compose behavior from multiple classes into a single class. They provide a way to reuse and extend functionality without the need for deep inheritance chains. + +```typescript +abstract class Identifiable { + name: string = ''; + logId() { + console.log('id:', this.name); + } +} +abstract class Selectable { + selected: boolean = false; + select() { + this.selected = true; + console.log('Select'); + } + deselect() { + this.selected = false; + console.log('Deselect'); + } +} +class MyClass { + constructor() {} +} + +// Extend MyClass to include the behavior of Identifiable and Selectable +interface MyClass extends Identifiable, Selectable {} + +// Function to apply mixins to a class +function applyMixins(source: any, baseCtors: any[]) { + baseCtors.forEach(baseCtor => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { + let descriptor = Object.getOwnPropertyDescriptor( + baseCtor.prototype, + name + ); + if (descriptor) { + Object.defineProperty(source.prototype, name, descriptor); + } + }); + }); +} + +// Apply the mixins to MyClass +applyMixins(MyClass, [Identifiable, Selectable]); +let o = new MyClass(); +o.name = 'abc'; +o.logId(); +o.select(); +``` + +### Asynchronous Language Features + +As TypeScript is a superset of JavaScript, it has built-in asynchronous language features of JavaScript as: + +Promises: + +Promises are a way to handle asynchronous operations and their results using methods like `.then()` and `.catch()` to handle success and error conditions. + +To learn more: + +Async/await: + +Async/await keywords are a way to provide a more synchronous-looking syntax for working with Promises. The `async` keyword is used to define an asynchronous function, and the `await` keyword is used within an async function to pause execution until a Promise is resolved or rejected. + +To learn more: + + + +The following API are well supported in TypeScript: + +Fetch API: + + +Web Workers: + + +Shared Workers: + + +WebSocket: + + +### Iterators and Generators + +Both Interators and Generators are well supported in TypeScript. + +Iterators are objects that implement the iterator protocol, providing a way to access elements of a collection or sequence one by one. It is a structure that contains a pointer to the next element in the iteration. They have a `next()` method that returns the next value in the sequence along with a boolean indicating if the sequence is `done`. + +```typescript +class NumberIterator implements Iterable { + private current: number; + + constructor( + private start: number, + private end: number + ) { + this.current = start; + } + + public next(): IteratorResult { + if (this.current <= this.end) { + const value = this.current; + this.current++; + return { value, done: false }; + } else { + return { value: undefined, done: true }; + } + } + + [Symbol.iterator](): Iterator { + return this; + } +} + +const iterator = new NumberIterator(1, 3); + +for (const num of iterator) { + console.log(num); +} +``` + +Generators are special functions defined using the `function*` syntax that simplifies the creation of iterators. They use the `yield` keyword to define the sequence of values and automatically pause and resume execution when values are requested. + +Generators make it easier to create iterators and are especially useful for working with large or infinite sequences. + +Example: + +```typescript +function* numberGenerator(start: number, end: number): Generator { + for (let i = start; i <= end; i++) { + yield i; + } +} + +const generator = numberGenerator(1, 5); + +for (const num of generator) { + console.log(num); +} +``` + +TypeScript also supports async iterators and async Generators. + +To learn more: + + +### TsDocs JSDoc Reference + +When working with a JavaScript code base, it is possible to help TypeScript to infer the right Type by using JSDoc comments with additional annotation to provide type information. + +Example: + +```typescript +/** + * Computes the power of a given number + * @constructor + * @param {number} base – The base value of the expression + * @param {number} exponent – The exponent value of the expression + */ +function power(base: number, exponent: number) { + return Math.pow(base, exponent); +} +power(10, 2); // function power(base: number, exponent: number): number +``` + +Full documentation is provided to this link: + + +From version 3.7 it is possible to generate .d.ts type definitions from JavaScript JSDoc syntax. +More information can be found here: + + +### @types + +Packages under the @types organization are special package naming conventions used to provide type definitions for existing JavaScript libraries or modules. For instance using: + +```shell +npm install --save-dev @types/lodash +``` + +Will install the type definitions of `lodash` in your current project. + +To contribute to the type definitions of @types package, please submit a pull request to . + +### JSX + +JSX (JavaScript XML) is an extension to the JavaScript language syntax that allows you to write HTML-like code within your JavaScript or TypeScript files. It is commonly used in React to define the HTML structure. + +TypeScript extends the capabilities of JSX by providing type checking and static analysis. + +To use JSX you need to set the `jsx` compiler option in your `tsconfig.json` file. Two common configuration options: + +* "preserve": emit .jsx files with the JSX unchanged. This option tells TypeScript to keep the JSX syntax as-is and not transform it during the compilation process. You can use this option if you have a separate tool, like Babel, that handles the transformation. +* "react": enables TypeScript's built-in JSX transformation. React.createElement will be used. + +All options are available here: + + +### ES6 Modules + +TypeScript does support ES6 (ECMAScript 2015) and many subsequent versions. This means you can use ES6 syntax, such as arrow functions, template literals, classes, modules, destructuring, and more. + +To enable ES6 features in your project, you can specify the `target` property in the tsconfig.json. + +A configuration example: + +```json +{ + "compilerOptions": { + "target": "es6", + "module": "es6", + "moduleResolution": "node", + "sourceMap": true, + "outDir": "dist" + }, + "include": ["src"] +} +``` + +### ES7 Exponentiation Operator + +The exponentiation (`**`) operator computes the value obtained by raising the first operand to the power of the second operand. It functions similarly to `Math.pow()`, but with the added capability of accepting BigInts as operands. +TypeScript fully supports this operator using as `target` in your tsconfig.json file `es2016` or larger version. + +```typescript +console.log(2 ** (2 ** 2)); // 16 +``` + +### The for-await-of Statement + +This is a JavaScript feature fully supported in TypeScript which allows you to iterate over asynchronous iterable objects from target version es2018. + +```typescript +async function* asyncNumbers(): AsyncIterableIterator { + yield Promise.resolve(1); + yield Promise.resolve(2); + yield Promise.resolve(3); +} + +(async () => { + for await (const num of asyncNumbers()) { + console.log(num); + } +})(); +``` + +### New.target + +You can use in TypeScript the `new.target` meta-property which enables you to determine if a function or constructor was invoked using the new operator. It allows you to detect whether an object was created as a result of a constructor call. + +```typescript +class Parent { + constructor() { + console.log(new.target); // Logs the constructor function used to create an instance + } +} + +class Child extends Parent { + constructor() { + super(); + } +} + +const parentX = new Parent(); // [Function: Parent] +const child = new Child(); // [Function: Child] +``` + +### Dynamic Import Expressions + +It is possible to conditionally load modules or lazy load them on-demand using the ECMAScript proposal for dynamic import which is supported in TypeScript. + +The syntax for dynamic import expressions in TypeScript is as follows: + + +```typescript +async function renderWidget() { + const container = document.getElementById('widget'); + if (container !== null) { + const widget = await import('./widget'); // Dynamic import + widget.render(container); + } +} + +renderWidget(); +``` + +### "tsc –watch" + +This command starts a TypeScript compiler with `--watch` parameter, with the ability to automatically recompile TypeScript files whenever they are modified. + +```shell +tsc --watch +``` + +Starting from TypeScript version 4.9, file monitoring primarily relies on file system events, automatically resorting to polling if an event-based watcher cannot be established. + +### Non-null Assertion Operator (Postfix !) + +The Non-null Assertion Operator (Postfix !) also called Definite Assignment Assertions is a TypeScript feature that allows you to assert that a variable or property is not null or undefined, even if TypeScript's static type analysis suggests that it might be. With this feature it is possible to remove any explicit checking. + +```typescript +type Person = { + name: string; +}; + +const printName = (person?: Person) => { + console.log(`Name is ${person!.name}`); +}; +``` + +### Defaulted declarations + +Defaulted declarations are used when a variable or parameter is assigned a default value. This means that if no value is provided for that variable or parameter, the default value will be used instead. + +```typescript +function greet(name: string = 'Anonymous'): void { + console.log(`Hello, ${name}!`); +} +greet(); // Hello, Anonymous! +greet('John'); // Hello, John! +``` + +### Optional Chaining + +The optional chaining operator `?.` works like the regular dot operator (`.`) for accessing properties or methods. However, it gracefully handles null or undefined values by terminating the expression and returning `undefined`, instead of throwing an error. + +```typescript +type Person = { + name: string; + age?: number; + address?: { + street?: string; + city?: string; + }; +}; + +const person: Person = { + name: 'John', +}; + +console.log(person.address?.city); // undefined +``` + +### Nullish coalescing operator (??) + +The nullish coalescing operator `??` returns the right-hand side value if the left-hand side is `null` or `undefined`; otherwise, it returns the left-hand side value. + +```typescript +const foo = null ?? 'foo'; +console.log(foo); // foo + +const baz = 1 ?? 'baz'; +const baz2 = 0 ?? 'baz'; +console.log(baz); // 1 +console.log(baz2); // 0 +``` + +### Template Literal Types + +Template Literal Types allow to manipulate string value at type level and generate new string types based on existing ones. They are useful to create more expressive and precise types from string-based operations. + +```typescript +type Department = 'engineering' | 'hr'; +type Language = 'english' | 'spanish'; +type Id = `${Department}-${Language}-id`; // "engineering-english-id" | "engineering-spanish-id" | "hr-english-id" | "hr-spanish-id" +``` + +### Function overloading + +Function overloading allows you to define multiple function signatures for the same function name, each with different parameter types and return type. +When you call an overloaded function, TypeScript uses the provided arguments to determine the correct function signature: + +```typescript +function makeGreeting(name: string): string; +function makeGreeting(names: string[]): string[]; + +function makeGreeting(person: unknown): unknown { + if (typeof person === 'string') { + return `Hi ${person}!`; + } else if (Array.isArray(person)) { + return person.map(name => `Hi, ${name}!`); + } + throw new Error('Unable to greet'); +} + +makeGreeting('Simon'); +makeGreeting(['Simone', 'John']); +``` + +### Recursive Types + +A Recursive Type is a type that can refer to itself. This is useful for defining data structures that have a hierarchical or recursive structure (potentially infinite nesting), such as linked lists, trees, and graphs. + +```typescript +type ListNode = { + data: T; + next: ListNode | undefined; +}; +``` + +### Recursive Conditional Types + +It is possible to define complex type relationships using logic and recursion in TypeScript. +Let’s break it down in simple terms: + +Conditional Types: allows you to define types based on boolean conditions: + +```typescript +type CheckNumber = T extends number ? 'Number' : 'Not a number'; +type A = CheckNumber<123>; // 'Number' +type B = CheckNumber<'abc'>; // 'Not a number' +``` + +Recursion: means a type definition that refers to itself within its own definition: + +```typescript +type Json = string | number | boolean | null | Json[] | { [key: string]: Json }; + +const data: Json = { + prop1: true, + prop2: 'prop2', + prop3: { + prop4: [], + }, +}; +``` + +Recursive Conditional Types combine both conditional logic and recursion. It means that a type definition can depend on itself through conditional logic, creating complex and flexible type relationships. + +```typescript +type Flatten = T extends Array ? Flatten : T; + +type NestedArray = [1, [2, [3, 4], 5], 6]; +type FlattenedArray = Flatten; // 2 | 3 | 4 | 5 | 1 | 6 +``` + +### ECMAScript Module Support in Node.js + +Node.js added support for ECMAScript Modules starting from version 15.3.0, and TypeScript has had ECMAScript Module Support for Node.js since version 4.7. This support can be enabled by using the `module` property with the value `nodenext` in the tsconfig.json file. Here's an example: + +```json +{ + "compilerOptions": { + "module": "nodenext", + "outDir": "./lib", + "declaration": true + } +} +``` + +Node.js supports two file extensions for modules: `.mjs` for ES modules and `.cjs` for CommonJS modules. The equivalent file extensions in TypeScript are `.mts` for ES modules and `.cts` for CommonJS modules. When the TypeScript compiler transpiles these files to JavaScript, it will create `.mjs` and `.cjs` files. + +If you want to use ES modules in your project, you can set the `type` property to "module" in your package.json file. This instructs Node.js to treat the project as an ES module project. + +Additionally, TypeScript also supports type declarations in .d.ts files. These declaration files provide type information for libraries or modules written in TypeScript, allowing other developers to utilize them with TypeScript's type checking and auto-completion features. + +### Assertion Functions + +In TypeScript, assertion functions are functions that indicate the verification of a specific condition based on their return value. In their simplest form, an assert function examines a provided predicate and raises an error when the predicate evaluates to false. + +```typescript +function isNumber(value: unknown): asserts value is number { + if (typeof value !== 'number') { + throw new Error('Not a number'); + } +} +``` + +Or can be declared as function expression: + +```typescript +type AssertIsNumber = (value: unknown) => asserts value is number; +const isNumber: AssertIsNumber = value => { + if (typeof value !== 'number') { + throw new Error('Not a number'); + } +}; +``` + +Assertion functions share similarities with type guards. Type guards were initially introduced to perform runtime checks and ensure the type of a value within a specific scope. +Specifically, a type guard is a function that evaluates a type predicate and returns a boolean value indicating whether the predicate is true or false. This differs slightly from assertion functions,where the intention is to throw an error rather than returning false when the predicate is not satisfied. + +Example of type guard: + +```typescript +const isNumber = (value: unknown): value is number => typeof value === 'number'; +``` + +### Variadic Tuple Types + +Variadic Tuple Types are a features introduces in TypeScript version 4.0, let’s start to learn them by revise what is a tuple: + +A tuple type is an array which has a defined length, and were the type of each element is known: + +```typescript +type Student = [string, number]; +const [name, age]: Student = ['Simone', 20]; +``` + +The term "variadic" means indefinite arity (accept a variable number of arguments). + +A variadic tuple is a tuple type which has all the property as before but the exact shape is not defined yet: + +```typescript +type Bar = [boolean, ...T, number]; + +type A = Bar<[boolean]>; // [boolean, boolean, number] +type B = Bar<['a', 'b']>; // [boolean, 'a', 'b', number] +type C = Bar<[]>; // [boolean, number] +``` + +In the previous code we can see that the tuple shape is defined by the `T` generic passed in. + +Variadic tuples can accept multiple generics make them very flexible: + +```typescript +type Bar = [...T, boolean, ...G]; + +type A = Bar<[number], [string]>; // [number, boolean, string] +type B = Bar<['a', 'b'], [boolean]>; // ["a", "b", boolean, boolean] +``` + +With the new variadic tuples we can use: + +* The spreads in tuple type syntax can now be generic, so we can represent higher-order operation on tuples and arrays even when we do not know the actual types we are operating over. +* The rest elements can occur anywhere in a tuple. + +Example: + +```typescript +type Items = readonly unknown[]; + +function concat( + arr1: T, + arr2: U +): [...T, ...U] { + return [...arr1, ...arr2]; +} + +concat([1, 2, 3], ['4', '5', '6']); // [1, 2, 3, "4", "5", "6"] +``` + +### Boxed types + +Boxed types refer to the wrapper objects that are used to represent primitive types as objects. These wrapper objects provide additional functionality and methods that are not available directly on the primitive values. + +When you access a method like `charAt` or `normalize` on a `string` primitive, JavaScript wraps it in a `String` object, calls the method, and then throws the object away. + +Demonstration: + +```typescript +const originalNormalize = String.prototype.normalize; +String.prototype.normalize = function () { + console.log(this, typeof this); + return originalNormalize.call(this); +}; +console.log('\u0041'.normalize()); +``` + +TypeScript represents this differentiation by providing separate types for the primitives and their corresponding object wrappers: + +* string => String +* number => Number +* boolean => Boolean +* symbol => Symbol +* bigint => BigInt + +The boxed types are usually not needed. Avoid using boxed types and instead use type for the primitives, for instance `string` instead of `String`. + +### Covariance and Contravariance in TypeScript + +Covariance and Contravariance are used to describe how relationships work when dealing with inheritance or assignment of types. + +Covariance means that a type relationship preserves the direction of inheritance or assignment, so if a type A is a subtype of type B, then an array of type A is also considered a subtype of an array of type B. The important thing to note here is that the subtype relationship is maintained this means that Covariance accept subtype but doesn't accept supertype. + +Contravariance means that a type relationship reverses the direction of inheritance or assignment, so if a type A is a subtype of type B, then an array of type B is considered a subtype of an array of type A. The subtype relationship is reversed this means that Contravariance accept supertype but doesn't accept subtype. + +Notes: Bivariance means accept both supertype & subtype. + +Example: Let's say we have a space for all animals and a separate space just for dogs. + +In Covariance, you can put all the dogs in the animals space because dogs are a type of animal. But you cannot put all the animals in the dog space because there might be other animals mixed in. + +In Contravariance, you cannot put all the animals in the dogs space because the animals space might contain other animals as well. However, you can put all the dogs in the animal space because all dogs are also animals. + + +```typescript +// Covariance example +class Animal { + name: string; + constructor(name: string) { + this.name = name; + } +} + +class Dog extends Animal { + breed: string; + constructor(name: string, breed: string) { + super(name); + this.breed = breed; + } +} + +let animals: Animal[] = []; +let dogs: Dog[] = []; + +// Covariance allows assigning subtype (Dog) array to supertype (Animal) array +animals = dogs; +dogs = animals; // Invalid: Type 'Animal[]' is not assignable to type 'Dog[]' + +// Contravariance example +type Feed = (animal: T) => void; + +let feedAnimal: Feed = (animal: Animal) => { + console.log(`Animal name: ${animal.name}`); +}; + +let feedDog: Feed = (dog: Dog) => { + console.log(`Dog name: ${dog.name}, Breed: ${dog.breed}`); +}; + +// Contravariance allows assigning supertype (Animal) callback to subtype (Dog) callback +feedDog = feedAnimal; +feedAnimal = feedDog; // Invalid: Type 'Feed' is not assignable to type 'Feed'. +``` + +In TypeScript, type relationships for arrays are covariant, while type relationships for function parameters are contravariant. This means that TypeScript exhibits both covariance and contravariance, depending on the context. + +#### Optional Variance Annotations for Type Parameters + +As of TypeScript 4.7.0, we can use the `out` and `in` keywords to be specific about Variance annotation. + +For Covariant, use the `out` keyword: + +```typescript +type AnimalCallback = () => T; // T is Covariant here +``` + +And for Contravariant, use the `in` keyword: + +```typescript +type AnimalCallback = (value: T) => void; // T is Contravariance here +``` + +### Template String Pattern Index Signatures + +Template string pattern index signatures allow us to define flexible index signatures using template string patterns. This feature enables us to create objects that can be indexed with specific patterns of string keys, providing more control and specificity when accessing and manipulating properties. + +TypeScript from version 4.4 allows index signatures for symbols and template string patterns. + +```typescript +const uniqueSymbol = Symbol('description'); + +type MyKeys = `key-${string}`; + +type MyObject = { + [uniqueSymbol]: string; + [key: MyKeys]: number; +}; + +const obj: MyObject = { + [uniqueSymbol]: 'Unique symbol key', + 'key-a': 123, + 'key-b': 456, +}; + +console.log(obj[uniqueSymbol]); // Unique symbol key +console.log(obj['key-a']); // 123 +console.log(obj['key-b']); // 456 +``` + +### The satisfies Operator + +The `satisfies` allows you to check if a given type satisfies a specific interface or condition. In other words, it ensures that a type has all the required properties and methods of a specific interface. It is a way to ensure a variable fits into a definition of a type +Here is an example: + + +```typescript +type Columns = 'name' | 'nickName' | 'attributes'; + +type User = Record; + +// Type Annotation using `User` +const user: User = { + name: 'Simone', + nickName: undefined, + attributes: ['dev', 'admin'], +}; + +// In the following lines, TypeScript won't be able to infer properly +user.attributes?.map(console.log); // Property 'map' does not exist on type 'string | string[]'. Property 'map' does not exist on type 'string'. +user.nickName; // string | string[] | undefined + +// Type assertion using `as` +const user2 = { + name: 'Simon', + nickName: undefined, + attributes: ['dev', 'admin'], +} as User; + +// Here too, TypeScript won't be able to infer properly +user2.attributes?.map(console.log); // Property 'map' does not exist on type 'string | string[]'. Property 'map' does not exist on type 'string'. +user2.nickName; // string | string[] | undefined + +// Using `satisfies` operators we can properly infer the types now +const user3 = { + name: 'Simon', + nickName: undefined, + attributes: ['dev', 'admin'], +} satisfies User; + +user3.attributes?.map(console.log); // TypeScript infers correctly: string[] +user3.nickName; // TypeScript infers correctly: undefined +``` + +### Type-Only Imports and Export + +Type-Only Imports and Export allows you to import or export types without importing or exporting the values or functions associated with those types. This can be useful for reducing the size of your bundle. + +To use type-only imports, you can use the `import type` keyword. + +TypeScript permits using both declaration and implementation file extensions (.ts, .mts, .cts, and .tsx) in type-only imports, regardless of `allowImportingTsExtensions` settings. + +For example: + + +```typescript +import type { House } from './house.ts'; +``` + +The following are supported forms: + + +```typescript +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; +export type { T }; +export type { T } from './mod'; +``` + +### using declaration and Explicit Resource Management + +A `using` declaration is a block-scoped, immutable binding, similar to `const`, used for managing disposable resources. When initialized with a value, the `Symbol.dispose` method of that value is recorded and subsequently executed upon exiting the enclosing block scope. + +This is based on ECMAScript's Resource Management feature, which is useful for performing essential cleanup tasks after object creation, such as closing connections, deleting files, and releasing memory. + +Notes: + +* Due to its recent introduction in TypeScript version 5.2, most runtimes lack native support. You'll need polyfills for: `Symbol.dispose`, `Symbol.asyncDispose`, `DisposableStack`, `AsyncDisposableStack`, `SuppressedError`. +* Additionally, you will need to configure your tsconfig.json as follows: + +```json +{ + "compilerOptions": { + "target": "es2022", + "lib": ["es2022", "esnext.disposable", "dom"] + } +} +``` + +Example: + + +```typescript +//@ts-ignore +Symbol.dispose ??= Symbol('Symbol.dispose'); // Simple polify + +const doWork = (): Disposable => { + return { + [Symbol.dispose]: () => { + console.log('disposed'); + }, + }; +}; + +console.log(1); + +{ + using work = doWork(); // Resource is declared + console.log(2); +} // Resource is disposed (e.g., `work[Symbol.dispose]()` is evaluated) + +console.log(3); +``` + +The code will log: + +```shell +1 +2 +disposed +3 +``` + +A resource eligible for disposal must adhere to the `Disposable` interface: + +```typescript +// lib.esnext.disposable.d.ts +interface Disposable { + [Symbol.dispose](): void; +} +``` + +The `using` declarations record resource disposal operations in a stack, ensuring they are disposed in reverse order of declaration: + + +```typescript +{ + using j = getA(), + y = getB(); + using k = getC(); +} // disposes `C`, then `B`, then `A`. +``` + +Resources are guaranteed to be disposed, even if subsequent code or exceptions occur. This may lead to disposal potentially throwing an exception, possibly suppressing another. To retain information on suppressed errors, a new native exception, `SuppressedError`, is introduced. + +#### await using declaration + +An `await using` declaration handles an asynchronously disposable resource. The value must have a `Symbol.asyncDispose` method, which will be awaited at the block's end. + + +```typescript +async function doWorkAsync() { + await using work = doWorkAsync(); // Resource is declared +} // Resource is disposed (e.g., `await work[Symbol.asyncDispose]()` is evaluated) +``` + +For an asynchronously disposable resource, it must adhere to either the `Disposable` or `AsyncDisposable` interface: + +```typescript +// lib.esnext.disposable.d.ts +interface AsyncDisposable { + [Symbol.asyncDispose](): Promise; +} +``` + + +```typescript +//@ts-ignore +Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose'); // Simple polify + +class DatabaseConnection implements AsyncDisposable { + // A method that is called when the object is disposed asynchronously + [Symbol.asyncDispose]() { + // Close the connection and return a promise + return this.close(); + } + + async close() { + console.log('Closing the connection...'); + await new Promise(resolve => setTimeout(resolve, 1000)); + console.log('Connection closed.'); + } +} + +async function doWork() { + // Create a new connection and dispose it asynchronously when it goes out of scope + await using connection = new DatabaseConnection(); // Resource is declared + console.log('Doing some work...'); +} // Resource is disposed (e.g., `await connection[Symbol.asyncDispose]()` is evaluated) + +doWork(); +``` + +The code logs: + +```shell +Doing some work... +Closing the connection... +Connection closed. +``` + +The `using` and `await using` declarations are allowed in Statements: `for`, `for-in`, `for-of`, `for-await-of`, `switch`. diff --git a/website/src/content/docs/book/overloads.md b/website/src/content/docs/book/overloads.md new file mode 100644 index 00000000..931f4bab --- /dev/null +++ b/website/src/content/docs/book/overloads.md @@ -0,0 +1,56 @@ +--- +title: Overloads +sidebar: + order: 51 + label: 51. Overloads +--- + + +Function overloads in TypeScript allow you to define multiple function signatures for a single function name, enabling you to define functions that can be called in multiple ways. Here's an example: + +```typescript +// Overloads +function sayHi(name: string): string; +function sayHi(names: string[]): string[]; + +// Implementation +function sayHi(name: unknown): unknown { + if (typeof name === 'string') { + return `Hi, ${name}!`; + } else if (Array.isArray(name)) { + return name.map(name => `Hi, ${name}!`); + } + throw new Error('Invalid value'); +} + +sayHi('xx'); // Valid +sayHi(['aa', 'bb']); // Valid +``` + +Here's another example of using function overloads within a `class`: + +```typescript +class Greeter { + message: string; + + constructor(message: string) { + this.message = message; + } + + // overload + sayHi(name: string): string; + sayHi(names: string[]): ReadonlyArray; + + // implementation + sayHi(name: unknown): unknown { + if (typeof name === 'string') { + return `${this.message}, ${name}!`; + } else if (Array.isArray(name)) { + return name.map(name => `${this.message}, ${name}!`); + } + throw new Error('value is invalid'); + } +} +console.log(new Greeter('Hello').sayHi('Simon')); +``` + diff --git a/website/src/content/docs/book/predefined-conditional-types.md b/website/src/content/docs/book/predefined-conditional-types.md new file mode 100644 index 00000000..b909b327 --- /dev/null +++ b/website/src/content/docs/book/predefined-conditional-types.md @@ -0,0 +1,26 @@ +--- +title: Predefined Conditional Types +sidebar: + order: 42 + label: 42. Predefined Conditional Types +--- + + +In TypeScript, Predefined Conditional Types are built-in conditional types provided by the language. They are designed to perform common type transformations based on the characteristics of a given type. + +`Exclude`: This type removes all the types from Type that are assignable to ExcludedType. + +`Extract`: This type extracts all the types from Union that are assignable to Type. + +`NonNullable`: This type removes null and undefined from Type. + +`ReturnType`: This type extracts the return type of a function Type. + +`Parameters`: This type extracts the parameter types of a function Type. + +`Required`: This type makes all properties in Type required. + +`Partial`: This type makes all properties in Type optional. + +`Readonly`: This type makes all properties in Type readonly. + diff --git a/website/src/content/docs/book/primitive-types.md b/website/src/content/docs/book/primitive-types.md new file mode 100644 index 00000000..3c9e0710 --- /dev/null +++ b/website/src/content/docs/book/primitive-types.md @@ -0,0 +1,128 @@ +--- +title: Primitive Types +sidebar: + order: 10 + label: 10. Primitive Types +--- + + +TypeScript supports 7 primitive types. A primitive data type refers to a type that is not an object and does not have any methods associated with it. In TypeScript, all primitive types are immutable, meaning their values cannot be changed once they are assigned. + +### string + +The `string` primitive type stores textual data, and the value is always double or single-quoted. + +```typescript +const x: string = 'x'; +const y: string = 'y'; +``` + +Strings can span multiple lines if surrounded by the backtick (`) character: + +```typescript +let sentence: string = `xxx, + yyy`; +``` + +### boolean + +The `boolean` data type in TypeScript stores a binary value, either `true` or `false`. + +```typescript +const isReady: boolean = true; +``` + +### number + +A `number` data type in TypeScript is represented with a 64-bit floating point value. A `number` type can represent integers and fractions. +TypeScript also supports hexadecimal, binary, and octal, for instance: + +```typescript +const decimal: number = 10; +const hexadecimal: number = 0xa00d; // Hexadecimal starts with 0x +const binary: number = 0b1010; // Binary starts with 0b +const octal: number = 0o633; // Octal starts with 0o +``` + +### bigInt + +A `bigInt` represents numeric values that are very large (253 – 1) and cannot be represented with a `number`. + +A `bigInt` can be created by calling the built-in function `BigInt()` or by adding `n` to the end of any integer numeric literal: + +```typescript +const x: bigint = BigInt(9007199254740991); +const y: bigint = 9007199254740991n; +``` + +Notes: + +* `bigInt` values cannot be mixed with `number` and cannot be used with built-in `Math`, they must be coerced to the same type. +* `bigInt` values are available only if target configuration is ES2020 or higher. + +### Symbol + +Symbols are unique identifiers that can be used as property keys in objects to prevent naming conflicts. + +```typescript +type Obj = { + [sym: symbol]: number; +}; + +const a = Symbol('a'); +const b = Symbol('b'); +let obj: Obj = {}; +obj[a] = 123; +obj[b] = 456; + +console.log(obj[a]); // 123 +console.log(obj[b]); // 456 +``` + +### null and undefined + +`null` and `undefined` types both represent no value or the absence of any value. + +The `undefined` type means the value is not assigned or initialized or indicates an unintentional absence of value. + +The `null` type means that we know that the field does not have a value, so value is unavailable, it indicates an intentional absence of value. + +### Array + +An `array` is a data type that can store multiple values of the same type or not. It can be defined using the following syntax: + +```typescript +const x: string[] = ['a', 'b']; +const y: Array = ['a', 'b']; +const j: Array = ['a', 1, 'b', 2]; // Union +``` + +TypeScript supports readonly arrays using the following syntax: + + +```typescript +const x: readonly string[] = ['a', 'b']; // Readonly modifier +const y: ReadonlyArray = ['a', 'b']; +const j: ReadonlyArray = ['a', 1, 'b', 2]; +j.push('x'); // Invalid +``` + +TypeScript supports tuple and readonly tuple: + +```typescript +const x: [string, number] = ['a', 1]; +const y: readonly [string, number] = ['a', 1]; +``` + +### any + +The `any` data type represents literally "any" value, it is the default value when TypeScript cannot infer the type or is not specified. + +When using `any` TypeScript compiler skips the type checking so there is no type safety when `any` is being used. Generally do not use `any` to silence the compiler when an error occurs, instead focus on fixing the error as with using `any` it is possible to break contracts and we lose the benefits of TypeScript autocomplete. + +The `any` type could be useful during a gradual migration from JavaScript to TypeScript, as it can silence the compiler. + +For new projects use TypeScript configuration `noImplicitAny` which enables TypeScript to issue errors where `any` is used or inferred. + +The `any`type is usually a source of errors which can mask real problems with your types. Avoid using it as much as possible. + diff --git a/website/src/content/docs/book/readonly-properties.md b/website/src/content/docs/book/readonly-properties.md new file mode 100644 index 00000000..94538fac --- /dev/null +++ b/website/src/content/docs/book/readonly-properties.md @@ -0,0 +1,28 @@ +--- +title: Readonly Properties +sidebar: + order: 13 + label: 13. Readonly Properties +--- + + +Is it possible to prevent writing on a property by using the modifier `readonly`which makes sure that the property cannot be re-written but does not provide any guarantee of total immutability: + +```typescript +interface Y { + readonly a: number; +} + +type X = { + readonly a: number; +}; + +type J = Readonly<{ + a: number; +}>; + +type K = { + readonly [index: number]: string; +}; +``` + diff --git a/website/src/content/docs/book/strictnullchecks.md b/website/src/content/docs/book/strictnullchecks.md new file mode 100644 index 00000000..45134d24 --- /dev/null +++ b/website/src/content/docs/book/strictnullchecks.md @@ -0,0 +1,10 @@ +--- +title: strictNullChecks +sidebar: + order: 18 + label: 18. strictNullChecks +--- + + +`strictNullChecks` is a TypeScript compiler option that enforces strict null checking. When this option is enabled, variables and parameters can only be assigned `null` or `undefined` if they have been explicitly declared to be of that type using the union type `null` | `undefined`. If a variable or parameter is not explicitly declared as nullable, TypeScript will generate an error to prevent potential runtime errors. + diff --git a/website/src/content/docs/book/symbols.md b/website/src/content/docs/book/symbols.md new file mode 100644 index 00000000..51712f66 --- /dev/null +++ b/website/src/content/docs/book/symbols.md @@ -0,0 +1,27 @@ +--- +title: Symbols +sidebar: + order: 58 + label: 58. Symbols +--- + + +Symbols are a primitive data type that represents an immutable value which is guaranteed to be globally unique throughout the lifetime of the program. + +Symbols can be used as keys for object properties and provide a way to create non-enumerable properties. + +```typescript +const key1: symbol = Symbol('key1'); +const key2: symbol = Symbol('key2'); + +const obj = { + [key1]: 'value 1', + [key2]: 'value 2', +}; + +console.log(obj[key1]); // value 1 +console.log(obj[key2]); // value 2 +``` + +In WeakMaps and WeakSets, symbols are now permissible as keys. + diff --git a/website/src/content/docs/book/table-of-contents.md b/website/src/content/docs/book/table-of-contents.md new file mode 100644 index 00000000..4b8c218f --- /dev/null +++ b/website/src/content/docs/book/table-of-contents.md @@ -0,0 +1,218 @@ +--- +title: Table of Contents +sidebar: + order: 4 + label: 4. Table of Contents +--- + + + +- The Concise TypeScript Book + - Translations + - Downloads + - Table of Contents + - Introduction + - About the Author + - TypeScript Introduction + - What is TypeScript? + - Why TypeScript? + - TypeScript and JavaScript + - TypeScript Code Generation + - Modern JavaScript Now (Downleveling) + - Getting Started With TypeScript + - Installation + - Configuration + - TypeScript Configuration File ​​tsconfig.json + - target + - lib + - strict + - module + - moduleResolution + - esModuleInterop + - jsx + - skipLibCheck + - files + - include + - exclude + - importHelpers + - Migration to TypeScript Advice + - Exploring the Type System + - The TypeScript Language Service + - Structural Typing + - TypeScript Fundamental Comparison Rules + - Types as Sets + - Assign a type: Type Declarations and Type Assertions + - Type Declaration + - Type Assertion + - Ambient Declarations + - Property Checking and Excess Property Checking + - Weak Types + - Strict Object Literal Checking (Freshness) + - Type Inference + - More Advanced Inferences + - Type Widening + - Const + - Const Modifier on Type Parameters + - Const assertion + - Explicit Type Annotation + - Type Narrowing + - Conditions + - Throwing or returning + - Discriminated Union + - User-Defined Type Guards + - Primitive Types + - string + - boolean + - number + - bigInt + - Symbol + - null and undefined + - Array + - any + - Type Annotations + - Optional Properties + - Readonly Properties + - Index Signatures + - Extending Types + - Literal Types + - Literal Inference + - strictNullChecks + - Enums + - Numeric enums + - String enums + - Constant enums + - Reverse mapping + - Ambient enums + - Computed and constant members + - Narrowing + - typeof type guards + - Truthiness narrowing + - Equality narrowing + - In Operator narrowing + - instanceof narrowing + - Assignments + - Control Flow Analysis + - Type Predicates + - Discriminated Unions + - The never Type + - Exhaustiveness checking + - Object Types + - Tuple Type (Anonymous) + - Named Tuple Type (Labeled) + - Fixed Length Tuple + - Union Type + - Intersection Types + - Type Indexing + - Type from Value + - Type from Func Return + - Type from Module + - Mapped Types + - Mapped Type Modifiers + - Conditional Types + - Distributive Conditional Types + - infer Type Inference in Conditional Types + - Predefined Conditional Types + - Template Union Types + - Any type + - Unknown type + - Void type + - Never type + - Interface and Type + - Common Syntax + - Basic Types + - Objects and Interfaces + - Union and Intersection Types + - Built-in Type Primitives + - Common Built-in JS Objects + - Overloads + - Merging and Extension + - Differences between Type and Interface + - Class + - Class Common Syntax + - Constructor + - Private and Protected Constructors + - Access Modifiers + - Get \& Set + - Auto-Accessors in Classes + - this + - Parameter Properties + - Abstract Classes + - With Generics + - Decorators + - Class Decorators + - Property Decorator + - Method Decorator + - Getter and Setter Decorators + - Decorator Metadata + - Inheritance + - Statics + - Property initialization + - Method overloading + - Generics + - Generic Type + - Generic Classes + - Generic Constraints + - Generic contextual narrowing + - Erased Structural Types + - Namespacing + - Symbols + - Triple-Slash Directives + - Type Manipulation + - Creating Types from Types + - Indexed Access Types + - Utility Types + - Awaited\ + - Partial\ + - Required\ + - Readonly\ + - Record\ + - Pick\ + - Omit\ + - Exclude\ + - Extract\ + - NonNullable\ + - Parameters\ + - ConstructorParameters\ + - ReturnType\ + - InstanceType\ + - ThisParameterType\ + - OmitThisParameter\ + - ThisType\ + - Uppercase\ + - Lowercase\ + - Capitalize\ + - Uncapitalize\ + - Others + - Errors and Exception Handling + - Mixin classes + - Asynchronous Language Features + - Iterators and Generators + - TsDocs JSDoc Reference + - @types + - JSX + - ES6 Modules + - ES7 Exponentiation Operator + - The for-await-of Statement + - New.target + - Dynamic Import Expressions + - "tsc –watch" + - Non-null Assertion Operator (Postfix !) + - Defaulted declarations + - Optional Chaining + - Nullish coalescing operator (??) + - Template Literal Types + - Function overloading + - Recursive Types + - Recursive Conditional Types + - ECMAScript Module Support in Node.js + - Assertion Functions + - Variadic Tuple Types + - Boxed types + - Covariance and Contravariance in TypeScript + - Optional Variance Annotations for Type Parameters + - Template String Pattern Index Signatures + - The satisfies Operator + - Type-Only Imports and Export + - using declaration and Explicit Resource Management + - await using declaration + diff --git a/website/src/content/docs/book/template-union-types.md b/website/src/content/docs/book/template-union-types.md new file mode 100644 index 00000000..f4feb462 --- /dev/null +++ b/website/src/content/docs/book/template-union-types.md @@ -0,0 +1,16 @@ +--- +title: Template Union Types +sidebar: + order: 43 + label: 43. Template Union Types +--- + + +Template union types can be used to merge and manipulate text inside the type system for instance: + +```typescript +type Status = 'active' | 'inactive'; +type Products = 'p1' | 'p2'; +type ProductId = `id-${Products}-${Status}`; // "id-p1-active" | "id-p1-inactive" | "id-p2-active" | "id-p2-inactive" +``` + diff --git a/website/src/content/docs/book/the-concise-typescript-book.md b/website/src/content/docs/book/the-concise-typescript-book.md new file mode 100644 index 00000000..9380b70f --- /dev/null +++ b/website/src/content/docs/book/the-concise-typescript-book.md @@ -0,0 +1,16 @@ +--- +title: The Concise TypeScript Book +sidebar: + order: 1 + label: 1. The Concise TypeScript Book +--- + + +The Concise TypeScript Book provides a comprehensive and succinct overview of TypeScript's capabilities. It offers clear explanations covering all aspects found in the latest version of the language, from its powerful type system to advanced features. Whether you're a beginner or an experienced developer, this book is an invaluable resource to enhance your understanding and proficiency in TypeScript. + +This book is completely Free and Open Source. + +If you found this TypeScript book valuable and wish to contribute, consider supporting my efforts via PayPal. Thanks! + +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?business=QW82ZS956XLFY&no_recurring=0¤cy_code=EUR) + diff --git a/website/src/content/docs/book/the-never-type.md b/website/src/content/docs/book/the-never-type.md new file mode 100644 index 00000000..b1769095 --- /dev/null +++ b/website/src/content/docs/book/the-never-type.md @@ -0,0 +1,24 @@ +--- +title: The never Type +sidebar: + order: 25 + label: 25. The never Type +--- + + +When a variable is narrowed to a type that cannot contain any values, the TypeScript compiler will infer that the variable must be of the `never` type. This is because The never Type represents a value that can never be produced. + +```typescript +const printValue = (val: string | number) => { + if (typeof val === 'string') { + console.log(val.toUpperCase()); + } else if (typeof val === 'number') { + console.log(val.toFixed(2)); + } else { + // val has type never here because it can never be anything other than a string or a number + const neverVal: never = val; + console.log(`Unexpected value: ${neverVal}`); + } +}; +``` + diff --git a/website/src/content/docs/book/translations.md b/website/src/content/docs/book/translations.md new file mode 100644 index 00000000..50822e83 --- /dev/null +++ b/website/src/content/docs/book/translations.md @@ -0,0 +1,12 @@ +--- +title: Translations +sidebar: + order: 2 + label: 2. Translations +--- + + +This book has been translated into several language versions, including: + +* [Chinese](./README-zh_CN.md) + diff --git a/website/src/content/docs/book/triple-slash-directives.md b/website/src/content/docs/book/triple-slash-directives.md new file mode 100644 index 00000000..59db88dc --- /dev/null +++ b/website/src/content/docs/book/triple-slash-directives.md @@ -0,0 +1,33 @@ +--- +title: Triple-Slash Directives +sidebar: + order: 59 + label: 59. Triple-Slash Directives +--- + + +Triple-slash directives are special comments that provide instructions to the compiler about how to process a file. These directives begin with three consecutive slashes (`///`) and are typically placed at the top of a TypeScript file and have no effects on the runtime behavior. + +Triple-slash directives are used to reference external dependencies, specify module loading behavior, enable/disable certain compiler features, and more. Few examples: + +Referencing a declaration file: + + +```typescript +/// +``` + +Indicate the module format: + + +```typescript +/// +``` + +Enable compiler options, in the following example strict mode: + + +```typescript +/// +``` + diff --git a/website/src/content/docs/book/tuple-type-anonymous.md b/website/src/content/docs/book/tuple-type-anonymous.md new file mode 100644 index 00000000..abf732c3 --- /dev/null +++ b/website/src/content/docs/book/tuple-type-anonymous.md @@ -0,0 +1,14 @@ +--- +title: Tuple Type (Anonymous) +sidebar: + order: 28 + label: 28. Tuple Type (Anonymous) +--- + + +A Tuple Type is a type that represents an array with a fixed number of elements and their corresponding types. A tuple type enforces a specific number of elements and their respective types in a fixed order. Tuple types are useful when you want to represent a collection of values with specific types, where the position of each element in the array has a specific meaning. + +```typescript +type Point = [number, number]; +``` + diff --git a/website/src/content/docs/book/type-annotations.md b/website/src/content/docs/book/type-annotations.md new file mode 100644 index 00000000..c8ce3d2c --- /dev/null +++ b/website/src/content/docs/book/type-annotations.md @@ -0,0 +1,46 @@ +--- +title: Type Annotations +sidebar: + order: 11 + label: 11. Type Annotations +--- + + +On variables declared using `var`, `let` and `const`, it is possible to optionally add a type: + +```typescript +const x: number = 1; +``` + +TypeScript does a good job of inferring types, especially when simple one, so these declarations in most cases are not necessary. + +On functions is possible to add type annotations to parameters: + +```typescript +function sum(a: number, b: number) { + return a + b; +} +``` + +The following is an example using a anonymous functions (so called lambda function): + +```typescript +const sum = (a: number, b: number) => a + b; +``` + +These annotation can be avoided when a default value for a parameter is present: + +```typescript +const sum = (a = 10, b: number) => a + b; +``` + +Return type annotations can be added to functions: + +```typescript +const sum = (a = 10, b: number): number => a + b; +``` + +This is useful especially for more complex functions as writing expliciting the return type before an implementation can help better think about the function. + +Generally consider annotating type signatures but not the body local variables and add types always to object literals. + diff --git a/website/src/content/docs/book/type-from-func-return.md b/website/src/content/docs/book/type-from-func-return.md new file mode 100644 index 00000000..d7b5acb2 --- /dev/null +++ b/website/src/content/docs/book/type-from-func-return.md @@ -0,0 +1,14 @@ +--- +title: Type from Func Return +sidebar: + order: 35 + label: 35. Type from Func Return +--- + + +Type from Func Return refers to the ability to automatically infer the return type of a function based on its implementation. This allows TypeScript to determine the type of the value returned by the function without explicit type annotations. + +```typescript +const add = (x: number, y: number) => x + y; // TypeScript can infer that the return type of the function is a number +``` + diff --git a/website/src/content/docs/book/type-from-module.md b/website/src/content/docs/book/type-from-module.md new file mode 100644 index 00000000..72eebd21 --- /dev/null +++ b/website/src/content/docs/book/type-from-module.md @@ -0,0 +1,19 @@ +--- +title: Type from Module +sidebar: + order: 36 + label: 36. Type from Module +--- + + +Type from Module refers to the ability to use a module's exported values to automatically infer their types. When a module exports a value with a specific type, TypeScript can use that information to automatically infer the type of that value when it is imported into another module. + + +```typescript +// calc.ts +export const add = (x: number, y: number) => x + y; +// index.ts +import { add } from 'calc'; +const r = add(1, 2); // r is number +``` + diff --git a/website/src/content/docs/book/type-from-value.md b/website/src/content/docs/book/type-from-value.md new file mode 100644 index 00000000..14331090 --- /dev/null +++ b/website/src/content/docs/book/type-from-value.md @@ -0,0 +1,14 @@ +--- +title: Type from Value +sidebar: + order: 34 + label: 34. Type from Value +--- + + +Type from Value in TypeScript refers to the automatic inference of a type from a value or expression through type inference. + +```typescript +const x = 'x'; // TypeScript can automatically infer that the type of the message variable is string +``` + diff --git a/website/src/content/docs/book/type-indexing.md b/website/src/content/docs/book/type-indexing.md new file mode 100644 index 00000000..e10d1a52 --- /dev/null +++ b/website/src/content/docs/book/type-indexing.md @@ -0,0 +1,18 @@ +--- +title: Type Indexing +sidebar: + order: 33 + label: 33. Type Indexing +--- + + +Type indexing refers to the ability to define types that can be indexed by a key that is not known in advance, using an index signature to specify the type for properties that are not explicitly declared. + +```typescript +type Dictionary = { + [key: string]: T; +}; +const myDict: Dictionary = { a: 'a', b: 'b' }; +console.log(myDict['a']); // Returns a +``` + diff --git a/website/src/content/docs/book/type-manipulation.md b/website/src/content/docs/book/type-manipulation.md new file mode 100644 index 00000000..846436cb --- /dev/null +++ b/website/src/content/docs/book/type-manipulation.md @@ -0,0 +1,335 @@ +--- +title: Type Manipulation +sidebar: + order: 60 + label: 60. Type Manipulation +--- + + +### Creating Types from Types + +Is it possible to create new types composing, manipulating or transforming existing types. + +Intersection Types (`&`): + +Allow you to combine multiple types into a single type: + +```typescript +type A = { foo: number }; +type B = { bar: string }; +type C = A & B; // Intersection of A and B +const obj: C = { foo: 42, bar: 'hello' }; +``` + +Union Types (`|`): + +Allow you to define a type that can be one of several types: + +```typescript +type Result = string | number; +const value1: Result = 'hello'; +const value2: Result = 42; +``` + +Mapped Types: + +Allow you to transform the properties of an existing type to create new type: + +```typescript +type Mutable = { + readonly [P in keyof T]: T[P]; +}; +type Person = { + name: string; + age: number; +}; +type ImmutablePerson = Mutable; // Properties become read-only +``` + +Conditional types: + +Allow you to create types based on some conditions: + +```typescript +type ExtractParam = T extends (param: infer P) => any ? P : never; +type MyFunction = (name: string) => number; +type ParamType = ExtractParam; // string +``` + +### Indexed Access Types + +In TypeScript is it possible to access and manipulate the types of properties within another type using an index, `Type[Key]`. + +```typescript +type Person = { + name: string; + age: number; +}; + +type AgeType = Person['age']; // number +``` + +```typescript +type MyTuple = [string, number, boolean]; +type MyType = MyTuple[2]; // boolean +``` + +### Utility Types + +Several built-in utility types can be used to manipulate types, below a list of the most common used: + +#### Awaited\ + +Constructs a type recursively unwrap Promises. + +```typescript +type A = Awaited>; // string +``` + +#### Partial\ + +Constructs a type with all properties of T set to optional. + +```typescript +type Person = { + name: string; + age: number; +}; + +type A = Partial; // { name?: string | undefined; age?: number | undefined; } +``` + +#### Required\ + +Constructs a type with all properties of T set to required. + +```typescript +type Person = { + name?: string; + age?: number; +}; + +type A = Required; // { name: string; age: number; } +``` + +#### Readonly\ + +Constructs a type with all properties of T set to readonly. + + +```typescript +type Person = { + name: string; + age: number; +}; + +type A = Readonly; + +const a: A = { name: 'Simon', age: 17 }; +a.name = 'John'; // Invalid +``` + +#### Record\ + +Constructs a type with a set of properties K of type T. + +```typescript +type Product = { + name: string; + price: number; +}; + +const products: Record = { + apple: { name: 'Apple', price: 0.5 }, + banana: { name: 'Banana', price: 0.25 }, +}; + +console.log(products.apple); // { name: 'Apple', price: 0.5 } +``` + +#### Pick\ + +Constructs a type by picking the specified properties K from T. + +```typescript +type Product = { + name: string; + price: number; +}; + +type Price = Pick; // { price: number; } +``` + +#### Omit\ + +Constructs a type by omitting the specified properties K from T. + +```typescript +type Product = { + name: string; + price: number; +}; + +type Name = Omit; // { name: string; } +``` + +#### Exclude\ + +Constructs a type by excluding all values of type U from T. + +```typescript +type Union = 'a' | 'b' | 'c'; +type MyType = Exclude; // b +``` + +#### Extract\ + +Constructs a type by extracting all values of type U from T. + +```typescript +type Union = 'a' | 'b' | 'c'; +type MyType = Extract; // a | c +``` + +#### NonNullable\ + +Constructs a type by excluding null and undefined from T. + +```typescript +type Union = 'a' | null | undefined | 'b'; +type MyType = NonNullable; // 'a' | 'b' +``` + +#### Parameters\ + +Extracts the parameter types of a function type T. + +```typescript +type Func = (a: string, b: number) => void; +type MyType = Parameters; // [a: string, b: number] +``` + +#### ConstructorParameters\ + +Extracts the parameter types of a constructor function type T. + +```typescript +class Person { + constructor( + public name: string, + public age: number + ) {} +} +type PersonConstructorParams = ConstructorParameters; // [name: string, age: number] +const params: PersonConstructorParams = ['John', 30]; +const person = new Person(...params); +console.log(person); // Person { name: 'John', age: 30 } +``` + +#### ReturnType\ + +Extracts the return type of a function type T. + +```typescript +type Func = (name: string) => number; +type MyType = ReturnType; // number +``` + +#### InstanceType\ + +Extracts the instance type of a class type T. + +```typescript +class Person { + name: string; + + constructor(name: string) { + this.name = name; + } + + sayHello() { + console.log(`Hello, my name is ${this.name}!`); + } +} + +type PersonInstance = InstanceType; + +const person: PersonInstance = new Person('John'); + +person.sayHello(); // Hello, my name is John! +``` + +#### ThisParameterType\ + +Extracts the type of 'this' parameter from a function type T. + +```typescript +interface Person { + name: string; + greet(this: Person): void; +} +type PersonThisType = ThisParameterType; // Person +``` + +#### OmitThisParameter\ + +Removes the 'this' parameter from a function type T. + +```typescript +function capitalize(this: String) { + return this[0].toUpperCase + this.substring(1).toLowerCase(); +} + +type CapitalizeType = OmitThisParameter; // () => string +``` + +#### ThisType\ + +Servers as a market for a contextual `this` type. + + +```typescript +type Logger = { + log: (error: string) => void; +}; + +let helperFunctions: { [name: string]: Function } & ThisType = { + hello: function () { + this.log('some error'); // Valid as "log" is a part of "this". + this.update(); // Invalid + }, +}; +``` + +#### Uppercase\ + +Make uppercase the name of the input type T. + +```typescript +type MyType = Uppercase<'abc'>; // "ABC" +``` + +#### Lowercase\ + +Make lowercase the name of the input type T. + +```typescript +type MyType = Lowercase<'ABC'>; // "abc" +``` + +#### Capitalize\ + +Capitalize the name of the input type T. + +```typescript +type MyType = Capitalize<'abc'>; // "Abc" +``` + +#### Uncapitalize\ + +Uncapitalize the name of the input type T. + +```typescript +type MyType = Uncapitalize<'Abc'>; // "abc" +``` + diff --git a/website/src/content/docs/book/type-predicates.md b/website/src/content/docs/book/type-predicates.md new file mode 100644 index 00000000..72fb3869 --- /dev/null +++ b/website/src/content/docs/book/type-predicates.md @@ -0,0 +1,22 @@ +--- +title: Type Predicates +sidebar: + order: 23 + label: 23. Type Predicates +--- + + +Type Predicates in TypeScript are functions that return a boolean value and are used to narrow the type of a variable to a more specific type. + +```typescript +const isString = (value: unknown): value is string => typeof value === 'string'; + +const foo = (bar: unknown) => { + if (isString(bar)) { + console.log(bar.toUpperCase()); + } else { + console.log('not a string'); + } +}; +``` + diff --git a/website/src/content/docs/book/typescript-introduction.md b/website/src/content/docs/book/typescript-introduction.md new file mode 100644 index 00000000..813944da --- /dev/null +++ b/website/src/content/docs/book/typescript-introduction.md @@ -0,0 +1,219 @@ +--- +title: TypeScript Introduction +sidebar: + order: 7 + label: 7. TypeScript Introduction +--- + + +### What is TypeScript? + +TypeScript is a strongly typed programming language that builds on JavaScript. It was originally designed by Anders Hejlsberg in 2012 and is currently developed and maintained by Microsoft as an open source project. + +TypeScript compiles to JavaScript and can be executed in any JavaScript engine (e.g., a browser or server Node.js). + +TypeScript supports multiple programming paradigms such as functional, generic, imperative, and object-oriented. TypeScript is neither an interpreted nor a compiled language. + +### Why TypeScript? + +TypeScript is a strongly typed language that helps prevent common programming mistakes and avoid certain kinds of run-time errors before the program is executed. + +A strongly typed language allows the developer to specify various program constraints and behaviors in the data type definitions, facilitating the ability to verify the correctness of the software and prevent defects. This is especially valuable in large-scale applications. + +Some of the benefits of TypeScript: + +* Static typing, optionally strongly typed +* Type Inference +* Access to ES6 and ES7 features +* Cross-Platform and Cross-browser Compatibility +* Tooling support with IntelliSense + +### TypeScript and JavaScript + +TypeScript is written in `.ts` or `.tsx` files, while JavaScript files are written in `.js` or `.jsx`. + +Files with the extension `.tsx` or `.jsx` can contain JavaScript Syntax Extension JSX, which is used in React for UI development. + +TypeScript is a typed superset of JavaScript (ECMAScript 2015) in terms of syntax. All JavaScript code is valid TypeScript code, but the reverse is not always true. + +For instance, consider a function in a JavaScript file with the `.js` extension, such as the following: + + +```typescript +const sum = (a, b) => a + b; +``` + +The function can be converted and used in TypeScript by changing the file extension to `.ts`. However, if the same function is annotated with TypeScript types, it cannot be executed in any JavaScript engine without compilation. The following TypeScript code will produce a syntax error if it is not compiled: + + +```typescript +const sum = (a: number, b: number): number => a + b; +``` + +TypeScript was designed to detect possible exceptions that can occur at runtime during compilation time by having the developer define the intent with type annotations. In addition, TypeScript can also catch issues if no type annotation is provided. For instance, the following code snippet does not specify any TypeScript types: + + +```typescript +const items = [{ x: 1 }, { x: 2 }]; +const result = items.filter(item => item.y); +``` + +In this case, TypeScript detects an error and reports: + +```text +Property 'y' does not exist on type '{ x: number; }'. +``` + +TypeScript's type system is largely influenced by the runtime behavior of JavaScript. For example, the addition operator (+), which in JavaScript can either perform string concatenation or numeric addition, is modeled in the same way in TypeScript: + +```typescript +const result = '1' + 1; // Result is of type string +``` + +The team behind TypeScript has made a deliberate decision to flag unusual usage of JavaScript as errors. For instance, consider the following valid JavaScript code: + + +```typescript +const result = 1 + true; // In JavaScript, the result is equal 2 +``` + +However, TypeScript throws an error: + +```text +Operator '+' cannot be applied to types 'number' and 'boolean'. +``` + +This error occurs because TypeScript strictly enforces type compatibility, and in this case, it identifies an invalid operation between a number and a boolean. + +### TypeScript Code Generation + +The TypeScript compiler has two main responsibilities: checking for type errors and compiling to JavaScript. These two processes are independent of each other. Types do not affect the execution of the code in a JavaScript engine, as they are completely erased during compilation. TypeScript can still output JavaScript even in the presence of type errors. +Here is an example of TypeScript code with a type error: + + +```typescript +const add = (a: number, b: number): number => a + b; +const result = add('x', 'y'); // Argument of type 'string' is not assignable to parameter of type 'number'. +``` + +However, it can still produce executable JavaScript output: + + +```typescript +'use strict'; +const add = (a, b) => a + b; +const result = add('x', 'y'); // xy +``` + +It is not possible to check TypeScript types at runtime. For example: + + +```typescript +interface Animal { + name: string; +} +interface Dog extends Animal { + bark: () => void; +} +interface Cat extends Animal { + meow: () => void; +} +const makeNoise = (animal: Animal) => { + if (animal instanceof Dog) { + // 'Dog' only refers to a type, but is being used as a value here. + // ... + } +}; +``` + +As the types are erased after compilation, there is no way to run this code in JavaScript. To recognize types at runtime, we need to use another mechanism. TypeScript provides several options, with a common one being "tagged union". For example: + +```typescript +interface Dog { + kind: 'dog'; // Tagged union + bark: () => void; +} +interface Cat { + kind: 'cat'; // Tagged union + meow: () => void; +} +type Animal = Dog | Cat; + +const makeNoise = (animal: Animal) => { + if (animal.kind === 'dog') { + animal.bark(); + } else { + animal.meow(); + } +}; + +const dog: Dog = { + kind: 'dog', + bark: () => console.log('bark'), +}; +makeNoise(dog); +``` + +The property "kind" is a value that can be used at runtime to distinguish between objects in JavaScript. + +It is also possible for a value at runtime to have a type different from the one declared in the type declaration. For instance, if the developer has misinterpreted an API type and annotated it incorrectly. + +TypeScript is a superset of JavaScript, so the "class" keyword can be used as a type and value at runtime. + +```typescript +class Animal { + constructor(public name: string) {} +} +class Dog extends Animal { + constructor( + public name: string, + public bark: () => void + ) { + super(name); + } +} +class Cat extends Animal { + constructor( + public name: string, + public meow: () => void + ) { + super(name); + } +} +type Mammal = Dog | Cat; + +const makeNoise = (mammal: Mammal) => { + if (mammal instanceof Dog) { + mammal.bark(); + } else { + mammal.meow(); + } +}; + +const dog = new Dog('Fido', () => console.log('bark')); +makeNoise(dog); +``` + +In JavaScript, a "class" has a "prototype" property, and the "instanceof" operator can be used to test if the prototype property of a constructor appears anywhere in the prototype chain of an object. + +TypeScript has no effect on runtime performance, as all types will be erased. However, TypeScript does introduce some build time overhead. + +### Modern JavaScript Now (Downleveling) + +TypeScript can compile code to any released version of JavaScript since ECMAScript 3 (1999). This means that TypeScript can transpile code from the latest JavaScript features to older versions, a process known as Downleveling. This allows the usage of modern JavaScript while maintaining maximum compatibility with older runtime environments. + +It's important to note that during transpilation to an older version of JavaScript, TypeScript may generate code that could incur a performance overhead compared to native implementations. + +Here are some of the modern JavaScript features that can be used in TypeScript: + +* ECMAScript modules instead of AMD-style "define" callbacks or CommonJS "require" statements. +* Classes instead of prototypes. +* Variables declaration using "let" or "const" instead of "var". +* "for-of" loop or ".forEach" instead of the traditional "for" loop. +* Arrow functions instead of function expressions. +* Destructuring assignment. +* Shorthand property/method names and computed property names. +* Default function parameters. + +By leveraging these modern JavaScript features, developers can write more expressive and concise code in TypeScript. + diff --git a/website/src/content/docs/book/union-type.md b/website/src/content/docs/book/union-type.md new file mode 100644 index 00000000..2c875f5c --- /dev/null +++ b/website/src/content/docs/book/union-type.md @@ -0,0 +1,16 @@ +--- +title: Union Type +sidebar: + order: 31 + label: 31. Union Type +--- + + +A Union Type is a type that represents a value that can be one of several types. Union Types are denoted using the `|` symbol between each possible type. + +```typescript +let x: string | number; +x = 'hello'; // Valid +x = 123; // Valid +``` + diff --git a/website/src/content/docs/book/unknown-type.md b/website/src/content/docs/book/unknown-type.md new file mode 100644 index 00000000..b4957223 --- /dev/null +++ b/website/src/content/docs/book/unknown-type.md @@ -0,0 +1,29 @@ +--- +title: Unknown type +sidebar: + order: 45 + label: 45. Unknown type +--- + + +In TypeScript, the `unknown` type represents a value that is of an unknown type. Unlike `any` type, which allows for any type of value, `unknown` requires a type check or assertion before it can be used in a specific way so no operations are permitted on an `unknown` without first asserting or narrowing to a more specific type. + +The `unknown` type is only assignable to any type and the `unknown` type itself, it is a type-safe alternative to `any`. + + +```typescript +let value: unknown; + +let value1: unknown = value; // Valid +let value2: any = value; // Valid +let value3: boolean = value; // Invalid +let value4: number = value; // Invalid +``` + +```typescript +const add = (a: unknown, b: unknown): number | undefined => + typeof a === 'number' && typeof b === 'number' ? a + b : undefined; +console.log(add(1, 2)); // 3 +console.log(add('x', 2)); // undefined +``` + diff --git a/website/src/content/docs/book/void-type.md b/website/src/content/docs/book/void-type.md new file mode 100644 index 00000000..4c1b03df --- /dev/null +++ b/website/src/content/docs/book/void-type.md @@ -0,0 +1,16 @@ +--- +title: Void type +sidebar: + order: 46 + label: 46. Void type +--- + + +The `void` type is used to indicate that a function does not return a value. + +```typescript +const sayHello = (): void => { + console.log('Hello!'); +}; +``` + diff --git a/website/src/content/docs/index.mdx b/website/src/content/docs/index.mdx new file mode 100644 index 00000000..a20e1792 --- /dev/null +++ b/website/src/content/docs/index.mdx @@ -0,0 +1,20 @@ +--- +title: Typescript Book +description: The Concise TypeScript Book +template: splash +hero: + tagline: The Concise TypeScript Book provides a comprehensive and succinct overview of TypeScript's capabilities. It offers clear explanations covering all aspects found in the latest version of the language, from its powerful type system to advanced features. Whether you're a beginner or an experienced developer, this book is an invaluable resource to enhance your understanding and proficiency in TypeScript.

This book is completely Free and Open Source. + actions: + - text: Read now! + link: /book/the-concise-typescript-book/ + icon: right-arrow + variant: primary + - text: GitHub + link: https://github.com/gibbok/typescript-book + icon: github + variant: secondary + - text: X.com + link: https://twitter.com/gibbok_coding + icon: x.com + variant: secondary +--- diff --git a/website/src/content/docs/zh-cn/book/about-the-author.md b/website/src/content/docs/zh-cn/book/about-the-author.md new file mode 100644 index 00000000..42277043 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/about-the-author.md @@ -0,0 +1,17 @@ +--- +title: 关于作者 +sidebar: + order: 6 + label: 6. 关于作者 +--- + + +Simone Poggiali 是一位经验丰富的高级前端开发人员,自 90 年代以来就热衷于编写专业级代码。在他的国际职业生涯中,他为从初创公司到大型组织的广泛客户提供了众多项目。HelloFresh、Siemens、O2 和 Leroy Merlin 等著名公司都受益于他的专业知识和奉献精神。 + +您可以通过以下平台联系 Simone Poggiali: + +* 领英: +* GitHub: +* 推特: +* 电子邮箱: gibbok.coding📧gmail.com + diff --git a/website/src/content/docs/zh-cn/book/any-type.md b/website/src/content/docs/zh-cn/book/any-type.md new file mode 100644 index 00000000..8723c683 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/any-type.md @@ -0,0 +1,22 @@ +--- +title: 任意类型 +sidebar: + order: 44 + label: 44. 任意类型 +--- + + +`any` 类型是一种特殊类型(通用超类型),可用于表示任何类型的值(基元、对象、数组、函数、错误、符号)。它通常用于编译时未知值类型的情况,或者使用来自没有 TypeScript 类型的外部 API 或库的值时。 + +通过使用任何类型,您向 TypeScript 编译器指示值应该不受任何限制地表示。为了最大限度地提高代码中的类型安全性,请考虑以下事项: + +* 将 `any` 的使用限制在类型确实未知的特定情况下。 +* 不要从函数返回 `any` 类型,因为使用该函数会在代码中失去类型安全性,从而削弱类型安全性。 +* 如果您需要使编译器保持沉默,请使用 `@ts-ignore` 而不是 `any`。 + +```typescript +let value: any; +value = true; // 有效 +value = 7; // 有效 +``` + diff --git a/website/src/content/docs/zh-cn/book/assignments.md b/website/src/content/docs/zh-cn/book/assignments.md new file mode 100644 index 00000000..24a29a9f --- /dev/null +++ b/website/src/content/docs/zh-cn/book/assignments.md @@ -0,0 +1,22 @@ +--- +title: 赋值 +sidebar: + order: 21 + label: 21. 赋值 +--- + + +使用赋值缩小 TypeScript 是一种根据分配给变量的值来缩小变量类型的方法。当为变量分配值时,TypeScript 会根据分配的值推断其类型,并缩小变量的类型以匹配推断的类型。 + +```typescript +let value: string | number; +value = 'hello'; +if (typeof value === 'string') { + console.log(value.toUpperCase()); +} +value = 42; +if (typeof value === 'number') { + console.log(value.toFixed(2)); +} +``` + diff --git a/website/src/content/docs/zh-cn/book/built-in-type-primitives.md b/website/src/content/docs/zh-cn/book/built-in-type-primitives.md new file mode 100644 index 00000000..db6f0d05 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/built-in-type-primitives.md @@ -0,0 +1,21 @@ +--- +title: 内置原始数据类型 +sidebar: + order: 49 + label: 49. 内置原始数据类型 +--- + + +TypeScript 有几个内置的原属数据类型,可用于定义变量、函数参数和返回类型: + +`number`: 表示数值,包括整数和浮点数。 +`string`: 代表文本数据。 +`boolean`: 代表逻辑值,可以是 true 或 false。 +`null`: 表示没有值。 +`undefined`: 表示尚未赋值或未定义的值。 +`symbol`: 代表唯一标识符。符号通常用作对象属性的键。 +`bigint`: 表示任意精度整数。 +`any`: 代表动态或未知类型。any 类型的变量可以保存任何类型的值,并且它们绕过类型检查。 +`void`: 表示不存在任何类型。它通常用作不返回值的函数的返回类型。 +`never`: 表示从未出现过的值的类型。它通常用作引发错误或进入无限循环的函数的返回类型。 + diff --git a/website/src/content/docs/zh-cn/book/class.md b/website/src/content/docs/zh-cn/book/class.md new file mode 100644 index 00000000..f71d38c5 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/class.md @@ -0,0 +1,672 @@ +--- +title: Class +sidebar: + order: 54 + label: 54. Class +--- + + +### 通用语法 + +TypeScript 中使用关键字 `class` 来定义类。下面,您可以看到一个示例: + +```typescript +class Person { + private name: string; + private age: number; + constructor(name: string, age: number) { + this.name = name; + this.age = age; + } + public sayHi(): void { + console.log( + `Hello, my name is ${this.name} and I am ${this.age} years old.` + ); + } +} +``` + +`class` 关键字用于定义名为 `Person` 的类。 + +该类有两个私有属性:类型名称 `string` 和类型年龄 `number`。 + +构造函数是使用 `constructor` 关键字定义的。它将姓名和年龄作为参数并将它们分配给相应的属性。 + +该类有一个 `public` 名为 `sayHi` 的方法,用于记录问候消息。 + +要在 TypeScript 中创建类的实例,可以使用 `new` 关键字,后跟类名,然后使用括号 `()`。例如: + + +```typescript +const myObject = new Person('John Doe', 25); +myObject.sayHi(); // 输出:Hello, my name is John Doe and I am 25 years old. +``` + +### 构造函数 + +构造函数是类中的特殊方法,用于在创建类的实例时初始化对象的属性。 + +```typescript +class Person { + public name: string; + public age: number; + + constructor(name: string, age: number) { + this.name = name; + this.age = age; + } + + sayHello() { + console.log( + `Hello, my name is ${this.name} and I'm ${this.age} years old.` + ); + } +} + +const john = new Person('Simon', 17); +john.sayHello(); +``` + +可以使用以下语法重载构造函数: + +```typescript +type Sex = 'm' | 'f'; + +class Person { + name: string; + age: number; + sex: Sex; + + constructor(name: string, age: number, sex?: Sex); + constructor(name: string, age: number, sex: Sex) { + this.name = name; + this.age = age; + this.sex = sex ?? 'm'; + } +} + +const p1 = new Person('Simon', 17); +const p2 = new Person('Alice', 22, 'f'); +``` + +在 TypeScript 中,可以定义多个构造函数重载,但只能有一个必须与所有重载兼容的实现,这可以通过使用可选参数来实现。 + +```typescript +class Person { + name: string; + age: number; + + constructor(); + constructor(name: string); + constructor(name: string, age: number); + constructor(name?: string, age?: number) { + this.name = name ?? 'Unknown'; + this.age = age ?? 0; + } + + displayInfo() { + console.log(`Name: ${this.name}, Age: ${this.age}`); + } +} + +const person1 = new Person(); +person1.displayInfo(); // Name: Unknown, Age: 0 + +const person2 = new Person('John'); +person2.displayInfo(); // Name: John, Age: 0 + +const person3 = new Person('Jane', 25); +person3.displayInfo(); // Name: Jane, Age: 25 +``` + +### 私有和受保护的构造函数 + +在 TypeScript 中,构造函数可以标记为私有或受保护,这限制了它们的可访问性和使用。 + +私有构造函数:只能在类本身内调用。私有构造函数通常用于以下场景:您想要强制执行单例模式或将实例的创建限制为类中的工厂方法 + +受保护的构造函数:当您想要创建一个不应直接实例化但可以由子类扩展的基类时,受保护的构造函数非常有用。 + +```typescript +class BaseClass { + protected constructor() {} +} + +class DerivedClass extends BaseClass { + private value: number; + + constructor(value: number) { + super(); + this.value = value; + } +} + +// 尝试直接实例化基类将导致错误 +// const baseObj = new BaseClass(); // 错误:类"BaseClass"的构造函数受到保护。 + +// 创建派生类的实例 +const derivedObj = new DerivedClass(10); +``` + +### 访问修饰符 + +访问修饰符 `private` 、`protected` 和 `public` 用于控制 TypeScript 类中类成员(例如属性和方法)的可见性和可访问性。这些修饰符对于强制封装以及建立访问和修改类内部状态的边界至关重要。 + +修饰符 `private` 仅限制对包含类中的类成员的访问。 + +修饰符 `protected` 允许访问包含类及其派生类中的类成员。 + +修饰符 `public` 提供对类成员的不受限制的访问,允许从任何地方访问它。 + +### Get 与 Set + +Getter 和 Setter 是特殊方法,允许您定义类属性的自定义访问和修改行为。它们使您能够封装对象的内部状态,并在获取或设置属性值时提供附加逻辑。在 TypeScript 中,getter 和 setter 分别使用 `get` 和 `set` 关键字定义。这是一个例子: + +```typescript +class MyClass { + private _myProperty: string; + + constructor(value: string) { + this._myProperty = value; + } + get myProperty(): string { + return this._myProperty; + } + set myProperty(value: string) { + this._myProperty = value; + } +} +``` + +### 类中的自动访问器 + +TypeScript 版本 4.9 添加了对自动访问器的支持,这是即将推出的 ECMAScript 功能。它们类似于类属性,但使用"accessor"关键字声明。 + +```typescript +class Animal { + accessor name: string; + + constructor(name: string) { + this.name = name; + } +} +``` + +自动访问器被"脱糖"为私有get访问set器,在无法访问的属性上运行。 + + +```typescript +class Animal { + #__name: string; + + get name() { + return this.#__name; + } + set name(value: string) { + this.#__name = name; + } + + constructor(name: string) { + this.name = name; + } +} +``` + +### this + +在 TypeScript 中,`this` 关键字指的是类的方法或构造函数中的当前实例。它允许您在类自己的范围内访问和修改类的属性和方法。它提供了一种在对象自己的方法中访问和操作对象内部状态的方法。 + +```typescript +class Person { + private name: string; + constructor(name: string) { + this.name = name; + } + public introduce(): void { + console.log(`Hello, my name is ${this.name}.`); + } +} + +const person1 = new Person('Alice'); +person1.introduce(); // Hello, my name is Alice. +``` + +### 参数属性 + +参数属性允许您直接在构造函数参数中声明和初始化类属性,从而避免样板代码,例如: + +```typescript +class Person { + constructor( + private name: string, + public age: number + ) { + // 构造函数中的"private"和"public"关键字自动声明并初始化相应的类属性。 + } + public introduce(): void { + console.log( + `Hello, my name is ${this.name} and I am ${this.age} years old.` + ); + } +} +const person = new Person('Alice', 25); +person.introduce(); +``` + +### 抽象类 + +抽象类在 TypeScript 中主要用于继承,它们提供了一种定义可由子类继承的公共属性和方法的方法。当您想要定义常见行为并强制子类实现某些方法时,这非常有用。它们提供了一种创建类层次结构的方法,其中抽象基类为子类提供共享接口和通用功能。 + +```typescript +abstract class Animal { + protected name: string; + + constructor(name: string) { + this.name = name; + } + + abstract makeSound(): void; +} + +class Cat extends Animal { + makeSound(): void { + console.log(`${this.name} meows.`); + } +} + +const cat = new Cat('Whiskers'); +cat.makeSound(); // 输出:Whiskers meows. +``` + +### 使用泛型 + +具有泛型的类允许您定义可以与不同类型一起使用的可重用类。 + +```typescript +class Container { + private item: T; + + constructor(item: T) { + this.item = item; + } + + getItem(): T { + return this.item; + } + + setItem(item: T): void { + this.item = item; + } +} + +const container1 = new Container(42); +console.log(container1.getItem()); // 42 + +const container2 = new Container('Hello'); +container2.setItem('World'); +console.log(container2.getItem()); // World +``` + +### 装饰器 + +装饰器提供了一种添加元数据、修改行为、验证或扩展目标元素功能的机制。它们是在运行时执行的函数。多个装饰器可以应用于一个声明。 + +装饰器是实验性功能,以下示例仅与使用 ES6 的 TypeScript 版本 5 或更高版本兼容。 + +对于 5 之前的 TypeScript 版本,应在您的 `tsconfig.json` 中使用使`experimentalDecorators` 或在命令行中使用 `--experimentalDecorators` 来启用它们(但以下示例不起作用)。 + +装饰器的一些常见用例包括: + +* 观察属性变化。 +* 观察方法调用。 +* 添加额外的属性或方法。 +* 运行时验证。 +* 自动序列化和反序列化。 +* 日志记录。 +* 授权和认证。 +* 错误防护。 + +注意:版本 5 的装饰器不允许装饰参数。 + +装饰器的类型: + +#### 类装饰器 + +类装饰器对于扩展现有类非常有用,例如添加属性或方法,或者收集类的实例。在下面的示例中,我们添加一个 `toString` 将类转换为字符串表示形式的方法。 + +```typescript +type Constructor = new (...args: any[]) => T; + +function toString( + Value: Class, + context: ClassDecoratorContext +) { + return class extends Value { + constructor(...args: any[]) { + super(...args); + console.log(JSON.stringify(this)); + console.log(JSON.stringify(context)); + } + }; +} + +@toString +class Person { + name: string; + + constructor(name: string) { + this.name = name; + } + + greet() { + return 'Hello, ' + this.name; + } +} +const person = new Person('Simon'); +/* Logs: +{"name":"Simon"} +{"kind":"class","name":"Person"} +*/ +``` + +#### 属性装饰器 + +属性装饰器对于修改属性的行为非常有用,例如更改初始化值。在下面的代码中,我们有一个脚本将属性设置为始终大写: + +```typescript +function upperCase( + target: undefined, + context: ClassFieldDecoratorContext +) { + return function (this: T, value: string) { + return value.toUpperCase(); + }; +} + +class MyClass { + @upperCase + prop1 = 'hello!'; +} + +console.log(new MyClass().prop1); // 日志:HELLO! +``` + +#### 方法装饰器 + +方法装饰器允许您更改或增强方法的行为。下面是一个简单记录器的示例: + +```typescript +function log( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext< + This, + (this: This, ...args: Args) => Return + > +) { + const methodName = String(context.name); + + function replacementMethod(this: This, ...args: Args): Return { + console.log(`LOG: Entering method '${methodName}'.`); + const result = target.call(this, ...args); + console.log(`LOG: Exiting method '${methodName}'.`); + return result; + } + + return replacementMethod; +} + +class MyClass { + @log + sayHello() { + console.log('Hello!'); + } +} + +new MyClass().sayHello(); +``` + +它记录: + +```shell +LOG: Entering method 'sayHello'. +Hello! +LOG: Exiting method 'sayHello'. +``` + +#### Getter 和 Setter 装饰器 + +getter 和 setter 装饰器允许您更改或增强类访问器的行为。例如,它们对于验证属性分配很有用。这是 getter 装饰器的一个简单示例: + +```typescript +function range(min: number, max: number) { + return function ( + target: (this: This) => Return, + context: ClassGetterDecoratorContext + ) { + return function (this: This): Return { + const value = target.call(this); + if (value < min || value > max) { + throw 'Invalid'; + } + Object.defineProperty(this, context.name, { + value, + enumerable: true, + }); + return value; + }; + }; +} + +class MyClass { + private _value = 0; + + constructor(value: number) { + this._value = value; + } + @range(1, 100) + get getValue(): number { + return this._value; + } +} + +const obj = new MyClass(10); +console.log(obj.getValue); // 有效: 10 + +const obj2 = new MyClass(999); +console.log(obj2.getValue); // 抛出异常: Invalid! +``` + +### 装饰器元数据 + +装饰器元数据简化了装饰器在任何类中应用和利用元数据的过程。 他们可以访问上下文对象上的新元数据属性,该属性可以充当基元和对象的密钥。 +可以通过"Symbol.metadata"在类上访问元数据信息。 + +元数据可用于各种目的,例如调试、序列化或使用装饰器的依赖项注入。 + +```typescript +//@ts-ignore +Symbol.metadata ??= Symbol('Symbol.metadata'); // 简单的兼容性填充 + +type Context = + | ClassFieldDecoratorContext + | ClassAccessorDecoratorContext + | ClassMethodDecoratorContext; // 上下文对象包含属性元数据: 装饰器元数据 + +function setMetadata(_target: any, context: Context) { + // 使用基本类型值设置元数据对象 + context.metadata[context.name] = true; +} + +class MyClass { + @setMetadata + a = 123; + + @setMetadata + accessor b = 'b'; + + @setMetadata + fn() {} +} + +const metadata = MyClass[Symbol.metadata]; // 获取元数据对象信息 + +console.log(JSON.stringify(metadata)); // {"bar":true,"baz":true,"foo":true} +``` + +### 继承 + +继承是指一个类可以从另一个类(称为基类或超类)继承属性和方法的机制。派生类也称为子类或子类,可以通过添加新的属性和方法或重写现有的属性和方法来扩展和专门化基类的功能。 + +```typescript +class Animal { + name: string; + + constructor(name: string) { + this.name = name; + } + + speak(): void { + console.log('The animal makes a sound'); + } +} + +class Dog extends Animal { + breed: string; + + constructor(name: string, breed: string) { + super(name); + this.breed = breed; + } + + speak(): void { + console.log('Woof! Woof!'); + } +} + +// 创建基类的一个实例 +const animal = new Animal('Generic Animal'); +animal.speak(); // The animal makes a sound + +// 创建派生类的一个实例 +const dog = new Dog('Max', 'Labrador'); +dog.speak(); // Woof! Woof!" +``` + +TypeScript 不支持传统意义上的多重继承,而是允许从单个基类继承。TypeScript 支持多种接口。接口可以定义对象结构的契约,类可以实现多个接口。这允许类从多个源继承行为和结构。 + +```typescript +interface Flyable { + fly(): void; +} + +interface Swimmable { + swim(): void; +} + +class FlyingFish implements Flyable, Swimmable { + fly() { + console.log('Flying...'); + } + + swim() { + console.log('Swimming...'); + } +} + +const flyingFish = new FlyingFish(); +flyingFish.fly(); +flyingFish.swim(); +``` + +TypeScript 中的关键字 `class` 与 JavaScript 类似,通常被称为语法糖。它是在 ECMAScript 2015 (ES6) 中引入的,旨在提供更熟悉的语法,以基于类的方式创建和使用对象。然而,值得注意的是,TypeScript 作为 JavaScript 的超集,最终会编译为 JavaScript,而 JavaScript 的核心仍然是基于原型的。 + +### 静态成员 + +TypeScript 有静态成员。要访问类的静态成员,可以使用类名后跟一个点,而不需要创建对象。 + +```typescript +class OfficeWorker { + static memberCount: number = 0; + + constructor(private name: string) { + OfficeWorker.memberCount++; + } +} + +const w1 = new OfficeWorker('James'); +const w2 = new OfficeWorker('Simon'); +const total = OfficeWorker.memberCount; +console.log(total); // 2 +``` + +### 属性初始化 + +在 TypeScript 中初始化类的属性有多种方法: + +内嵌: + +在下面的示例中,创建类的实例时将使用这些初始值。 + +```typescript +class MyClass { + property1: string = 'default value'; + property2: number = 42; +} +``` + +在构造函数中: + +```typescript +class MyClass { + property1: string; + property2: number; + + constructor() { + this.property1 = 'default value'; + this.property2 = 42; + } +} +``` + +使用构造函数参数: + +```typescript +class MyClass { + constructor( + private property1: string = 'default value', + public property2: number = 42 + ) { + // 无需显式地将值分配给属性。 + } + log() { + console.log(this.property2); + } +} +const x = new MyClass(); +x.log(); +``` + +### 方法重载 + +方法重载允许一个类有多个名称相同但参数类型不同或参数数量不同的方法。这允许我们根据传递的参数以不同的方式调用方法。 + +```typescript +class MyClass { + add(a: number, b: number): number; // 重载签名 1 + add(a: string, b: string): string; // 重载签名 2 + + add(a: number | string, b: number | string): number | string { + if (typeof a === 'number' && typeof b === 'number') { + return a + b; + } + if (typeof a === 'string' && typeof b === 'string') { + return a.concat(b); + } + throw new Error('Invalid arguments'); + } +} + +const r = new MyClass(); +console.log(r.add(10, 5)); // 日志:15 +``` + diff --git a/website/src/content/docs/zh-cn/book/common-built-in-js-objects.md b/website/src/content/docs/zh-cn/book/common-built-in-js-objects.md new file mode 100644 index 00000000..7ad155e8 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/common-built-in-js-objects.md @@ -0,0 +1,29 @@ +--- +title: 常见的内置JS对象 +sidebar: + order: 50 + label: 50. 常见的内置JS对象 +--- + + +TypeScript 是 JavaScript 的超集,它包含所有常用的内置 JavaScript 对象。您可以在 Mozilla 开发者网络 (MDN) 文档网站上找到这些对象的详细列表: + + +以下是一些常用的内置 JavaScript 对象的列表: + +* Function +* Object +* Boolean +* Error +* Number +* BigInt +* Math +* Date +* String +* RegExp +* Array +* Map +* Set +* Promise +* Intl + diff --git a/website/src/content/docs/zh-cn/book/conditional-types.md b/website/src/content/docs/zh-cn/book/conditional-types.md new file mode 100644 index 00000000..8cb8bda2 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/conditional-types.md @@ -0,0 +1,20 @@ +--- +title: 条件类型 +sidebar: + order: 39 + label: 39. 条件类型 +--- + + +条件类型是一种创建依赖于条件的类型的方法,其中要创建的类型是根据条件的结果确定的。它们是使用 `extends` 关键字和三元运算符来定义的,以便有条件地在两种类型之间进行选择。 + +```typescript +type IsArray = T extends any[] ? true : false; + +const myArray = [1, 2, 3]; +const myNumber = 42; + +type IsMyArrayAnArray = IsArray; // true 类型 +type IsMyNumberAnArray = IsArray; // false 类型 +``` + diff --git a/website/src/content/docs/zh-cn/book/control-flow-analysis.md b/website/src/content/docs/zh-cn/book/control-flow-analysis.md new file mode 100644 index 00000000..68cc6be3 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/control-flow-analysis.md @@ -0,0 +1,58 @@ +--- +title: 控制流分析 +sidebar: + order: 22 + label: 22. 控制流分析 +--- + + +TypeScript 中的控制流分析是一种静态分析代码流以推断变量类型的方法,允许编译器根据分析结果根据需要缩小这些变量的类型。 + +在 TypeScript 4.4 之前,代码流分析仅适用于 if 语句中的代码,但从 TypeScript 4.4 开始,它还可以应用于条件表达式和通过 const 变量间接引用的判别式属性访问。 + +例如: + +```typescript +const f1 = (x: unknown) => { + const isString = typeof x === 'string'; + if (isString) { + x.length; + } +}; + +const f2 = ( + obj: { kind: 'foo'; foo: string } | { kind: 'bar'; bar: number } +) => { + const isFoo = obj.kind === 'foo'; + if (isFoo) { + obj.foo; + } else { + obj.bar; + } +}; +``` + +一些未发生缩小的示例: + + +```typescript +const f1 = (x: unknown) => { + let isString = typeof x === 'string'; + if (isString) { + x.length; // 错误, 没有缩小,因为 isString 不是常量 + } +}; + +const f6 = ( + obj: { kind: 'foo'; foo: string } | { kind: 'bar'; bar: number } +) => { + const isFoo = obj.kind === 'foo'; + obj = obj; + if (isFoo) { + obj.foo; // 错误, 没有缩小,因为 obj 在函数体中被赋值 + } +}; +``` + +注意: 在条件表达式中最多分析五个间接级别。 + diff --git a/website/src/content/docs/zh-cn/book/differences-between-type-and-interface.md b/website/src/content/docs/zh-cn/book/differences-between-type-and-interface.md new file mode 100644 index 00000000..c10934aa --- /dev/null +++ b/website/src/content/docs/zh-cn/book/differences-between-type-and-interface.md @@ -0,0 +1,96 @@ +--- +title: 类型和接口之间的差异 +sidebar: + order: 53 + label: 53. 类型和接口之间的差异 +--- + + +声明合并(增强): + +接口支持声明合并,这意味着您可以定义多个具有相同名称的接口,TypeScript 会将它们合并为具有组合属性和方法的单个接口。 另一方面,类型不支持声明合并。 当您想要添加额外的功能或自定义现有类型而不修改原始定义或修补丢失或不正确的类型时,这可能会很有帮助。 + +```typescript +interface A { + x: string; +} +interface A { + y: string; +} +const j: A = { + x: 'xx', + y: 'yy', +}; +``` + +扩展其他类型/接口: + +类型和接口都可以扩展其他类型/接口,但语法不同。 对于接口,您可以使用“extends”关键字从其他接口继承属性和方法。 但是,接口无法扩展像联合类型这样的复杂类型。 + +```typescript +interface A { + x: string; + y: number; +} +interface B extends A { + z: string; +} +const car: B = { + x: 'x', + y: 123, + z: 'z', +}; +``` + +对于类型,您可以使用 & 运算符将多个类型合并为单个类型(交集)。 + +```typescript +interface A { + x: string; + y: number; +} + +type B = A & { + j: string; +}; + +const c: B = { + x: 'x', + y: 123, + j: 'j', +}; +``` + +并集和交集类型: + +在定义并集和交集类型时,类型更加灵活。 通过“type”关键字,您可以使用“|”运算符轻松创建联合类型,并使用“&”运算符创建交集类型。 虽然接口也可以间接表示联合类型,但它们没有对交集类型的内置支持。 + +```typescript +type Department = 'dep-x' | 'dep-y'; // 并集 + +type Person = { + name: string; + age: number; +}; + +type Employee = { + id: number; + department: Department; +}; + +type EmployeeInfo = Person & Employee; // 交集 +``` + +接口示例: + +```typescript +interface A { + x: 'x'; +} +interface B { + y: 'y'; +} + +type C = A | B; // 接口的并集 +``` + diff --git a/website/src/content/docs/zh-cn/book/discriminated-unions.md b/website/src/content/docs/zh-cn/book/discriminated-unions.md new file mode 100644 index 00000000..a1c7e26f --- /dev/null +++ b/website/src/content/docs/zh-cn/book/discriminated-unions.md @@ -0,0 +1,39 @@ +--- +title: 可区分联合 +sidebar: + order: 24 + label: 24. 可区分联合 +--- + + +TypeScript 中的可区分联合是一种联合类型,它使用称为判别式的公共属性来缩小联合的可能类型集。 + +```typescript +type Square = { + kind: 'square'; // 判别式 + size: number; +}; + +type Circle = { + kind: 'circle'; // 判别式 + radius: number; +}; + +type Shape = Square | Circle; + +const area = (shape: Shape) => { + switch (shape.kind) { + case 'square': + return Math.pow(shape.size, 2); + case 'circle': + return Math.PI * Math.pow(shape.radius, 2); + } +}; + +const square: Square = { kind: 'square', size: 5 }; +const circle: Circle = { kind: 'circle', radius: 2 }; + +console.log(area(square)); // 25 +console.log(area(circle)); // 12.566370614359172 +``` + diff --git a/website/src/content/docs/zh-cn/book/distributive-conditional-types.md b/website/src/content/docs/zh-cn/book/distributive-conditional-types.md new file mode 100644 index 00000000..7ad7bcbe --- /dev/null +++ b/website/src/content/docs/zh-cn/book/distributive-conditional-types.md @@ -0,0 +1,16 @@ +--- +title: 分配条件类型 +sidebar: + order: 40 + label: 40. 分配条件类型 +--- + + +分布式条件类型是一种功能,通过单独对联合的每个成员应用转换,允许类型分布在类型的联合上。当使用映射类型或高阶类型时,这尤其有用。 + +```typescript +type Nullable = T extends any ? T | null : never; +type NumberOrBool = number | boolean; +type NullableNumberOrBool = Nullable; // number | boolean | null +``` + diff --git a/website/src/content/docs/zh-cn/book/downloads.md b/website/src/content/docs/zh-cn/book/downloads.md new file mode 100644 index 00000000..45bf16f6 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/downloads.md @@ -0,0 +1,12 @@ +--- +title: 下载 +sidebar: + order: 3 + label: 3. 下载 +--- + + +您还可以在这里下载 Epub 版本: + + + diff --git a/website/src/content/docs/zh-cn/book/enums.md b/website/src/content/docs/zh-cn/book/enums.md new file mode 100644 index 00000000..12f185bf --- /dev/null +++ b/website/src/content/docs/zh-cn/book/enums.md @@ -0,0 +1,166 @@ +--- +title: 枚举 +sidebar: + order: 19 + label: 19. 枚举 +--- + + +在 TypeScript 中,枚举是一组命名常量值。 + +```typescript +enum Color { + Red = '#ff0000', + Green = '#00ff00', + Blue = '#0000ff', +} +``` + +枚举可以用不同的方式定义: + +### 数字枚举 + +在 TypeScript 中,数字枚举是一个枚举,其中每个常量都分配有一个数值,默认从 0 开始。 + +```typescript +enum Size { + Small, // 值从 0 开始 + Medium, + Large, +} +``` + +可以通过显式分配来指定自定义值: + +```typescript +enum Size { + Small = 10, + Medium, + Large, +} +console.log(Size.Medium); // 11 +``` + +### 字符串枚举 + +在 TypeScript 中,字符串枚举是每个常量都分配有一个字符串值的枚举。 + +```typescript +enum Language { + English = 'EN', + Spanish = 'ES', +} +``` + +注意:TypeScript 允许使用异构枚举,其中字符串和数字成员可以共存。 + +### 常量枚举 + +TypeScript 中的常量枚举是一种特殊类型的枚举,其中所有值在编译时都是已知的,并且在使用枚举的任何地方都会内联,从而产生更高效的代码。 + +```typescript +const enum Language { + English = 'EN', + Spanish = 'ES', +} +console.log(Language.English); +``` + +将被编译成: + +```typescript +console.log('EN' /* Language.English */); +``` + +注意:常量枚举具有硬编码值,擦除枚举,这在独立库中可能更有效,但通常是不可取的。此外,常量枚举不能有计算成员。 + +### 反向映射 + +在 TypeScript 中,枚举中的反向映射是指从值中检索枚举成员名称的能力。默认情况下,枚举成员具有从名称到值的正向映射,但可以通过为每个成员显式设置值来创建反向映射。当您需要按枚举成员的值查找枚举成员,或者需要迭代所有枚举成员时,反向映射非常有用。需要注意的是,只有数字类型的枚举成员会生成反向映射,字符串类型的枚举成员则不会。 + +以下枚举: + +```typescript +enum Grade { + A = 90, + B = 80, + C = 70, + F = 'fail', +} +``` + +编译为: + + +```javascript +'use strict'; +var Grade; +(function (Grade) { + Grade[(Grade['A'] = 90)] = 'A'; + Grade[(Grade['B'] = 80)] = 'B'; + Grade[(Grade['C'] = 70)] = 'C'; + Grade['F'] = 'fail'; +})(Grade || (Grade = {})); +``` + +由此可见,对数字类型的枚举成员,可以从枚举值映射回枚举名称,但对字符串类型的枚举成员无法这样做。 + + +```typescript +enum Grade { + A = 90, + B = 80, + C = 70, + F = 'fail', +} +const myGrade = Grade.A; +console.log(Grade[myGrade]); // A +console.log(Grade[90]); // A + +const failGrade = Grade.F; +console.log(failGrade); // fail +console.log(Grade[failGrade]); // 因为索引表达式的类型不是 'number',所以元素是隐式的 'any' 类型。 +``` + +### 环境枚举 + +TypeScript 中的环境枚举是一种在声明文件 (*.d.ts) 中定义的枚举类型,没有关联的实现。它允许您定义一组命名常量,这些常量可以在不同文件中以类型安全的方式使用,而无需在每个文件中导入实现细节。 + +### 计算成员和常量成员 + +在 TypeScript 中,计算成员是枚举的成员,其值在运行时计算,而常量成员是其值在编译时设置且在运行时无法更改的成员。常规枚举中允许使用计算成员,而常规枚举和常量枚举中都允许使用常量成员。 + +```typescript +// 常量成员 +enum Color { + Red = 1, + Green = 5, + Blue = Red + Green, +} +console.log(Color.Blue); // 6 编译时生成 +``` + +```typescript +// 计算成员 +enum Color { + Red = 1, + Green = Math.pow(2, 2), + Blue = Math.floor(Math.random() * 3) + 1, +} +console.log(Color.Blue); // 运行时生成的随机数 +``` + +枚举由包含其成员类型的联合表示。每个成员的值可以通过常量或非常量表达式确定,拥有常量值的成员被分配字面量类型。为了说明这一点,请考虑类型 E 及其子类型 E.A、E.B 和 E.C 的声明。在本例中,E 表​​示联合 E.A | E.B | E.C 。 + +```typescript +const identity = (value: number) => value; + +enum E { + A = 2 * 5, // 数字字面量 + B = 'bar', // 字符串字面量 + C = identity(42), // 不透明计算 +} + +console.log(E.C); //42 +``` + diff --git a/website/src/content/docs/zh-cn/book/erased-structural-types.md b/website/src/content/docs/zh-cn/book/erased-structural-types.md new file mode 100644 index 00000000..0cab3c69 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/erased-structural-types.md @@ -0,0 +1,27 @@ +--- +title: 擦除的结构类型 +sidebar: + order: 56 + label: 56. 擦除的结构类型 +--- + + +在 TypeScript 中,对象不必匹配特定的、精确的类型。例如,如果我们创建一个满足接口要求的对象,我们就可以在需要该接口的地方使用该对象,即使它们之间没有显式连接。例子: + +```typescript +type NameProp1 = { + prop1: string; +}; + +function log(x: NameProp1) { + console.log(x.prop1); +} + +const obj = { + prop2: 123, + prop1: 'Origin', +}; + +log(obj); // 有效 +``` + diff --git a/website/src/content/docs/zh-cn/book/exhaustiveness-checking.md b/website/src/content/docs/zh-cn/book/exhaustiveness-checking.md new file mode 100644 index 00000000..22e42867 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/exhaustiveness-checking.md @@ -0,0 +1,30 @@ +--- +title: 详尽性检查 +sidebar: + order: 26 + label: 26. 详尽性检查 +--- + + +详尽性检查是 TypeScript 中的一项功能,可确保在 `switch` 语句或 `if` 语句中处理可区分联合的所有可能情况。 + +```typescript +type Direction = 'up' | 'down'; + +const move = (direction: Direction) => { + switch (direction) { + case 'up': + console.log('Moving up'); + break; + case 'down': + console.log('Moving down'); + break; + default: + const exhaustiveCheck: never = direction; + console.log(exhaustiveCheck); // 这行永远不会被执行 + } +}; +``` + +该 `never` 类型用于确保默认情况是详尽的,并且如果将新值添加到 Direction 类型而未在 switch 语句中进行处理,则 TypeScript 将引发错误。 + diff --git a/website/src/content/docs/zh-cn/book/exploring-the-type-system.md b/website/src/content/docs/zh-cn/book/exploring-the-type-system.md new file mode 100644 index 00000000..09ffdb98 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/exploring-the-type-system.md @@ -0,0 +1,818 @@ +--- +title: 探索类型系统 +sidebar: + order: 9 + label: 9. 探索类型系统 +--- + + +### TypeScript 的语言服务 + +TypeScript 的语言服务, 也被称为 tsserver,提供了各种功能,例如错误报告、诊断、保存时编译、重命名、跳转到定义、补全列表、签名帮助等。 它主要由集成开发环境 (IDE) 使用来提供 IntelliSense 支持。它与 Visual Studio Code 无缝集成,并由 Conquer of Completion (Coc) 等工具使用。 + +开发人员可以利用专用 API 并创建自己的自定义语言服务插件来增强 TypeScript 编辑体验。这对于实现特殊的 linting 功能或启用自定义模板语言的自动完成特别有用。 + + +现实世界中的自定义插件的一个示例是"typescript-styled-plugin",它为样式组件中的 CSS 属性提供语法错误报告和 IntelliSense 支持。 + + +有关更多信息和快速入门指南,您可以参考 GitHub 上的官方 TypeScript Wiki: + +### 结构类型 + +TypeScript 基于结构类型系统。这意味着类型的兼容性和等效性由类型的实际结构或定义决定,而不是由其名称或声明位置决定,如 C# 或 C 等主要类型系统中那样。 + +TypeScript 的结构类型系统是基于 JavaScript 的动态 duck 类型系统在运行时的工作方式而设计的。 + +以下示例是有效的 TypeScript 代码。正如您所观察到的,"X"和"Y"具有相同的成员"a",尽管它们具有不同的声明名称。类型由其结构决定,在这种情况下,由于结构相同,因此它们是兼容且有效的。 + +```typescript +type X = { + a: string; +}; +type Y = { + a: string; +}; +const x: X = { a: 'a' }; +const y: Y = x; // 有效 +``` + +### TypeScript 的基本比较规则 + +TypeScript 比较过程是递归的,并在任何级别嵌套的类型上执行。 + +如果"Y"至少具有与"X"相同的成员,则类型"X"与"Y"兼容。 + +```typescript +type X = { + a: string; +}; +const y = { a: 'A', b: 'B' }; // 有效, 至少它拥有相同的成员 X +const r: X = y; +``` + +函数参数按类型进行比较,而不是按名称进行比较: + +```typescript +type X = (a: number) => void; +type Y = (a: number) => void; +let x: X = (j: number) => undefined; +let y: Y = (k: number) => undefined; +y = x; // 有效 +x = y; // 有效 +``` + +函数返回类型必须相同: + + +```typescript +type X = (a: number) => undefined; +type Y = (a: number) => number; +let x: X = (a: number) => undefined; +let y: Y = (a: number) => 1; +y = x; // 无效 +x = y; // 无效 +``` + +源函数的返回类型必须是目标函数的返回类型的子类型: + + +```typescript +let x = () => ({ a: 'A' }); +let y = () => ({ a: 'A', b: 'B' }); +x = y; // 有效 +y = x; // 无效,缺少 b 成员 +``` + +允许丢弃函数参数,因为这是 JavaScript 中的常见做法,例如使用 "Array.prototype.map()": + +```typescript +[1, 2, 3].map((element, _index, _array) => element + 'x'); +``` + +因此,以下类型声明是完全有效的: + +```typescript +type X = (a: number) => undefined; +type Y = (a: number, b: number) => undefined; +let x: X = (a: number) => undefined; +let y: Y = (a: number) => undefined; // 缺少 b 参数 +y = x; // 有效 +``` + +源类型的任何附加可选参数都是有效的: + +```typescript +type X = (a: number, b?: number, c?: number) => undefined; +type Y = (a: number) => undefined; +let x: X = a => undefined; +let y: Y = a => undefined; +y = x; // 有效 +x = y; // 有效 +``` + +目标类型的任何可选参数在源类型中没有对应的参数都是有效的并且不是错误: + +```typescript +type X = (a: number) => undefined; +type Y = (a: number, b?: number) => undefined; +let x: X = a => undefined; +let y: Y = a => undefined; +y = x; // 有效 +x = y; // 有效 +``` + +其余参数被视为无限系列的可选参数: + +```typescript +type X = (a: number, ...rest: number[]) => undefined; +let x: X = a => undefined; // 有效 +``` + +如果重载签名与其实现签名兼容,则具有重载的函数有效: + + +```typescript +function x(a: string): void; +function x(a: string, b: number): void; +function x(a: string, b?: number): void { + console.log(a, b); +} +x('a'); // 有效 +x('a', 1); // 有效 + +function y(a: string): void; // 无效, 不兼容重载的签名 +function y(a: string, b: number): void; +function y(a: string, b: number): void { + console.log(a, b); +} +y('a'); +y('a', 1); +``` + +如果源参数和目标参数可赋值给超类型或子类型(Bivariance 双变),则函数参数比较成功。 + +```typescript +// 超类 +class X { + a: string; + constructor(value: string) { + this.a = value; + } +} +// 子类 +class Y extends X {} +// 子类 +class Z extends X {} + +type GetA = (x: X) => string; +const getA: GetA = x => x.a; + +// 双变(Bivariance) 确实接收超类 +console.log(getA(new X('x'))); // 有效 +console.log(getA(new Y('Y'))); // 有效 +console.log(getA(new Z('z'))); // 有效 +``` + +枚举与数字具有可比性和有效性,反之亦然,但比较不同枚举类型的枚举值是无效的。 + + +```typescript +enum X { + A, + B, +} +enum Y { + A, + B, + C, +} +const xa: number = X.A; // 有效 +const ya: Y = 0; // 有效 +X.A === Y.A; // 无效 +``` + +类的实例需要对其私有成员和受保护成员进行兼容性检查: + + +```typescript +class X { + public a: string; + constructor(value: string) { + this.a = value; + } +} + +class Y { + private a: string; + constructor(value: string) { + this.a = value; + } +} + +let x: X = new Y('y'); // 无效 +``` + +比较检查不考虑不同的继承层次结构,例如: + +```typescript +class X { + public a: string; + constructor(value: string) { + this.a = value; + } +} +class Y extends X { + public a: string; + constructor(value: string) { + super(value); + this.a = value; + } +} +class Z { + public a: string; + constructor(value: string) { + this.a = value; + } +} +let x: X = new X('x'); +let y: Y = new Y('y'); +let z: Z = new Z('z'); +x === y; // 有效 +x === z; // 有效即使 z 来自不同的继承层次结构 +``` + +泛型根据应用泛型参数后的结果类型使用其结构进行比较,仅将最终结果作为非泛型类型进行比较。 + + +```typescript +interface X { + a: T; +} +let x: X = { a: 1 }; +let y: X = { a: 'a' }; +x === y; // 无效,因为最终结构中使用了类型参数 +``` + +```typescript +interface X {} +const x: X = 1; +const y: X = 'a'; +x === y; // 有效,因为最终结构中没有使用类型参数 +``` + +当泛型未指定其类型参数时,所有未指定的参数都将被视为带有"any"的类型: + +```typescript +type X = (x: T) => T; +type Y = (y: K) => K; +let x: X = x => x; +let y: Y = y => y; +x = y; // 有效 +``` + +记住: + + +```typescript +let a: number = 1; +let b: number = 2; +a = b; // 有效,一切都可以赋值给自己 + +let c: any; +c = 1; // 有效,所有类型都可以赋值给any + +let d: unknown; +d = 1; // 有效,所有类型都可以赋值给unknown + +let e: unknown; +let e1: unknown = e; // 有效, unknown只能赋值给自己和any +let e2: any = e; // 有效 +let e3: number = e; // 无效 + +let f: never; +f = 1; // 无效, 所有类型不能赋值给never + +let g: void; +let g1: any; +g = 1; // 无效, void不可赋值给除"any"之外的任何内容或从任何内容赋值 +g = g1; // 有效 +``` + +请注意,当启用"strictNullChecks"时,"null"和"undefined"的处理方式与"void"类似;否则,它们类似于"never"。 + +### 类型作为集合 + +在 TypeScript 中,类型是一组可能的值。该集合也称为类型的域。类型的每个值都可以被视为集合中的一个元素。类型建立了集合中的每个元素必须满足才能被视为该集合的成员的约束。TypeScript 的主要任务是检查并验证一组是否是另一组的子集。 + +TypeScript 支持各种类型的集合: + +| Set term | TypeScript | Notes | +| -------- | ------------------------------- | ------------------------------------------------------------------------------ | +| 空集 | never | "never" 包含除自身之外的任何类型 | +| 单元素集 | undefined / null / literal type | | +| 有限集 | boolean / union | | +| 无限集 | string / number / object | | +| 通用集 | any / unknown | 每个元素都是"any"的成员,每个集合都是它的子集/"unknown"是"any"的类型安全对应项 | + +这里有几个例子: + +| TypScript | Set term | Example | +| --------------------- | ---------------- | ---------------------------------------------------------------- | +| never | ∅ (空集) | const x: never = 'x'; // 错误: 'string'类似不能赋值给'never'类型 | +| | | +| Literal type | 单元素集 | type X = 'X'; | +| | | type Y = 7; | +| | | +| Value assignable to T | Value ∈ T (属于) | type XY = 'X' \| 'Y'; | +| | | const x: XY = 'X'; | +| | | +| T1 assignable to T2 | T1 ⊆ T2 (子集) | type XY = 'X' \| 'Y'; | +| | | const x: XY = 'X'; | +| | | const j: XY = 'J'; // 类型'"J"' 不能赋值给 'XY' 类型. | +| | | | +| T1 extends T2 | T1 ⊆ T2 (子集) | type X = 'X' extends string ? true : false; | +| | | +| T1 \| T2 | T1 ∪ T2 (并集) | type XY = 'X' \| 'Y'; | +| | | type JK = 1 \| 2; | +| | | +| T1 & T2 | T1 ∩ T2 (交集) | type X = { a: string } | +| | | type Y = { b: string } | +| | | type XY = X & Y | +| | | const x: XY = { a: 'a', b: 'b' } | +| | | +| unknown | 通用集 | const x: unknown = 1 | + +并集 (T1 | T2) 创建一个更广泛的集合(两者): + +```typescript +type X = { + a: string; +}; +type Y = { + b: string; +}; +type XY = X | Y; +const r: XY = { a: 'a', b: 'x' }; // 有效 +``` + +交集(T1 & T2)创建一个更窄的集合(仅共享): + + +```typescript +type X = { + a: string; +}; +type Y = { + a: string; + b: string; +}; +type XY = X & Y; +const r: XY = { a: 'a' }; // 无效 +const j: XY = { a: 'a', b: 'b' }; // 有效 +``` + +在这种情况下,关键字extends可以被视为"的子集"。它为类型设置约束。与泛型一起使用的扩展将泛型视为无限集,并将其限制为更具体的类型。请注意,这extends与 OOP 意义上的层次结构无关(TypScript 中没有这个概念)。TypeScript 使用集合并且没有严格的层次结构,事实上,如下面的示例所示,两种类型可以重叠,而不会成为另一种类型的子类型(TypScript 考虑对象的结构和形状)。 + +```typescript +interface X { + a: string; +} +interface Y extends X { + b: string; +} +interface Z extends Y { + c: string; +} +const z: Z = { a: 'a', b: 'b', c: 'c' }; +interface X1 { + a: string; +} +interface Y1 { + a: string; + b: string; +} +interface Z1 { + a: string; + b: string; + c: string; +} +const z1: Z1 = { a: 'a', b: 'b', c: 'c' }; + +const r: Z1 = z; // 有效 +``` + +### 赋值类型:类型声明和类型断言 + +在 TypeScript 中可以通过不同的方式赋值类型: + +#### 类型声明 + +在下面的示例中,我们使用 x:X(":Type") 来声明变量 x 的类型。 + +```typescript +type X = { + a: string; +}; + +// 类型声明 +const x: X = { + a: 'a', +}; +``` + +如果变量不是指定的格式,TypeScript 将报告错误。例如: + + +```typescript +type X = { + a: string; +}; + +const x: X = { + a: 'a', + b: 'b', // 错误: 对象字面量只能指定已知属性 +}; +``` + +#### 类型断言 + +可以使用as关键字添加断言。这告诉编译器开发人员拥有有关类型的更多信息并消除可能发生的任何错误。 + +例如: + +```typescript +type X = { + a: string; +}; +const x = { + a: 'a', + b: 'b', +} as X; +``` + +在上面的示例中,使用 as 关键字将对象 x 断言为类型 X。这通知 TypeScript 编译器该对象符合指定的类型,即使它具有类型定义中不存在的附加属性 b。 + +类型断言在需要指定更具体类型的情况下非常有用,尤其是在使用 DOM 时。例如: + +```typescript +const myInput = document.getElementById('my_input') as HTMLInputElement; +``` + +此处,类型断言 HTMLInputElement 用于告诉 TypeScript getElementById 的结果应被视为 HTMLInputElement。类型断言还可以用于重新映射键,如下面使用模板文字的示例所示: + +```typescript +type J = { + [Property in keyof Type as `prefix_${string & + Property}`]: () => Type[Property]; +}; +type X = { + a: string; + b: number; +}; +type Y = J; +``` + +在此示例中,类型 J 使用带有模板文字的映射类型来重新映射 Type 的键。它创建新属性,并在每个键上添加 prefix_ ,它们对应的值是返回原始属性值的函数。 + +值得注意的是,当使用类型断言时,TypeScript 不会执行多余的属性检查。因此,当预先知道对象的结构时,通常最好使用类型声明。 + +#### 非空断言 + +此断言是使用后缀表达式!运算符应用的,它告诉 TypeScript 值不能为 null 或未定义。 + +```typescript +let x: null | number; +let y = x!; // number +``` + +#### 环境声明 + +环境声明是描述 JavaScript 代码类型的文件,它们的文件名格式为.d.ts.. 它们通常被导入并用于注释现有的 JavaScript 库或向项目中的现有 JS 文件添加类型。 + +许多常见的库类型可以在以下位置找到: + + +```shell +npm install --save-dev @types/library-name +``` + +对于您定义的环境声明,您可以使用"三斜杠"引用导入: + + +```typescript +/// +``` + +即使在 JavaScript 文件中,您也可以通过 `// @ts-check` 使用环境声明。 + +### 属性检测和多余属性检测 + +TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。 + +例如,在将对象字面量赋值给变量或将它们作为参数传递给函数的多余属性时,会执行多余属性检查。 + + +```typescript +type X = { + a: string; +}; +const y = { a: 'a', b: 'b' }; +const x: X = y; // 有效,因为结构类型 +const w: X = { a: 'a', b: 'b' }; // 无效,因为多余属性检测 +``` + +### 弱类型 + +当一个类型只包含一组全可选属性时,该类型被认为是弱类型: + +```typescript +type X = { + a?: string; + b?: string; +}; +``` + +当没有重叠时,TypeScript 认为将任何内容赋值给弱类型是错误的,例如,以下会引发错误: + + +```typescript +type Options = { + a?: string; + b?: string; +}; + +const fn = (options: Options) => undefined; + +fn({ c: 'c' }); // 无效 +``` + +尽管不推荐,但如果需要,可以使用类型断言绕过此检查: + +```typescript +type Options = { + a?: string; + b?: string; +}; +const fn = (options: Options) => undefined; +fn({ c: 'c' } as Options); // 有效 +``` + +或者通过将unknown索引签名添加到弱类型: + +```typescript +type Options = { + [prop: string]: unknown; + a?: string; + b?: string; +}; + +const fn = (options: Options) => undefined; +fn({ c: 'c' }); // 有效 +``` + +### 严格的对象字面量检测 (Freshness) + +严格的对象字面量检查(有时称为“新鲜度”)是 TypeScript 中的一项功能,有助于捕获多余或拼写错误的属性,否则这些属性在正常结构类型检查中会被忽视。 + +创建对象字面量时,TypeScript 编译器认为它是“新鲜的”。 如果将对象字面量分配给变量或作为参数传递,并且对象字面量指定目标类型中不存在的属性,则 TypeScript 将引发错误。 + +然而,当扩展对象文字或使用类型断言时,“新鲜感”就会消失。 + +下面举一些例子来说明: + + +```typescript +type X = { a: string }; +type Y = { a: string; b: string }; + +let x: X; +x = { a: 'a', b: 'b' }; // 严格的对象字面量检查:无效的赋值 +var y: Y; +y = { a: 'a', bx: 'bx' }; // 严格的对象字面量检查:无效的赋值 + +const fn = (x: X) => console.log(x.a); + +fn(x); +fn(y); // 类型加宽:没有错误, 结构类型兼容 + +fn({ a: 'a', bx: 'b' }); // 严格的对象字面量检查:无效的参数 + +let c: X = { a: 'a' }; +let d: Y = { a: 'a', b: '' }; +c = d; // 类型加宽:没有严格的对象字面量检查 +``` + +### 类型推断 + +当在以下期间未提供注释时,TypeScript 可以推断类型: + +* 变量初始化 +* 成员初始化。 +* 设置参数的默认值。 +* 函数返回类型。 + +例如: + +```typescript +let x = 'x'; // 推断的类型是 string +``` + +TypeScript 编译器分析值或表达式并根据可用信息确定其类型。 + +### 更高级的推断 + +当在类型推断中使用多个表达式时,TypeScript 会查找"最佳常见类型"。例如: + +```typescript +let x = [1, 'x', 1, null]; // 类型推断为: (string | number | null)[] +``` + +如果编译器找不到最佳通用类型,它将返回联合类型。例如: + +```typescript +let x = [new RegExp('x'), new Date()]; // 类型推断为: (RegExp | Date)[] +``` + +TypeScript 利用基于变量位置的"上下文类型"来推断类型。在下面的示例中,编译器知道它的e类型是MouseEvent,因为在lib.d.ts 文件中定义了click事件类型,该文件包含各种常见 JavaScript 构造和 DOM 的环境声明: + +```typescript +window.addEventListener('click', function (e) {}); // e 的类型被推断为 MouseEvent +``` + +### 类型加宽 + +类型加宽是 TypeScript 将类型分配给未提供类型注释时初始化的变量的过程。它允许从窄到宽的类型,但反之则不然。在以下示例中: + + +```typescript +let x = 'x'; // TypeScript 推断为字符串,一种宽类型 +let y: 'y' | 'x' = 'y'; // y 类型是字面量类型的联合 +y = x; // 无效,字符串不可分配给类型 'x' | 'y'。 +``` + +TypeScript根据初始化期间提供的单个值(`x`),将 `string` 赋予给 `x`,这是一个扩展的示例。 + +TypeScript 提供了控制加宽过程的方法,例如使用"const"。 + +### 常量 + +在声明变量时使用 `const` 关键字会导致 TypeScript 中的类型推断范围更窄。 + +For example: + +```typescript +const x = 'x'; // TypeScript 将 x 的类型推断为 'x',一种较窄的类型 +let y: 'y' | 'x' = 'y'; +y = x; // 有效: x的类型推断为 'x' +``` + +通过使用 const 声明变量 x,其类型被缩小为特定的文字值"x"。由于 x 的类型被缩小,因此可以将其赋值给变量 y 而不会出现任何错误。可以推断类型的原因是因为 const 变量无法重新分配,因此它们的类型可以缩小到特定的文字类型,在本例中为字面量类型"x"。 + +#### 类型参数的 const 修饰符 + +从 TypeScript 5.0 版本开始,可以 `const` 在泛型类型参数上指定属性。这可以推断出最精确的类型。让我们看一个不使用 `const` 的示例: + +```typescript +function identity(value: T) { + // 这里没有const + return value; +} +const values = identity({ a: 'a', b: 'b' }); // 类型推断为: { a: string; b: string; } +``` + +正如您所看到的,属性a和b是通过 类型推断出来的string 。 + +现在,让我们看看 `const` 版本的差异: + +```typescript +function identity(value: T) { + // 对类型参数使用 const 修饰符 + return value; +} +const values = identity({ a: 'a', b: 'b' }); // 类型推断为: { a: "a"; b: "b"; } +``` + +现在我们可以看到属性 `a` 和 `b` 被推断为const,因此 `a` 和 `b`被视为字符串文字而不仅仅是 `string` 类型。 + +### 常量断言 + +此功能允许您根据变量的初始化值声明具有更精确的文字类型的变量,这向编译器表明该值应被视为不可变文字。 这里有一些例子: + +在单个属性上: + +```typescript +const v = { + x: 3 as const, +}; +v.x = 3; +``` + +在整个对象上: + +```typescript +const v = { + x: 1, + y: 2, +} as const; +``` + +这在定义元组的类型时特别有用: + +```typescript +const x = [1, 2, 3]; // number[] +const y = [1, 2, 3] as const; // 只读数组 [1, 2, 3] +``` + +### 显式类型注释 + +我们可以具体地传递一个类型,在下面的示例中,属性x的类型是number: + +```typescript +const v = { + x: 1, // 推断类型: number (加宽了) +}; +v.x = 3; // 有效 +``` + +我们可以通过使用字面量类型的联合使类型注释更加具体: + + +```typescript +const v: { x: 1 | 2 | 3 } = { + x: 1, // x 现在是字面量的联合类型: 1 | 2 | 3 +}; +v.x = 3; // 有效 +v.x = 100; // 无效的 +``` + +### 类型缩小 + +类型缩小是 TypeScript 中的一个过程,其中一般类型缩小为更具体的类型。当 TypeScript 分析代码并确定某些条件或操作可以细化类型信息时,就会发生这种情况。 + +缩小类型可以通过不同的方式发生,包括: + +#### 条件 + +通过使用条件语句(比如 `if` 或 `switch`),TypeScript 可以根据条件的结果缩小类型范围。例如: + +```typescript +let x: number | undefined = 10; + +if (x !== undefined) { + x += 100; // 由于条件判断,类型被缩小为 number +} +``` + +#### 抛错或者返回 + +抛出错误或从分支提前返回可用于帮助 TypeScript 缩小类型范围。例如: + +```typescript +let x: number | undefined = 10; + +if (x === undefined) { + throw 'error'; +} +x += 100; +``` + +在 TypeScript 中缩小类型范围的其他方法包括: + +* `instanceof` 操作: 用于检查对象是否是特定类的实例。 +* `in` 操作: 用于检查对象中是否存在属性。 +* `typeof` 操作: 用于在运行时检查值的类型。 +* 内部函数,比如: `Array.isArray()`: 用于检查值是否为数组。 + +#### 可区分联合 + +使用"可区分联合"是 TypeScript 中的一种模式,其中向对象添加显式"标签"以区分联合内的不同类型。该模式也称为"标记联合"。在以下示例中,"tag"由属性"type"表示: + +```typescript +type A = { type: 'type_a'; value: number }; +type B = { type: 'type_b'; value: string }; + +const x = (input: A | B): string | number => { + switch (input.type) { + case 'type_a': + return input.value + 100; // 类型为 A + case 'type_b': + return input.value + 'extra'; // 类型为 B + } +}; +``` + +#### 用户定义的类型保护 + +在 TypeScript 无法确定类型的情况下,可以编写一个称为"用户定义类型保护"的辅助函数。在下面的示例中,我们将在应用某些过滤后利用类型谓词来缩小类型范围: + +```typescript +const data = ['a', null, 'c', 'd', null, 'f']; + +const r1 = data.filter(x => x != null); // 类型为 (string | null)[], TypeScript 不能准确推断类型 + +const isValid = (item: string | null): item is string => item !== null; // 自定义类型保护 + +const r2 = data.filter(isValid); // 类型现在为 string[], 通过使用断言类型保护,我们能够缩小类型 +``` + diff --git a/website/src/content/docs/zh-cn/book/extending-types.md b/website/src/content/docs/zh-cn/book/extending-types.md new file mode 100644 index 00000000..4056456d --- /dev/null +++ b/website/src/content/docs/zh-cn/book/extending-types.md @@ -0,0 +1,57 @@ +--- +title: 扩展类型 +sidebar: + order: 15 + label: 15. 扩展类型 +--- + + +可以扩展 `interface`(从另一种类型复制成员): + +```typescript +interface X { + a: string; +} +interface Y extends X { + b: string; +} +``` + +还可以从多种 `interface` 进行扩展: + +```typescript +interface A { + a: string; +} +interface B { + b: string; +} +interface Y extends A, B { + y: string; +} +``` + +该 `extends` 关键字仅适用于 `interface`,因为 `type` 使用交集: + +```typescript +type A = { + a: number; +}; +type B = { + b: number; +}; +type C = A & B; +``` + +可以使用 `interface` 来扩展类 `type`,但反之则不然: + +```typescript +type A = { + a: string; +}; +interface B extends A { + b: string; +} +``` + + diff --git a/website/src/content/docs/zh-cn/book/fixed-length-tuple.md b/website/src/content/docs/zh-cn/book/fixed-length-tuple.md new file mode 100644 index 00000000..f85005f0 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/fixed-length-tuple.md @@ -0,0 +1,18 @@ +--- +title: 固定长度元组 +sidebar: + order: 30 + label: 30. 固定长度元组 +--- + + +固定长度元组是一种特定类型的元组,它强制执行特定类型的固定数量的元素,并且一旦定义元组就不允许对其长度进行任何修改。 + +当您需要表示具有特定数量的元素和特定类型的值的集合,并且您希望确保元组的长度和类型不会无意中更改时,固定长度元组非常有用。 + + +```typescript +const x = [10, 'hello'] as const; +x.push(2); // 错误 +``` + diff --git a/website/src/content/docs/zh-cn/book/generics.md b/website/src/content/docs/zh-cn/book/generics.md new file mode 100644 index 00000000..6773b981 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/generics.md @@ -0,0 +1,105 @@ +--- +title: 泛型 +sidebar: + order: 55 + label: 55. 泛型 +--- + + +泛型允许您创建可与多种类型一起使用的可重用组件和函数。使用泛型,您可以参数化类型、函数和接口,从而允许它们对不同类型进行操作,而无需事先显式指定它们。 + +泛型允许您使代码更加灵活和可重用。 + +### 泛型类型 + +要定义泛型类型,可以使用尖括号 (`<>`) 来指定类型参数,例如: + +```typescript +function identity(arg: T): T { + return arg; +} +const a = identity('x'); +const b = identity(123); + +const getLen = (data: ReadonlyArray) => data.length; +const len = getLen([1, 2, 3]); +``` + +### 泛型类 + +泛型也可以应用于类,这样它们就可以通过使用类型参数来处理多种类型。这对于创建可重用的类定义非常有用,这些定义可以在保持类型安全的同时对不同的数据类型进行操作。 + +```typescript +class Container { + private item: T; + + constructor(item: T) { + this.item = item; + } + + getItem(): T { + return this.item; + } +} + +const numberContainer = new Container(123); +console.log(numberContainer.getItem()); // 123 + +const stringContainer = new Container('hello'); +console.log(stringContainer.getItem()); // hello +``` + +### 泛型约束 + +可以使用关键字 `extends` 后跟类型参数必须满足的类型或接口来约束泛型参数。 + +在下面的示例中,T 必须正确包含 `length` 才能有效: + + +```typescript +const printLen = (value: T): void => { + console.log(value.length); +}; + +printLen('Hello'); // 5 +printLen([1, 2, 3]); // 3 +printLen({ length: 10 }); // 10 +printLen(123); // 无效 +``` + +3.4 RC 版中引入的泛型的一个有趣功能是高阶函数类型推断,它引入了传播泛型类型参数: + +```typescript +declare function pipe
( + ab: (...args: A) => B, + bc: (b: B) => C +): (...args: A) => C; + +declare function list(a: T): T[]; +declare function box(x: V): { value: V }; + +const listBox = pipe(list, box); // (a: T) => { value: T[] } +const boxList = pipe(box, list); // (x: V) => { value: V }[] +``` + +此功能允许更轻松地键入安全的无点风格编程,这在函数式编程中很常见。 + +### 泛型上下文缩小 + +泛型上下文缩小是 TypeScript 中的机制,允许编译器根据使用泛型参数的上下文来缩小泛型参数的类型,在条件语句中使用泛型类型时非常有用: + +```typescript +function process(value: T): void { + if (typeof value === 'string') { + // Value 的类型被缩小到 'string' 类型 + console.log(value.length); + } else if (typeof value === 'number') { + // Value 的类型被缩小到 'number' 类型 + console.log(value.toFixed(2)); + } +} + +process('hello'); // 5 +process(3.14159); // 3.14 +``` + diff --git a/website/src/content/docs/zh-cn/book/getting-started-with-typescript.md b/website/src/content/docs/zh-cn/book/getting-started-with-typescript.md new file mode 100644 index 00000000..05014056 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/getting-started-with-typescript.md @@ -0,0 +1,182 @@ +--- +title: TypeScript 入门 +sidebar: + order: 8 + label: 8. TypeScript 入门 +--- + + +### 安装 + +Visual Studio Code 为 TypeScript 语言提供了出色的支持,但不包含 TypeScript 编译器。要安装 TypeScript 编译器,您可以使用包管理器,例如 npm 或yarn: + +```shell +npm install typescript --save-dev +``` + +或者 + +```shell +yarn add typescript --dev +``` + +确保提交生成的锁定文件,以确保每个团队成员使用相同版本的 TypeScript。 + +要运行TypeScript编译器,可以使用以下命令 + +```shell +npx tsc +``` + +或者 + +```shell +yarn tsc +``` + +建议按项目安装 TypeScript,而不是全局安装,因为它提供了更可预测的构建过程。但是,对于一次性情况,您可以使用以下命令: + +```shell +npx tsc +``` + +或者安装到全局: + +```shell +npm install -g typescript +``` + +如果您使用的是 Microsoft Visual Studio,则可以在 NuGet 中为 MSBuild 项目获取作为包的 TypeScript。在 NuGet 包管理器控制台中,运行以下命令: + +```shell +Install-Package Microsoft.TypeScript.MSBuild +``` + +在 TypeScript 安装过程中,会安装两个可执行文件:"tsc"作为 TypeScript 编译器,"tsserver"作为 TypeScript 独立服务器。独立服务器包含编译器和语言服务,编辑器和 IDE 可以利用它们来提供智能代码补全。 + +此外,还有几种兼容 TypeScript 的转译器可用,例如 Babel(通过插件)或 swc。这些转译器可用于将 TypeScript 代码转换为其他目标语言或版本。 + +### 配置 + +可以使用 tsc CLI 选项或利用位于项目根目录中名为 tsconfig.json 的专用配置文件来配置 TypeScript。 + +要生成预填充推荐设置的 tsconfig.json 文件,您可以使用以下命令: + +```shell +tsc --init +``` + +在本地执行tsc命令时,TypeScript 将使用最近的 tsconfig.json 文件中指定的配置来编译代码。 + +以下是使用默认设置运行的 CLI 命令的一些示例: + +```shell +tsc main.ts // 将一个特定的文件 (main.ts) 编译成 JavaScript +tsc src/*.ts // 将 'src' 文件夹下任意的 .ts 文件编译成 JavaScript +tsc app.ts util.ts --outfile index.js // 将 2 个 TypeScript 文件 (app.ts 和 util.ts) 编译成 1 个 JavaScript 文件 (index.js) +``` + +### TypeScript 的配置文件 tsconfig.json + +tsconfig.json 文件用于配置 TypeScript 编译器 (tsc)。通常,它与文件一起添加到项目的根目录中package.json。 + +注意: + +* tsconfig.json 即使是 json 格式也接受注释。 +* 建议使用此配置文件而不是命令行选项。 + +在以下链接中,您可以找到完整的文档及其配置示例: + + + + + +以下列出了常见且有用的配置: + +#### target + +"target"属性用于指定 TypeScript 应发出/编译到哪个版本的 JavaScript ECMAScript 版本。对于现代浏览器,ES6是一个不错的选择,对于较旧的浏览器,建议使用ES5。 + +#### lib + +"lib"属性用于指定编译时要包含哪些库文件。TypeScript 自动包含"目标"属性中指定功能的 API,但可以根据特定需求省略或选择特定库。例如,如果您正在开发服务器项目,则可以排除"DOM"库,该库仅在浏览器环境中有用。 + +#### strict + +"strict"属性可以提供更强有力的保证并增强类型安全性。建议始终将此属性包含在项目的 tsconfig.json 文件中。启用"strict"属性允许 TypeScript : + +* 触发每个源文件的代码使用"use strict"。 +* 在类型检查过程中考虑"null"和"undefined" +* 当不存在类型注释时禁用"any"类型的使用。 +* 在使用"this"表达式时引发错误,否则"this"会被视为任意类型。 + +#### module + +"module"属性设置编译程序支持的模块系统。在运行时,模块加载器用于根据指定的模块系统定位并执行依赖项。 +JavaScript 中最常见的模块加载器是用于服务器端应用程序的 Node.js 的CommonJS和用于基于浏览器的 Web 应用程序中的 AMD 模块的 RequireJS。 +TypeScript 可以为各种模块系统生成代码,包括 UMD、System、ESNext、ES2015/ES6 和 ES2020。 + +注意:应根据目标环境和该环境中可用的模块加载机制来选择模块系统。 + +#### moduleResolution + +"moduleResolution"属性指定模块解析策略。对现代TypeScript代码使用"node","classic"仅用于旧版本的 TypeScript(1.6 之前)。 + +#### esModuleInterop + +"esModuleInterop"属性允许从未使用"default"属性导出的 CommonJS 模块导入默认值,此属性提供了一个兼容以确保生成的 JavaScript 的兼容性。启用此选项后,我们可以使用 `import MyLibrary from "my-library"` 而不是 `import * as MyLibrary from "my-library"`。 + +#### jsx + +"jsx"属性仅适用于 ReactJS 中使用的 .tsx 文件,并控制 JSX 构造如何编译为 JavaScript。一个常见的选项是"preserve",它将编译为 .jsx 文件,保持 JSX 不变,以便可以将其传递给 Babel 等不同工具进行进一步转换。 + +#### skipLibCheck + +"skipLibCheck"属性将阻止 TypeScript 对整个导入的第三方包进行类型检查。此属性将减少项目的编译时间。TypeScript 仍会根据这些包提供的类型定义检查您的代码。 + +#### files + +"files"属性向编译器指示必须始终包含在程序中的文件列表。 + +#### include + + +"include"属性向编译器指示我们想要包含的文件列表。此属性允许类似 glob 的模式,例如 "\*_" 表示任何子目录,"_" 表示任何文件名,"?" 表示可选字符。 + +#### exclude + +"exclude"属性向编译器指示不应包含在编译中的文件列表。这可以包括"node_modules"等文件或测试文件 +注意:tsconfig.json 允许注释。 + +### importHelpers + +TypeScript 在为某些高级或低级 JavaScript 功能生成代码时使用帮助程序代码。 默认情况下,这些助手会在使用它们的文件中复制。 `importHelpers` 选项从 `tslib` 模块导入这些帮助器,从而使 JavaScript 输出更加高效。 + +### 迁移到 TypeScript 的建议 + +对于大型项目,建议采用逐渐过渡的方式,其中 TypeScript 和 JavaScript 代码最初共存。只有小型项目才能一次性迁移到 TypeScript。 + +此转变的第一步是将 TypeScript 引入构建链过程。这可以通过使用"allowJs"编译器选项来完成,该选项允许 .ts 和 .tsx 文件与现有 JavaScript 文件共存。由于当 TypeScript 无法从 JavaScript 文件推断类型时,它会回退到变量的"any"类型,因此建议在迁移开始时在编译器选项中禁用"noImplicitAny"。 + +第二步是确保您的 JavaScript 测试与 TypeScript 文件一起工作,以便您可以在转换每个模块时运行测试。如果您正在使用 Jest,请考虑使用ts-jest,它允许您使用 Jest 测试 TypeScript 项目。 + +第三步是在项目中包含第三方库的类型声明。 这些声明可以第三方库的类型声明文件或专门的声明包中找到,你能通过 搜索并安装它们。: + +```shell +npm install --save-dev @types/package-name or yarn add --dev @types/package-name. +``` + +第四步是使用自下而上的方法逐个模块地迁移,遵循从叶开始的依赖关系图。这个想法是开始转换不依赖于其他模块的模块。要可视化依赖关系图,您可以使用该madge工具。 + +有一些对于转换成 TypeScript 比较友好的模块(外部 API 或规范相关的实用函数和代码),比如Swagger、GraphQL 或 JSONSchema 自动生成 TypeScript 类型定义,并使用在您的项目中。 + +当没有可用的规范或官方架构时,您可以从原始数据生成类型,例如服务器返回的 JSON。但是,建议从规范而不是数据生成类型,以避免丢失边缘情况。 + +在迁移过程中,不要进行代码重构,而只专注于向模块添加类型。 + +第五步是启用"noImplicitAny",这将强制所有类型都是已知和定义的,从而为您的项目提供更好的 TypeScript 体验。 + +在迁移过程中,您可以使用该@ts-check指令,该指令在 JavaScript 文件中启用 TypeScript 类型检查。该指令提供了宽松版本的类型检查,最初可用于识别 JavaScript 文件中的问题。当@ts-check包含在文件中时,TypeScript 将尝试使用 JSDoc 风格的注释来推断定义。但是,仅在迁移的早期阶段考虑使用 JSDoc 注释。 + +考虑在你的tsconfig.json文件中将 `noEmitOnError` 设置为 false,即使报告错误,这也将允许您输出 JavaScript 源代码。 + diff --git a/website/src/content/docs/zh-cn/book/index-signatures.md b/website/src/content/docs/zh-cn/book/index-signatures.md new file mode 100644 index 00000000..084fdb26 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/index-signatures.md @@ -0,0 +1,22 @@ +--- +title: 索引签名 +sidebar: + order: 14 + label: 14. 索引签名 +--- + + +在 TypeScript 中,我们可以使用 `string` 、`number` 和 `symbol` 作为索引签名: + +```typescript +type K = { + [name: string | number]: string; +}; +const k: K = { x: 'x', 1: 'b' }; +console.log(k['x']); +console.log(k[1]); +console.log(k['1']); // 同 k[1] 的结果相同 +``` + +请注意,JavaScript 会自动将 `number` 的索引转换相同值的 'string'索引, 比如 `k[1]` 和 `k["1"]` 返回相同值。 + diff --git a/website/src/content/docs/zh-cn/book/infer-type-inference-in-conditional-types.md b/website/src/content/docs/zh-cn/book/infer-type-inference-in-conditional-types.md new file mode 100644 index 00000000..fc2be572 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/infer-type-inference-in-conditional-types.md @@ -0,0 +1,16 @@ +--- +title: infer 条件类型中的类型推断 +sidebar: + order: 41 + label: 41. infer 条件类型中的类型推断 +--- + + +`infer` 关键字在条件类型中使用,用于从依赖于泛型参数的类型中推断(提取)泛型参数的类型。这允许您编写更灵活且可重用的类型定义。 + +```typescript +type ElementType = T extends (infer U)[] ? U : never; +type Numbers = ElementType; // number +type Strings = ElementType; // string +``` + diff --git a/website/src/content/docs/zh-cn/book/interface-and-type.md b/website/src/content/docs/zh-cn/book/interface-and-type.md new file mode 100644 index 00000000..abc84e92 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/interface-and-type.md @@ -0,0 +1,87 @@ +--- +title: 接口及类型 +sidebar: + order: 48 + label: 48. 接口及类型 +--- + + +### 通用语法 + +在 TypeScript 中,接口定义对象的结构,指定对象必须具有的属性或方法的名称和类型。在 TypeScript 中定义接口的常用语法如下: + + +```typescript +interface InterfaceName { + property1: Type1; + // ... + method1(arg1: ArgType1, arg2: ArgType2): ReturnType; + // ... +} +``` + +类型定义也类似: + + +```typescript +type TypeName = { + property1: Type1; + // ... + method1(arg1: ArgType1, arg2: ArgType2): ReturnType; + // ... +}; +``` + +`interface InterfaceName` 或者 `type TypeName`: 定义接口的名称。 +`property1`: `Type1`: 指定接口的属性及其相应的类型。可以定义多个属性,每个属性用分号分隔。 +`method1(arg1: ArgType1, arg2: ArgType2): ReturnType;`: 指定接口的方法。方法用其名称进行定义,后跟括号中的参数列表和返回类型。可以定义多个方法,每个方法用分号分隔。 + +接口示例: + +```typescript +interface Person { + name: string; + age: number; + greet(): void; +} +``` + +类型示例: + +```typescript +type TypeName = { + property1: string; + method1(arg1: string, arg2: string): string; +}; +``` + +在 TypeScript 中,类型用于定义数据的形状并强制执行类型检查。在 TypeScript 中定义类型有几种常见的语法,具体取决于具体的用例。这里有些例子: + +### 基本类型 + +```typescript +let myNumber: number = 123; // 数字类型 +let myBoolean: boolean = true; // 布尔类型 +let myArray: string[] = ['a', 'b']; // 字符串数组 +let myTuple: [string, number] = ['a', 123]; // 元组 +``` + +### 对象和接口 + +```typescript +const x: { name: string; age: number } = { name: 'Simon', age: 7 }; +``` + +### 并集和交集类型 + +```typescript +type MyType = string | number; // 并集 +let myUnion: MyType = 'hello'; // 可以是字符串 +myUnion = 123; // 或者是一个数字 + +type TypeA = { name: string }; +type TypeB = { age: number }; +type CombinedType = TypeA & TypeB; // 交集 +let myCombined: CombinedType = { name: 'John', age: 25 }; // 对象同时有name和age属性 +``` + diff --git a/website/src/content/docs/zh-cn/book/intersection-types.md b/website/src/content/docs/zh-cn/book/intersection-types.md new file mode 100644 index 00000000..57315749 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/intersection-types.md @@ -0,0 +1,27 @@ +--- +title: 交集类型 +sidebar: + order: 32 + label: 32. 交集类型 +--- + + +交集类型是表示具有两种或多种类型的所有属性的值的类型。交叉类型在每种类型之间使用 & 符号表示。 + +```typescript +type X = { + a: string; +}; + +type Y = { + b: string; +}; + +type J = X & Y; // 交集 + +const j: J = { + a: 'a', + b: 'b', +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/introduction.md b/website/src/content/docs/zh-cn/book/introduction.md new file mode 100644 index 00000000..1f9d5a09 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/introduction.md @@ -0,0 +1,12 @@ +--- +title: 介绍 +sidebar: + order: 5 + label: 5. 介绍 +--- + + +欢迎来到简洁的TypeScript之书!本指南为您提供有效 TypeScript 开发的基本知识和实践技能。发现编写干净、健壮的代码的关键概念和技术。无论您是初学者还是经验丰富的开发人员,本书都可以作为在项目中利用 TypeScript 强大功能的综合指南和便捷参考。 + +本书涵盖了 TypeScript 5.2。 + diff --git a/website/src/content/docs/zh-cn/book/literal-inference.md b/website/src/content/docs/zh-cn/book/literal-inference.md new file mode 100644 index 00000000..a032cb82 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/literal-inference.md @@ -0,0 +1,53 @@ +--- +title: 字面量推断 +sidebar: + order: 17 + label: 17. 字面量推断 +--- + + +字面量推断是 TypeScript 中的一项功能,允许根据变量或参数的值推断其类型。 + +在下面的示例中,我们可以看到 TypeScript 认为x文字类型是因为该值以后不能随时更改,而y被推断为字符串,因为它以后可以随时修改。 + +```typescript +const x = 'x'; // x 为字面量类型, 因为值不能改变 +let y = 'y'; // string, 我们能改变这个值 +``` + +在下面的示例中,我们可以看到 `o.x` 被推断为 `string`(而不是字面量的a),因为 TypeScript 认为该值可以在以后随时更改。 + + +```typescript +type X = 'a' | 'b'; + +let o = { + x: 'a', // 这是一个更宽的 string +}; + +const fn = (x: X) => `${x}-foo`; + +console.log(fn(o.x)); // 'string' 类型的参数不能赋值给 'X' 类型的参数 +``` + +正如你所看到的代码在传递 `o.x` 给 `fn` 作为一个狭窄类型时,抛出了一个错误。 + +我们能通过使用 `const` 或者 `X` 来借助类型推断解决这个问题: + + +```typescript +let o = { + x: 'a' as const, +}; +``` + +or: + + +```typescript +let o = { + x: 'a' as X, +}; +``` + + diff --git a/website/src/content/docs/zh-cn/book/literal-types.md b/website/src/content/docs/zh-cn/book/literal-types.md new file mode 100644 index 00000000..3b2ca2a3 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/literal-types.md @@ -0,0 +1,26 @@ +--- +title: 字面量类型 +sidebar: + order: 16 + label: 16. 字面量类型 +--- + + +文字类型是来自集体类型的单个元素集,它定义了一个非常精确的值,即 JavaScript 原始数据。 + +TypeScript 中的文字类型是数字、字符串和布尔值。 + +示例如下: + +```typescript +const a = 'a'; // 字符串字面量类型 +const b = 1; // 数字字面量类型 +const c = true; // 布尔字面量类型 +``` + +字符串、数字和布尔字面量类型用于联合、类型保护和类型别名。在下面的示例中,您可以看到类型别名联合,O可以是指定的唯一值,而不是任何其他字符串: + +```typescript +type O = 'a' | 'b' | 'c'; +``` + diff --git a/website/src/content/docs/zh-cn/book/mapped-type-modifiers.md b/website/src/content/docs/zh-cn/book/mapped-type-modifiers.md new file mode 100644 index 00000000..e4f53e89 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/mapped-type-modifiers.md @@ -0,0 +1,24 @@ +--- +title: 映射类型修饰符 +sidebar: + order: 38 + label: 38. 映射类型修饰符 +--- + + +TypeScript 中的映射类型修饰符支持对现有类型中的属性进行转换: + +* `readonly` 或 `+readonly`:这会将映射类型中的属性呈现为只读。 +* `-readonly`:这允许映射类型中的属性是可变的。 +* `?`:这将映射类型中的属性指定为可选。 + +例子: + +```typescript +type ReadOnly = { readonly [P in keyof T]: T[P] }; // 所有属性标记为只读 + +type Mutable = { -readonly [P in keyof T]: T[P] }; // 所有标记为可变的属性 + +type MyPartial = { [P in keyof T]?: T[P] }; // 所有标记为可选的属性 +```` + diff --git a/website/src/content/docs/zh-cn/book/mapped-types.md b/website/src/content/docs/zh-cn/book/mapped-types.md new file mode 100644 index 00000000..2932942f --- /dev/null +++ b/website/src/content/docs/zh-cn/book/mapped-types.md @@ -0,0 +1,27 @@ +--- +title: 映射类型 +sidebar: + order: 37 + label: 37. 映射类型 +--- + + +TypeScript 中的映射类型允许您通过使用映射函数转换每个属性来基于现有类型创建新类型。通过映射现有类型,您可以创建以不同格式表示相同信息的新类型。要创建映射类型,您可以使用运算符访问现有类型的属性 `keyof` ,然后更改它们以生成新类型。在以下示例中: + +```typescript +type MyMappedType = { + [P in keyof T]: T[P][]; +}; +type MyType = { + foo: string; + bar: number; +}; +type MyNewType = MyMappedType; +const x: MyNewType = { + foo: ['hello', 'world'], + bar: [1, 2, 3], +}; +``` + +我们定义 MyMappedType 来映射 T 的属性,创建一个新类型,其中每个属性都是其原始类型的数组。使用它,我们创建 MyNewType 来表示与 MyType 相同的信息,但每个属性都是一个数组。 + diff --git a/website/src/content/docs/zh-cn/book/merging-and-extension.md b/website/src/content/docs/zh-cn/book/merging-and-extension.md new file mode 100644 index 00000000..ebc805bc --- /dev/null +++ b/website/src/content/docs/zh-cn/book/merging-and-extension.md @@ -0,0 +1,50 @@ +--- +title: 合并与扩展 +sidebar: + order: 52 + label: 52. 合并与扩展 +--- + + +合并和扩展是指与使用类型和接口相关的两个不同概念。 + +合并允许您将多个同名声明合并到一个定义中,例如,当您多次定义同名接口时: + +```typescript +interface X { + a: string; +} + +interface X { + b: number; +} + +const person: X = { + a: 'a', + b: 7, +}; +``` + +扩展是指扩展或继承现有类型或接口以创建新类型或接口的能力。它是一种向现有类型添加附加属性或方法而不修改其原始定义的机制。例子: + +```typescript +interface Animal { + name: string; + eat(): void; +} + +interface Bird extends Animal { + sing(): void; +} + +const dog: Bird = { + name: 'Bird 1', + eat() { + console.log('Eating'); + }, + sing() { + console.log('Singing'); + }, +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/named-tuple-type-labeled.md b/website/src/content/docs/zh-cn/book/named-tuple-type-labeled.md new file mode 100644 index 00000000..70a1062a --- /dev/null +++ b/website/src/content/docs/zh-cn/book/named-tuple-type-labeled.md @@ -0,0 +1,17 @@ +--- +title: 命名元组类型(已标记) +sidebar: + order: 29 + label: 29. 命名元组类型(已标记) +--- + + +元组类型可以包含每个元素的可选标签或名称。 这些标签用于提高可读性和工具帮助,不会影响您可以使用它们执行的操作。 + +```typescript +type T = string; +type Tuple1 = [T, T]; +type Tuple2 = [a: T, b: T]; +type Tuple3 = [a: T, T]; // 命名元组加匿名元组 +``` + diff --git a/website/src/content/docs/zh-cn/book/namespacing.md b/website/src/content/docs/zh-cn/book/namespacing.md new file mode 100644 index 00000000..abf95f6a --- /dev/null +++ b/website/src/content/docs/zh-cn/book/namespacing.md @@ -0,0 +1,25 @@ +--- +title: 命名空间 +sidebar: + order: 57 + label: 57. 命名空间 +--- + + +在 TypeScript 中,命名空间用于将代码组织到逻辑容器中,防止命名冲突并提供一种将相关代码分组在一起的方法。使用关键字 `export` 允许在"外部"模块中访问名称空间。 + +```typescript +export namespace MyNamespace { + export interface MyInterface1 { + prop1: boolean; + } + export interface MyInterface2 { + prop2: string; + } +} + +const a: MyNamespace.MyInterface1 = { + prop1: true, +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/narrowing.md b/website/src/content/docs/zh-cn/book/narrowing.md new file mode 100644 index 00000000..42230f78 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/narrowing.md @@ -0,0 +1,107 @@ +--- +title: 缩小范围 +sidebar: + order: 20 + label: 20. 缩小范围 +--- + + +TypeScript 缩小范围是细化条件块内变量类型的过程。这在使用联合类型时很有用,其中一个变量可以有多个类型。 + +TypeScript 可识别多种缩小类型范围的方法: + +### typeof 类型保护 + +typeof 类型保护是 TypeScript 中的一种特定类型保护,它根据变量的内置 JavaScript 类型检查变量的类型。 + +```typescript +const fn = (x: number | string) => { + if (typeof x === 'number') { + return x + 1; // x 是数字 + } + return -1; +}; +``` + +### 真实性缩小 + +TypeScript 中的真实性缩小是通过检查变量是真还是假来相应地缩小其类型来实现的。 + +```typescript +const toUpperCase = (name: string | null) => { + if (name) { + return name.toUpperCase(); + } else { + return null; + } +}; +``` + +### 相等缩小 + +TypeScript 中的相等缩小通过检查变量是否等于特定值来相应缩小其类型。 + +它与`switch`语句和等号运算符(例如`===`、`!==`、`==`和`!=`)结合使用来缩小类型范围。 + +```typescript +const checkStatus = (status: 'success' | 'error') => { + switch (status) { + case 'success': + return true + case 'error': + return null + } +}; +``` + +### In运算符缩小 + +TypeScript 中的 `in` 运算符缩小范围是一种根据变量类型中是否存在属性来缩小变量类型的方法。 + +```typescript +type Dog = { + name: string; + breed: string; +}; + +type Cat = { + name: string; + likesCream: boolean; +}; + +const getAnimalType = (pet: Dog | Cat) => { + if ('breed' in pet) { + return 'dog'; + } else { + return 'cat'; + } +}; +``` + +### instanceof 缩小 + +TypeScript 中的 `instanceof` 运算符缩小是一种根据变量的构造函数缩小变量类型的方法,方法是检查对象是否是某个类或接口的实例。 + +```typescript +class Square { + constructor(public width: number) {} +} +class Rectangle { + constructor( + public width: number, + public height: number + ) {} +} +function area(shape: Square | Rectangle) { + if (shape instanceof Square) { + return shape.width * shape.width; + } else { + return shape.width * shape.height; + } +} +const square = new Square(5); +const rectangle = new Rectangle(5, 10); +console.log(area(square)); // 25 +console.log(area(rectangle)); // 50 +``` + diff --git a/website/src/content/docs/zh-cn/book/never-type.md b/website/src/content/docs/zh-cn/book/never-type.md new file mode 100644 index 00000000..b2e5f3cf --- /dev/null +++ b/website/src/content/docs/zh-cn/book/never-type.md @@ -0,0 +1,47 @@ +--- +title: Never类型 +sidebar: + order: 47 + label: 47. Never类型 +--- + + +`never` 类型表示从未出现过的值。它用于表示从不返回或抛出错误的函数或表达式。 + +例如无限循环: + +```typescript +const infiniteLoop = (): never => { + while (true) { + // 做点什么 + } +}; +``` + +抛出错误: + +```typescript +const throwError = (message: string): never => { + throw new Error(message); +}; +``` + +`never` 类型对于确保类型安全和捕获代码中的潜在错误很有用。当与其他类型和控制流语句结合使用时,它可以帮助 TypeScript 分析和推断更精确的类型,例如: + +```typescript +type Direction = 'up' | 'down'; +const move = (direction: Direction): void => { + switch (direction) { + case 'up': + // 向上移动 + break; + case 'down': + // 向下移动 + break; + default: + const exhaustiveCheck: never = direction; + throw new Error(`Unhandled direction: ${exhaustiveCheck}`); + } +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/object-types.md b/website/src/content/docs/zh-cn/book/object-types.md new file mode 100644 index 00000000..f0efca02 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/object-types.md @@ -0,0 +1,38 @@ +--- +title: 对象类型 +sidebar: + order: 27 + label: 27. 对象类型 +--- + + +在 TypeScript 中,对象类型描述对象的形状。它们指定对象属性的名称和类型,以及这些属性是必需的还是可选的。 + +在 TypeScript 中,您可以通过两种主要方式定义对象类型: + +通过指定对象属性的名称、类型和可选性来定义对象的形状的接口。 + +```typescript +interface User { + name: string; + age: number; + email?: string; +} +``` + +类型别名与接口类似,定义了对象的形状。但是,它还可以基于现有类型或现有类型的组合创建新的自定义类型。这包括定义联合类型、交集类型和其他复杂类型。 + +```typescript +type Point = { + x: number; + y: number; +}; +``` + +也可以匿名定义类型: + +```typescript +const sum = (x: { a: number; b: number }) => x.a + x.b; +console.log(sum({ a: 5, b: 1 })); +``` + diff --git a/website/src/content/docs/zh-cn/book/optional-properties.md b/website/src/content/docs/zh-cn/book/optional-properties.md new file mode 100644 index 00000000..152594eb --- /dev/null +++ b/website/src/content/docs/zh-cn/book/optional-properties.md @@ -0,0 +1,27 @@ +--- +title: 可选属性 +sidebar: + order: 12 + label: 12. 可选属性 +--- + + +对象可以通过在属性名称末尾添加问号 `?` 来指定可选属性: + +```typescript +type X = { + a: number; + b?: number; // 可选的 +}; +``` + +当属性是可选的时,可以指定默认值 + +```typescript +type X = { + a: number; + b?: number; +}; +const x = ({ a, b = 100 }: X) => a + b; +``` + diff --git a/website/src/content/docs/zh-cn/book/others.md b/website/src/content/docs/zh-cn/book/others.md new file mode 100644 index 00000000..85a5090f --- /dev/null +++ b/website/src/content/docs/zh-cn/book/others.md @@ -0,0 +1,916 @@ +--- +title: 其他 +sidebar: + order: 61 + label: 61. 其他 +--- + + +### 错误和异常处理 + +TypeScript 允许您使用标准 JavaScript 错误处理机制捕获和处理错误: + +Try-Catch-Finally 块: + +```typescript +try { + // 可能会抛出异常的代码 +} catch (error) { + // 处理错误 +} finally { + // 总是会执行的代码, finally 是可选的 +} +``` + +您还可以处理不同类型的错误: + +```typescript +try { + // 可能会抛出不同类型错误的代码 +} catch (error) { + if (error instanceof TypeError) { + // 处理 TypeError + } else if (error instanceof RangeError) { + // 处理 RangeError + } else { + // 处理其他的错误 + } +} +``` + +自定义错误类型: + +可以通过扩展 Error 来指定更具体的错误 `class` : + +```typescript +class CustomError extends Error { + constructor(message: string) { + super(message); + this.name = 'CustomError'; + } +} + +throw new CustomError('This is a custom error.'); +``` + +### 混合类 + +Mixin 类允许您将多个类的行为组合并组合成一个类。它们提供了一种重用和扩展功能的方法,而不需要深层继承链。 + +```typescript +abstract class Identifiable { + name: string = ''; + logId() { + console.log('id:', this.name); + } +} +abstract class Selectable { + selected: boolean = false; + select() { + this.selected = true; + console.log('Select'); + } + deselect() { + this.selected = false; + console.log('Deselect'); + } +} +class MyClass { + constructor() {} +} + +// 扩展 MyClass 以包含可识别和可选择的行为 +interface MyClass extends Identifiable, Selectable {} + +// 将 mixins 应用于类的函数 +function applyMixins(source: any, baseCtors: any[]) { + baseCtors.forEach(baseCtor => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { + let descriptor = Object.getOwnPropertyDescriptor( + baseCtor.prototype, + name + ); + if (descriptor) { + Object.defineProperty(source.prototype, name, descriptor); + } + }); + }); +} + +// 将 mixins 应用到 MyClass +applyMixins(MyClass, [Identifiable, Selectable]); +let o = new MyClass(); +o.name = 'abc'; +o.logId(); +o.select(); +``` + +### 异步语言特性 + +由于 TypeScript 是 JavaScript 的超集,因此它内置了 JavaScript 的异步语言功能,例如: + +Promises: + +Promise 是一种处理异步操作及其结果的方法,使用 `.then()`和等方法 `.catch()` 来处理成功和错误条件。 + +要了解更多信息: + +Async/await: + +Async/await 关键字是一种为处理 Promise 提供看起来更同步的语法的方法。`async` 关键字用于定义异步函数,并且 `await` 关键字在异步函数中使用以暂停执行,直到 Promise 被解决或拒绝。 + +要了解更多信息: + + + +TypeScript 很好地支持以下 API: + +Fetch API: + + +Web Workers: + + +Shared Workers: + + +WebSocket: + + +### 迭代器和生成器 + +TypeScript 很好地支持交互器和生成器。 + +迭代器是实现迭代器协议的对象,提供了一种逐个访问集合或序列元素的方法。它是一个包含指向迭代中下一个元素的指针的结构。他们有一个 `next()` 方法返回序列中的下一个值以及指示序列是否为 的布尔值 `done` 。 + +```typescript +class NumberIterator implements Iterable { + private current: number; + + constructor( + private start: number, + private end: number + ) { + this.current = start; + } + + public next(): IteratorResult { + if (this.current <= this.end) { + const value = this.current; + this.current++; + return { value, done: false }; + } else { + return { value: undefined, done: true }; + } + } + + [Symbol.iterator](): Iterator { + return this; + } +} + +const iterator = new NumberIterator(1, 3); + +for (const num of iterator) { + console.log(num); +} +``` + +生成器是使用 `function*` 简化迭代器创建的语法定义的特殊函数。它们使用 `yield` 关键字来定义值的序列,并在请求值时自动暂停和恢复执行。 + +生成器使创建迭代器变得更加容易,并且对于处理大型或无限序列特别有用。 + +例子: + +```typescript +function* numberGenerator(start: number, end: number): Generator { + for (let i = start; i <= end; i++) { + yield i; + } +} + +const generator = numberGenerator(1, 5); + +for (const num of generator) { + console.log(num); +} +``` + +TypeScript 还支持异步迭代器和异步生成器。 + +要了解更多信息: + + + + + +### TsDocs JSDoc 参考 + +使用 JavaScript 代码库时,可以通过使用 JSDoc 注释和附加注释来提供类型信息,帮助 TypeScript 推断正确的类型。 + +例子: + +```typescript +/** + * Computes the power of a given number + * @constructor + * @param {number} base – The base value of the expression + * @param {number} exponent – The exponent value of the expression + */ +function power(base: number, exponent: number) { + return Math.pow(base, exponent); +} +power(10, 2); // function power(base: number, exponent: number): number +``` + +此链接提供了完整文档: + + +从版本 3.7 开始,可以从 JavaScript JSDoc 语法生成 .d.ts 类型定义。更多信息可以在这里找到: + + +### @types + +@types 组织下的包是特殊的包命名约定,用于为现有 JavaScript 库或模块提供类型定义。例如使用: + +```shell +npm install --save-dev @types/lodash +``` + +将在您当前的项目中安装 `lodash` 的类型定义。 + +要为 @types 包的类型定义做出贡献,请向 提交pr请求。 + +### JSX + +JSX (JavaScript XML) 是 JavaScript 语言语法的扩展,允许您在 JavaScript 或 TypeScript 文件中编写类似 HTML 的代码。它通常在 React 中用来定义 HTML 结构。 + +TypeScript 通过提供类型检查和静态分析来扩展 JSX 的功能。 + +要使用 JSX,您需要在文件 `tsconfig.json` 中设置 `jsx` 编译器选项。两个常见的配置选项: + +* "preserve": 触发 .jsx 文件且 JSX 不变. 此选项告诉 TypeScript 按原样保留 JSX 语法,而不是在编译过程中对其进行转换。 如果您有单独的工具(例如 Babel)来处理转换,则可以使用此选项。 +* "react": 启用 TypeScript 的内置 JSX 转换。 将使用 React.createElement 。 + +所有选项均可在此处使用: + + +### ES6 模块 + +TypeScript 确实支持 ES6 (ECMAScript 2015) 和许多后续版本。这意味着您可以使用 ES6 语法,例如箭头函数、模板文字、类、模块、解构等等。 + +要在项目中启用 ES6 功能,您可以在 `tsconfig.json` 中指定 `target` 属性。 + +配置示例: + +```json +{ + "compilerOptions": { + "target": "es6", + "module": "es6", + "moduleResolution": "node", + "sourceMap": true, + "outDir": "dist" + }, + "include": ["src"] +} +``` + +### ES7 求幂运算符 + +求幂 (`**`) 运算符计算通过将第一个操作数进行第二个操作数的幂获得的值。它的功能与 `Math.pow()` 类似,但增加了接受 BigInts 作为操作数的功能。TypeScript 完全支持在 `tsconfig.json` 文件中设置 `target` 为 `es2016`或更大版本来使用此运算符。 + +```typescript +console.log(2 ** (2 ** 2)); // 16 +``` + +### for-await-of 语句 + +这是 TypeScript 完全支持的 JavaScript 功能,它允许您从目标版本 `es2018` 迭代异步可迭代对象。 + +```typescript +async function* asyncNumbers(): AsyncIterableIterator { + yield Promise.resolve(1); + yield Promise.resolve(2); + yield Promise.resolve(3); +} + +(async () => { + for await (const num of asyncNumbers()) { + console.log(num); + } +})(); +``` + +### New.target + +您可以在 TypeScript 中使用 `new.target` 元属性,该属性使您能够确定是否使用 new 运算符调用函数或构造函数。它允许您检测对象是否是由于构造函数调用而创建的。 + +```typescript +class Parent { + constructor() { + console.log(new.target); // 记录用于创建实例的构造函数 + } +} + +class Child extends Parent { + constructor() { + super(); + } +} + +const parentX = new Parent(); // [Function: Parent] +const child = new Child(); // [Function: Child] +``` + +### 动态导入表达式 + +可以使用 TypeScript 支持的动态导入 ECMAScript 建议有条件地加载模块或按需延迟加载模块。 + +TypeScript 中动态导入表达式的语法如下: + + +```typescript +async function renderWidget() { + const container = document.getElementById('widget'); + if (container !== null) { + const widget = await import('./widget'); // 动态导入 + widget.render(container); + } +} + +renderWidget(); +``` + +### "tsc –watch" + +此命令使用 `--watch` 参数启动 TypeScript 编译器,能够在修改 TypeScript 文件时自动重新编译它们。 + +```shell +tsc --watch +``` + +从 TypeScript 4.9 版本开始,文件监控主要依赖于文件系统事件,如果无法建立基于事件的观察程序,则会自动诉诸轮询。 + +### 默认声明 + +当为变量或参数分配默认值时,将使用默认声明。这意味着如果没有为该变量或参数提供值,则将使用默认值。 + +```typescript +function greet(name: string = 'Anonymous'): void { + console.log(`Hello, ${name}!`); +} +greet(); // Hello, Anonymous! +greet('John'); // Hello, John! +``` + +### 可选链 + +可选的链接运算符 `?.` 与常规点运算符 (`.`) 一样用于访问属性或方法。但是,它通过优雅处理 `undefined` 和 `null` 来终止表达式并返回 `undefined`,而不是抛出错误。 + +```typescript +type Person = { + name: string; + age?: number; + address?: { + street?: string; + city?: string; + }; +}; + +const person: Person = { + name: 'John', +}; + +console.log(person.address?.city); // undefined +``` + +### 空合并运算符 (??) + +如果 `??` 左侧是 `null` 或者 `undefined` ,则空合并运算符返回右侧值,否则,它返回左侧值。 + +```typescript +const foo = null ?? 'foo'; +console.log(foo); // foo + +const baz = 1 ?? 'baz'; +const baz2 = 0 ?? 'baz'; +console.log(baz); // 1 +console.log(baz2); // 0 +``` + +### 模板字符串类型 + +模板字符串类型允许在类型级别操作字符串值并基于现有字符串生成新的字符串类型。它们对于从基于字符串的操作创建更具表现力和更精确的类型非常有用。 + +```typescript +type Department = 'enginnering' | 'hr'; +type Language = 'english' | 'spanish'; +type Id = `${Department}-${Language}-id`; // "enginnering-english-id" | "enginnering-spanish-id" | "hr-english-id" | "hr-spanish-id" +``` + +### 函数重载 + +函数重载允许您为同一函数名定义多个函数签名,每个函数签名具有不同的参数类型和返回类型。当您调用重载函数时,TypeScript 使用提供的参数来确定正确的函数签名: + +```typescript +function makeGreeting(name: string): string; +function makeGreeting(names: string[]): string[]; + +function makeGreeting(person: unknown): unknown { + if (typeof person === 'string') { + return `Hi ${person}!`; + } else if (Array.isArray(person)) { + return person.map(name => `Hi, ${name}!`); + } + throw new Error('Unable to greet'); +} + +makeGreeting('Simon'); +makeGreeting(['Simone', 'John']); +``` + +### 递归类型 + +递归类型是可以引用自身的类型。 这对于定义具有分层或递归结构(可能无限嵌套)的数据结构非常有用,例如链表、树和图。 + +```typescript +type ListNode = { + data: T; + next: ListNode | undefined; +}; +``` + +### 递归条件类型 + +可以使用 TypeScript 中的逻辑和递归来定义复杂的类型关系。让我们简单地分解一下: + +条件类型:允许您基于布尔条件定义类型: + +```typescript +type CheckNumber = T extends number ? 'Number' : 'Not a number'; +type A = CheckNumber<123>; // 'Number' +type B = CheckNumber<'abc'>; // 'Not a number' +``` + +递归:是指在自己的定义中引用自身的类型定义: + +```typescript +type Json = string | number | boolean | null | Json[] | { [key: string]: Json }; + +const data: Json = { + prop1: true, + prop2: 'prop2', + prop3: { + prop4: [], + }, +}; +``` + +递归条件类型结合了条件逻辑和递归。这意味着类型定义可以通过条件逻辑依赖于自身,从而创建复杂且灵活的类型关系。 + +```typescript +type Flatten = T extends Array ? Flatten : T; + +type NestedArray = [1, [2, [3, 4], 5], 6]; +type FlattenedArray = Flatten; // 2 | 3 | 4 | 5 | 1 | 6 +``` + +### Node.js 中的 ECMAScript 模块支持 + +Node.js 从 15.3.0 版本开始添加了对 ECMAScript 模块的支持,而 TypeScript 从 4.7 版本开始增加了对 Node.js 的 ECMAScript 模块支持。可以通过将 `tsconfig.json` 文件中的`module`属性的值设置为 `nodenext` 来启用此支持。这是一个例子: + +```json +{ + "compilerOptions": { + "module": "nodenext", + "outDir": "./lib", + "declaration": true + } +} +``` + +Node.js 支持两种模块文件扩展名:`.mjs` 的ES 模块和 `.cjs` 的CommonJS 模块。TypeScript 中的等效文件扩展名适用 `.mts` 于 ES 模块和 `.cts` 于CommonJS 模块。当 TypeScript 编译器将这些文件转译为 JavaScript 时,它将分别创建 `.mjs` 和 `.cjs` 文件。 + +如果您想在项目中使用 ES 模块,可以type在 package.json 文件中将该属性设置为"module"。这指示 Node.js 将项目视为 ES 模块项目。 + +此外,TypeScript 还支持 .d.ts 文件中的类型声明。这些声明文件为用 TypeScript 编写的库或模块提供类型信息,允许其他开发人员通过 TypeScript 的类型检查和自动完成功能来利用它们。 + +### 断言函数 + +在 TypeScript 中,断言函数是根据返回值指示特定条件验证的函数。在最简单的形式中,断言函数检查提供的谓词,并在谓词计算结果为 false 时引发错误。 + +```typescript +function isNumber(value: unknown): asserts value is number { + if (typeof value !== 'number') { + throw new Error('Not a number'); + } +} +``` + +或者可以声明为函数表达式: + +```typescript +type AssertIsNumber = (value: unknown) => asserts value is number; +const isNumber: AssertIsNumber = value => { + if (typeof value !== 'number') { + throw new Error('Not a number'); + } +}; +``` + +断言函数与类型保护有相似之处。类型保护最初是为了执行运行时检查并确保值的类型在特定范围内而引入的。具体来说,类型保护是一个计算类型谓词并返回指示谓词是真还是假的布尔值的函数。这与断言函数略有不同,断言函数的目的是在不满足谓词时抛出错误而不是返回 false。 + +类型保护示例: + +```typescript +const isNumber = (value: unknown): value is number => typeof value === 'number'; +``` + +### 可变参数元组类型 + +可变元组类型是 TypeScript 4.0 版本中引入的一个功能,让我们通过回顾什么是元组来开始学习它们: + +元组类型是一个具有定义长度的数组,并且每个元素的类型已知: + +```typescript +type Student = [string, number]; +const [name, age]: Student = ['Simone', 20]; +``` + +术语"可变参数"意味着不定数量(接受可变数量的参数)。 + +可变参数元组是一种元组类型,它具有以前的所有属性,但确切的形状尚未定义: + +```typescript +type Bar = [boolean, ...T, number]; + +type A = Bar<[boolean]>; // [boolean, boolean, number] +type B = Bar<['a', 'b']>; // [boolean, 'a', 'b', number] +type C = Bar<[]>; // [boolean, number] +``` + +在前面的代码中我们可以看到元组形状是由T传入的泛型定义的。 + +可变参数元组可以接受多个泛型,这使得它们非常灵活: + +```typescript +type Bar = [...T, boolean, ...G]; + +type A = Bar<[number], [string]>; // [number, boolean, string] +type B = Bar<['a', 'b'], [boolean]>; // ["a", "b", boolean, boolean] +``` + +使用新的可变参数元组,我们可以使用: + +* 元组类型语法中的扩展现在可以是通用的,因此即使我们不知道我们正在操作的实际类型,我们也可以表示元组和数组上的高阶操作 +* 其余元素可以出现在元组中的任何位置。 + +例子: + +```typescript +type Items = readonly unknown[]; + +function concat( + arr1: T, + arr2: U +): [...T, ...U] { + return [...arr1, ...arr2]; +} + +concat([1, 2, 3], ['4', '5', '6']); // [1, 2, 3, "4", "5", "6"] +``` + +### 装箱类型 + +装箱类型是指用于将基本类型表示为对象的包装对象。这些包装器对象提供了原始值无法直接使用的附加功能和方法。 + +当你访问原始 `string` 上的 `charAt` 或者 `normalize` 方法时,JavaScript 将其包装在 `String` 类型的对象中,调用该方法,然后丢弃该对象 + +示范: + +```typescript +const originalNormalize = String.prototype.normalize; +String.prototype.normalize = function () { + console.log(this, typeof this); + return originalNormalize.call(this); +}; +console.log('\u0041'.normalize()); +``` + +TypeScript 通过为原语及其相应的对象包装器提供单独的类型来表示这种区别: + +* string => String +* number => Number +* boolean => Boolean +* symbol => Symbol +* bigint => BigInt + +通常不需要盒装类型。避免使用装箱类型,而是使用基元类型,例如 `string` 代替 `String`。 + +### TypeScript 中的协变和逆变 + +协变和逆变用于描述在处理类型的继承或赋值时关系如何工作。 + +协变意味着类型关系保留继承或赋值的方向,因此如果类型 A 是类型 B 的子类型,则类型 A 的数组也被视为类型 B 的数组的子类型。这里需要注意的重要事项是维持子类型关系,这意味着协变接受子类型但不接受超类型。 + +逆变意味着类型关系颠倒了继承或赋值的方向,因此如果类型 A 是类型 B 的子类型,则类型 B 的数组被视为类型 A 数组的子类型。子类型关系颠倒了,这意味着该逆变接受超类型但不接受子类型。 + +注意:双变量意味着同时接受超类型和子类型。 + +示例:假设我们有一个适合所有动物的空间和一个专门适合狗的单独空间。 + +在协方差中,您可以将所有狗放入动物空间中,因为狗是一种动物。但你不能把所有的动物都放在狗的空间里,因为可能还有其他动物混在一起。 + +在逆变中,您不能将所有动物放入狗空间中,因为动物空间也可能包含其他动物。然而,你可以把所有的狗都放在动物空间里,因为所有的狗也是动物。 + + +```typescript +// 协变示例 +class Animal { + name: string; + constructor(name: string) { + this.name = name; + } +} + +class Dog extends Animal { + breed: string; + constructor(name: string, breed: string) { + super(name); + this.breed = breed; + } +} + +let animals: Animal[] = []; +let dogs: Dog[] = []; + +// 协变允许将子类型(狗)数组分配给超类型(动物)数组 +animals = dogs; +dogs = animals; // 无效: 'Animal[]' 不能赋值给 'Dog[]' + +// 逆变示例 +type Feed = (animal: T) => void; + +let feedAnimal: Feed = (animal: Animal) => { + console.log(`Animal name: ${animal.name}`); +}; + +let feedDog: Feed = (dog: Dog) => { + console.log(`Dog name: ${dog.name}, Breed: ${dog.breed}`); +}; + +// 逆变允许将超类型(动物)回调赋值给子类型(狗)回调 +feedDog = feedAnimal; +feedAnimal = feedDog; // 无效: Type 'Feed' 不能赋值给 'Feed'. +``` + +在 TypeScript 中,数组的类型关系是协变的,而函数参数的类型关系是逆变的。这意味着 TypeScript 同时表现出协变和逆变,具体取决于上下文。 + +#### 类型参数的可选方差注释 + +从 TypeScript 4.7.0 开始,我们可以使用out和in关键字来具体说明方差注释。 + +对于协变,使用out关键字: + +```typescript +type AnimalCallback = () => T; // 此处 T 是协变的 +``` + +对于逆变,使用in关键字: + +```typescript +type AnimalCallback = (value: T) => void; // 此处 T 是逆变的 +``` + +### 模板字符串模式索引签名 + +模板字符串模式索引签名允许我们使用模板字符串模式定义灵活的索引签名。 此功能使我们能够创建可以使用特定字符串键模式进行索引的对象,从而在访问和操作属性时提供更多控制和特异性。 + +TypeScript 4.4 版开始允许符号和模板字符串模式的索引签名。 + +```typescript +const uniqueSymbol = Symbol('description'); + +type MyKeys = `key-${string}`; + +type MyObject = { + [uniqueSymbol]: string; + [key: MyKeys]: number; +}; + +const obj: MyObject = { + [uniqueSymbol]: 'Unique symbol key', + 'key-a': 123, + 'key-b': 456, +}; + +console.log(obj[uniqueSymbol]); // Unique symbol key +console.log(obj['key-a']); // 123 +console.log(obj['key-b']); // 456 +``` + +### satisfies操作符 + +`satisfies` 允许您检查给定类型是否满足特定接口或条件。换句话说,它确保类型具有特定接口所需的所有属性和方法。这是确保变量适合类型定义的一种方法。 + +下面是一个示例: + + +```typescript +type Columns = 'name' | 'nickName' | 'attributes'; + +type User = Record; + +// `User`的类型注释 +const user: User = { + name: 'Simone', + nickName: undefined, + attributes: ['dev', 'admin'], +}; + +// 在以下几行中,TypeScript 将无法正确推断 +user.attributes?.map(console.log); // 'string | string[]' 中不存在属性 'map'。'string' 中不存在属性 'map'。 +user.nickName; // string | string[] | undefined + +// 类型断言 `as` +const user2 = { + name: 'Simon', + nickName: undefined, + attributes: ['dev', 'admin'], +} as User; + +// 这里也一样的, TypeScript 将无法正确推断 +user2.attributes?.map(console.log); //'string | string[]' 中不存在属性 'map'。'string' 中不存在属性 'map'。 +user2.nickName; // string | string[] | undefined + +// 使用"satisfies"运算符我们现在可以正确推断类型 +const user3 = { + name: 'Simon', + nickName: undefined, + attributes: ['dev', 'admin'], +} satisfies User; + +user3.attributes?.map(console.log); // TypeScript 推断正确: string[] +user3.nickName; // TypeScript 推断正确: undefined +``` + +### 仅类型导入和导出 + +仅类型导入和导出允许您导入或导出类型,而无需导入或导出与这些类型关联的值或函数。 这对于减小捆绑包的大小很有用。 + +要使用仅类型导入,您可以使用`import type`关键字。 + +TypeScript 允许在仅类型导入中使用声明和实现文件扩展名(.ts、.mts、.cts 和 .tsx),无论`allowImportingTsExtensions`设置如何。 + +例如: + + +```typescript +import type { House } from './house.ts'; +``` + +以下是支持的形式: + + +```typescript +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; +export type { T }; +export type { T } from './mod'; +``` + +### 使用声明和显式资源管理 + +"using"声明是块范围的、不可变的绑定,类似于"const",用于管理一次性资源。 当使用值初始化时,该值的"Symbol.dispose"方法将被记录,并随后在退出封闭块作用域时执行。 + +这是基于 ECMAScript 的资源管理功能,该功能对于在对象创建后执行基本的清理任务非常有用,例如关闭连接、删除文件和释放内存。 + +笔记: + +* 由于最近在 TypeScript 5.2 版中引入,大多数运行时缺乏本机支持。 您将需要以下功能的填充:`Symbol.dispose`、`Symbol.asyncDispose`、`DisposableStack`、`AsyncDisposableStack`、`SuppressedError`。 +* 此外,您需要按如下方式配置 tsconfig.json: + +```json +{ + "compilerOptions": { + "target": "es2022", + "lib": ["es2022", "esnext.disposable", "dom"] + } +} +```` + +例子: + + +```typescript +//@ts-ignore +Symbol.dispose ??= Symbol('Symbol.dispose'); // 简单的兼容性填充 + +const doWork = (): Disposable => { + return { + [Symbol.dispose]: () => { + console.log('disposed'); + }, + }; +}; + +console.log(1); + +{ + using work = doWork(); // 资源被声明 + console.log(2); +} // 资源被释放 (例如, `work[Symbol.dispose]()` 被执行) + +console.log(3); +``` + +该代码将记录: + +```shell +1 +2 +disposed +3 +``` + +符合处置条件的资源必须遵守 `Disposable` 接口: + +```typescript +// lib.esnext.disposable.d.ts +interface Disposable { + [Symbol.dispose](): void; +} +``` + +"using"声明在堆栈中记录资源处置操作,确保它们以与声明相反的顺序处置: + + +```typescript +{ + using j = getA(), + y = getB(); + using k = getC(); +} // 先释放 `C`, 然后 `B`, 然后 `A`. +``` + +即使发生后续代码或异常,也保证会释放资源。 这可能会导致处置可能引发异常,并可能抑制另一个异常。 为了保留有关被抑制错误的信息,引入了一个新的本机异常"SuppressedError"。 + +#### 使用声明等待 + +"await using"声明处理异步一次性资源。 该值必须具有"Symbol.asyncDispose"方法,该方法将在块末尾等待。 + + +```typescript +async function doWorkAsync() { + await using work = doWorkAsync(); // 资源被声明 +} // // 资源被释放 (例如, `await work[Symbol.asyncDispose]()` 被执行) +``` + +对于异步可处置资源,它必须遵守"Disposable"或"AsyncDisposable"接口: + +```typescript +// lib.esnext.disposable.d.ts +interface AsyncDisposable { + [Symbol.asyncDispose](): Promise; +} +``` + + +```typescript +//@ts-ignore +Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose'); // Simple polify + +class DatabaseConnection implements AsyncDisposable { + // 当对象被异步释放时会被调用的方法 + [Symbol.asyncDispose]() { + // Close the connection and return a promise + return this.close(); + } + + async close() { + console.log('Closing the connection...'); + await new Promise(resolve => setTimeout(resolve, 1000)); + console.log('Connection closed.'); + } +} + +async function doWork() { + // 创建一个新的连接,并在其超出作用域时进行异步释放 + await using connection = new DatabaseConnection(); // 资源被声明 + console.log('Doing some work...'); +} // 资源被释放 (例如, `await connection[Symbol.asyncDispose]()` 被执行) + +doWork(); +``` + +代码日志: + +```shell +Doing some work... +Closing the connection... +Connection closed. +``` + +语句中允许使用"using"和"await using"声明:"for"、"for-in"、"for-of"、"for-await-of"、"switch"。 diff --git a/website/src/content/docs/zh-cn/book/overloads.md b/website/src/content/docs/zh-cn/book/overloads.md new file mode 100644 index 00000000..269eaa4d --- /dev/null +++ b/website/src/content/docs/zh-cn/book/overloads.md @@ -0,0 +1,56 @@ +--- +title: 重载 +sidebar: + order: 51 + label: 51. 重载 +--- + + +TypeScript 中的函数重载允许您为单个函数名称定义多个函数签名,从而使您能够定义可以多种方式调用的函数。这是一个例子: + +```typescript +// 重载 +function sayHi(name: string): string; +function sayHi(names: string[]): string[]; + +// 实现 +function sayHi(name: unknown): unknown { + if (typeof name === 'string') { + return `Hi, ${name}!`; + } else if (Array.isArray(name)) { + return name.map(name => `Hi, ${name}!`); + } + throw new Error('Invalid value'); +} + +sayHi('xx'); // 有效 +sayHi(['aa', 'bb']); // 有效 +``` + +这是在 `class` 中使用函数重载的另一个示例: + +```typescript +class Greeter { + message: string; + + constructor(message: string) { + this.message = message; + } + + // 重载 + sayHi(name: string): string; + sayHi(names: string[]): ReadonlyArray; + + // 实现 + sayHi(name: unknown): unknown { + if (typeof name === 'string') { + return `${this.message}, ${name}!`; + } else if (Array.isArray(name)) { + return name.map(name => `${this.message}, ${name}!`); + } + throw new Error('value is invalid'); + } +} +console.log(new Greeter('Hello').sayHi('Simon')); +``` + diff --git a/website/src/content/docs/zh-cn/book/predefined-conditional-types.md b/website/src/content/docs/zh-cn/book/predefined-conditional-types.md new file mode 100644 index 00000000..aa0afa56 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/predefined-conditional-types.md @@ -0,0 +1,26 @@ +--- +title: 预定义条件类型 +sidebar: + order: 42 + label: 42. 预定义条件类型 +--- + + +在 TypeScript 中,预定义的条件类型是语言提供的内置条件类型。它们旨在根据给定类型的特征执行常见的类型转换。 + +`Exclude`: 此类型从 Type 中删除可分配给 ExcludedType 的所有类型。 + +`Extract`: 此类型从 Union 中提取可分配给 Type 的所有类型。 + +`NonNullable`: 此类型从 Type 中删除 null 和 undefined。 + +`ReturnType`: 此类型提取函数 Type 的返回类型。 + +`Parameters`: 该类型提取函数类型的参数类型。 + +`Required`: 此类型使 Type 中的所有属性成为必需。 + +`Partial`: 此类型使 Type 中的所有属性都是可选的。 + +`Readonly`: 此类型使 Type 中的所有属性变为只读。 + diff --git a/website/src/content/docs/zh-cn/book/primitive-types.md b/website/src/content/docs/zh-cn/book/primitive-types.md new file mode 100644 index 00000000..9a5d3355 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/primitive-types.md @@ -0,0 +1,116 @@ +--- +title: 原始类型 +sidebar: + order: 10 + label: 10. 原始类型 +--- + + +TypeScript 支持 7 种基本类型。原始数据类型是指不是对象并且没有任何与其关联的方法的类型。在 TypeScript 中,所有原始类型都是不可变的,这意味着它们的值一旦分配就无法更改。 + +### string + +原始 `string` 类型存储文本数据,并且值始终是双引号或单引号的。 + +```typescript +const x: string = 'x'; +const y: string = 'y'; +``` + +如果字符串被反引号 (`) 字符包围,则字符串可以跨越多行: + +```typescript +let sentence: string = `xxx, + yyy`; +``` + +### boolean + +TypeScript 中的数据 `boolean` 类型存储二进制值,或者true或false。 + +```typescript +const isReady: boolean = true; +``` + +### number + +TypeScript 中的数据类型 `number` 用 64 位浮点值表示。类型 `number` 可以表示整数和分数。TypeScript 还支持十六进制、二进制和八进制,例如: + +```typescript +const decimal: number = 10; +const hexadecimal: number = 0xa00d; // 十六进制数以 0x 开始 +const binary: number = 0b1010; // 二进制数以 0b 开始 +const octal: number = 0o633; // 八进制数以 0o 开始 +``` + +### bigInt + +`bigInt` 表示无法用 `number` 表示的非常大的数值 (253 – 1)。 + +`bigInt` 可以通过调用内置函数 `BigInt()` 或添加 `n` 到任何整数数字字面量的末尾来创建: + +```typescript +const x: bigint = BigInt(9007199254740991); +const y: bigint = 9007199254740991n; +``` + +笔记: + +* `bigInt` 值不能与 `number` 混合,也不能与内置的 `Math` 一起使用,它们必须强制为相同的类型。 +* 仅当目标配置为 ES2020 或更高版本时,“bigInt”值才可用。 + +### symbol + +JavaScript 有一个原始函数 Symbol(),它创建一个全局唯一的引用。 + +```typescript +let sym = Symbol('x'); // symbol 类型 +``` + +### null and undefined + +`null`和 `undefined` 类型都表示没有值或不存在任何值。 + +`undefined` 类型意味着该值未分配或初始化,或者指示无意中缺少值。 + +`null` 类型意味着我们知道该字段没有值,因此值不可用,这表明故意不存在值。 + +### Array + +`array` 是一种可以存储多个相同类型或不同类型的值的数据类型。可以使用以下语法定义它: + +```typescript +const x: string[] = ['a', 'b']; +const y: Array = ['a', 'b']; +const j: Array = ['a', 1, 'b', 2]; +``` + +TypeScript 使用以下语法支持只读数组: + + +```typescript +const x: readonly string[] = ['a', 'b']; // 只读修饰符 +const y: ReadonlyArray = ['a', 'b']; +const j: ReadonlyArray = ['a', 1, 'b', 2]; +j.push('x'); // 有效 +``` + +TypeScript 支持数组和只读数组: + +```typescript +const x: [string, number] = ['a', 1]; +const y: readonly [string, number] = ['a', 1]; +``` + +### any + +数据 `any` 类型字面上代表"任何"值,当 TypeScript 无法推断类型或未指定时,它是默认值。 + +使用 `any` 时,TypeScript编译器会跳过类型检查,因此 `any` 使用时不存在类型安全。通常,当发生错误时不要使用 `any` 静默编译器,而是专注于修复错误,因为使用 `any` 它可能会破坏契约,并且我们会失去 TypeScript 自动完成的好处。 + +在从 JavaScript 逐步迁移到 TypeScript 的过程中,该 `any` 类型可能很有用,因为它可以让编译器保持沉默。 + +对于新项目,请使用 TypeScript 配置 `noImplicitAny` ,该配置使 TypeScript 能够在any使用或推断时发出错误。 + +`any` 通常是错误的来源,它可以掩盖类型的实际问题。尽可能避免使用它。 + diff --git a/website/src/content/docs/zh-cn/book/readonly-properties.md b/website/src/content/docs/zh-cn/book/readonly-properties.md new file mode 100644 index 00000000..902c7c3f --- /dev/null +++ b/website/src/content/docs/zh-cn/book/readonly-properties.md @@ -0,0 +1,28 @@ +--- +title: 只读属性 +sidebar: + order: 13 + label: 13. 只读属性 +--- + + +是否可以通过使用修饰符来防止对属性进行写入,`readonly` 以确保该属性不能被重写,但不提供任何完全不变性的保证: + +```typescript +interface Y { + readonly a: number; +} + +type X = { + readonly a: number; +}; + +type J = Readonly<{ + a: number; +}>; + +type K = { + readonly [index: number]: string; +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/strictnullchecks.md b/website/src/content/docs/zh-cn/book/strictnullchecks.md new file mode 100644 index 00000000..ebd2d3bc --- /dev/null +++ b/website/src/content/docs/zh-cn/book/strictnullchecks.md @@ -0,0 +1,10 @@ +--- +title: 严格空检查 +sidebar: + order: 18 + label: 18. 严格空检查 +--- + + +`strictNullChecks` 是一个 TypeScript 编译器选项,强制执行严格的 null 检查。启用此选项后,只有在变量和参数已使用联合类型 `null` | `undefined` 显式声明为该类型时,才可以对其进行赋值`null` 或者 `undefined`。如果变量或参数未显式声明为可为空,TypeScript 将生成错误以防止潜在的运行时错误。 + diff --git a/website/src/content/docs/zh-cn/book/symbols.md b/website/src/content/docs/zh-cn/book/symbols.md new file mode 100644 index 00000000..aa977906 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/symbols.md @@ -0,0 +1,27 @@ +--- +title: Symbols +sidebar: + order: 58 + label: 58. Symbols +--- + + +符号是一种原始数据类型,表示不可变值,保证在程序的整个生命周期中全局唯一。 + +符号可以用作对象属性的键,并提供一种创建不可枚举属性的方法。 + +```typescript +const key1: symbol = Symbol('key1'); +const key2: symbol = Symbol('key2'); + +const obj = { + [key1]: 'value 1', + [key2]: 'value 2', +}; + +console.log(obj[key1]); // value 1 +console.log(obj[key2]); // value 2 +``` + +在 WeakMap 和 WeakSet 中,现在允许符号作为键。 + diff --git a/website/src/content/docs/zh-cn/book/table-of-contents.md b/website/src/content/docs/zh-cn/book/table-of-contents.md new file mode 100644 index 00000000..68efba99 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/table-of-contents.md @@ -0,0 +1,219 @@ +--- +title: 目录表 +sidebar: + order: 4 + label: 4. 目录表 +--- + + + +- 简洁的TypeScript之书 + - 翻译 + - 下载 + - 目录表 + - 介绍 + - 关于作者 + - TypeScript简介 + - 什么是TypeScript? + - 为什么选择 TypeScript? + - TypeScript 和 JavaScript + - TypeScript 代码生成 + - 现在的现代 JavaScript(降级) + - TypeScript 入门 + - 安装 + - 配置 + - TypeScript 的配置文件 tsconfig.json + - target + - lib + - strict + - module + - moduleResolution + - esModuleInterop + - jsx + - skipLibCheck + - files + - include + - exclude + - importHelpers + - 迁移到 TypeScript 的建议 + - 探索类型系统 + - TypeScript 的语言服务 + - 结构类型 + - TypeScript 的基本比较规则 + - 类型作为集合 + - 赋值类型:类型声明和类型断言 + - 类型声明 + - 类型断言 + - 非空断言 + - 环境声明 + - 属性检测和多余属性检测 + - 弱类型 + - 严格的对象字面量检测 (Freshness) + - 类型推断 + - 更高级的推断 + - 类型加宽 + - 常量 + - 类型参数的 const 修饰符 + - 常量断言 + - 显式类型注释 + - 类型缩小 + - 条件 + - 抛错或者返回 + - 可区分联合 + - 用户定义的类型保护 + - 原始类型 + - string + - boolean + - number + - bigInt + - symbol + - null and undefined + - Array + - any + - 类型注释 + - 可选属性 + - 只读属性 + - 索引签名 + - 扩展类型 + - 字面量类型 + - 字面量推断 + - 严格空检查 + - 枚举 + - 数字枚举 + - 字符串枚举 + - 常量枚举 + - 反向映射 + - 环境枚举 + - 计算成员和常量成员 + - 缩小范围 + - typeof 类型保护 + - 真实性缩小 + - 相等缩小 + - In运算符缩小 + - instanceof 缩小 + - 赋值 + - 控制流分析 + - 类型谓词 + - 可区分联合 + - never 类型 + - 详尽性检查 + - 对象类型 + - 元组类型(匿名) + - 命名元组类型(已标记) + - 固定长度元组 + - 联合类型 + - 交集类型 + - 类型索引 + - 值的类型 + - Func 返回值的类型 + - 模块的类型 + - 映射类型 + - 映射类型修饰符 + - 条件类型 + - 分配条件类型 + - infer 条件类型中的类型推断 + - 预定义条件类型 + - 模板联合类型 + - 任意类型 + - 未知类型 + - 空类型 + - Never类型 + - 接口及类型 + - 通用语法 + - 基本类型 + - 对象和接口 + - 并集和交集类型 + - 内置原始数据类型 + - 常见的内置JS对象 + - 重载 + - 合并与扩展 + - 类型和接口之间的差异 + - Class + - 通用语法 + - 构造函数 + - 私有和受保护的构造函数 + - 访问修饰符 + - Get 与 Set + - 类中的自动访问器 + - this + - 参数属性 + - 抽象类 + - 使用泛型 + - 装饰器 + - 类装饰器 + - 属性装饰器 + - 方法装饰器 + - Getter 和 Setter 装饰器 + - 装饰器元数据 + - 继承 + - 静态成员 + - 属性初始化 + - 方法重载 + - 泛型 + - 泛型类型 + - 泛型类 + - 泛型约束 + - 泛型上下文缩小 + - 擦除的结构类型 + - 命名空间 + - Symbols + - 三斜杠指令 + - 类型操作 + - 从类型创建类型 + - 索引访问类型 + - 工具类型 + - Awaited\ + - Partial\ + - Required\ + - Readonly\ + - Record\ + - Pick\ + - Omit\ + - Exclude\ + - Extract\ + - NonNullable\ + - Parameters\ + - ConstructorParameters\ + - ReturnType\ + - InstanceType\ + - ThisParameterType\ + - OmitThisParameter\ + - ThisType\ + - Uppercase\ + - Lowercase\ + - Capitalize\ + - Uncapitalize\ + - 其他 + - 错误和异常处理 + - 混合类 + - 异步语言特性 + - 迭代器和生成器 + - TsDocs JSDoc 参考 + - @types + - JSX + - ES6 模块 + - ES7 求幂运算符 + - for-await-of 语句 + - New.target + - 动态导入表达式 + - "tsc –watch" + - 默认声明 + - 可选链 + - 空合并运算符 (??) + - 模板字符串类型 + - 函数重载 + - 递归类型 + - 递归条件类型 + - Node.js 中的 ECMAScript 模块支持 + - 断言函数 + - 可变参数元组类型 + - 装箱类型 + - TypeScript 中的协变和逆变 + - 类型参数的可选方差注释 + - 模板字符串模式索引签名 + - satisfies操作符 + - 仅类型导入和导出 + - 使用声明和显式资源管理 + - 使用声明等待 + + diff --git a/website/src/content/docs/zh-cn/book/template-union-types.md b/website/src/content/docs/zh-cn/book/template-union-types.md new file mode 100644 index 00000000..113c55bd --- /dev/null +++ b/website/src/content/docs/zh-cn/book/template-union-types.md @@ -0,0 +1,16 @@ +--- +title: 模板联合类型 +sidebar: + order: 43 + label: 43. 模板联合类型 +--- + + +模板联合类型可用于合并和操作类型系统内的文本,例如: + +```typescript +type Status = 'active' | 'inactive'; +type Products = 'p1' | 'p2'; +type ProductId = `id-${Products}-${Status}`; // "id-p1-active" | "id-p1-inactive" | "id-p2-active" | "id-p2-inactive" +``` + diff --git a/website/src/content/docs/zh-cn/book/the-concise-typescript-book.md b/website/src/content/docs/zh-cn/book/the-concise-typescript-book.md new file mode 100644 index 00000000..ba89de15 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/the-concise-typescript-book.md @@ -0,0 +1,12 @@ +--- +title: 简洁的TypeScript之书 +sidebar: + order: 1 + label: 1. 简洁的TypeScript之书 +--- + + +《Concise TypeScript Book》全面而简洁地概述了 TypeScript 的功能。它提供了清晰的解释,涵盖了该语言最新版本中的所有方面,从强大的类型系统到高级功能。无论您是初学者还是经验丰富的开发人员,本书都是增强您对 TypeScript 的理解和熟练程度的宝贵资源。 + +本书完全免费且开源。 + diff --git a/website/src/content/docs/zh-cn/book/the-never-type.md b/website/src/content/docs/zh-cn/book/the-never-type.md new file mode 100644 index 00000000..aefacd14 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/the-never-type.md @@ -0,0 +1,24 @@ +--- +title: never 类型 +sidebar: + order: 25 + label: 25. never 类型 +--- + + +当变量缩小为不能包含任何值的类型时,TypeScript 编译器将推断该变量必须属于该never类型。这是因为 never 类型代表永远无法生成的值。 + +```typescript +const printValue = (val: string | number) => { + if (typeof val === 'string') { + console.log(val.toUpperCase()); + } else if (typeof val === 'number') { + console.log(val.toFixed(2)); + } else { + // val 在这里的类型为 never,因为它只能是字符串或数字 + const neverVal: never = val; + console.log(`Unexpected value: ${neverVal}`); + } +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/translations.md b/website/src/content/docs/zh-cn/book/translations.md new file mode 100644 index 00000000..ff6cc900 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/translations.md @@ -0,0 +1,12 @@ +--- +title: 翻译 +sidebar: + order: 2 + label: 2. 翻译 +--- + + +本书已被翻译成多种语言版本,包括: + +* [中文](./README-zh_CN.md) + diff --git a/website/src/content/docs/zh-cn/book/triple-slash-directives.md b/website/src/content/docs/zh-cn/book/triple-slash-directives.md new file mode 100644 index 00000000..30f45270 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/triple-slash-directives.md @@ -0,0 +1,33 @@ +--- +title: 三斜杠指令 +sidebar: + order: 59 + label: 59. 三斜杠指令 +--- + + +三斜杠指令是特殊注释,为编译器提供有关如何处理文件的说明。这些指令以三个连续斜杠 (`///`) 开头,通常放置在 TypeScript 文件的顶部,对运行时行为没有影响。 + +三斜杠指令用于引用外部依赖项、指定模块加载行为、启用/禁用某些编译器功能等等。几个例子: + +引用声明文件: + + +```typescript +/// +``` + +指明模块格式: + + +```typescript +/// +``` + +启用编译器选项,在以下示例中严格模式: + + +```typescript +/// +``` + diff --git a/website/src/content/docs/zh-cn/book/tuple-type-anonymous.md b/website/src/content/docs/zh-cn/book/tuple-type-anonymous.md new file mode 100644 index 00000000..83b0dd9a --- /dev/null +++ b/website/src/content/docs/zh-cn/book/tuple-type-anonymous.md @@ -0,0 +1,14 @@ +--- +title: 元组类型(匿名) +sidebar: + order: 28 + label: 28. 元组类型(匿名) +--- + + +元组类型是一种表示具有固定数量的元素及其相应类型的数组的类型。元组类型以固定顺序强制执行特定数量的元素及其各自的类型。当您想要表示具有特定类型的值的集合时,元组类型非常有用,其中数组中每个元素的位置都有特定的含义。 + +```typescript +type Point = [number, number]; +``` + diff --git a/website/src/content/docs/zh-cn/book/type-annotations.md b/website/src/content/docs/zh-cn/book/type-annotations.md new file mode 100644 index 00000000..8cdb2626 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-annotations.md @@ -0,0 +1,46 @@ +--- +title: 类型注释 +sidebar: + order: 11 + label: 11. 类型注释 +--- + + +在使用 `var` 、 `let` 和 `const` 声明变量时,可以选择添加类型: + +```typescript +const x: number = 1; +``` + +TypeScript 在推断类型方面做得很好,尤其是简单类型时,因此在大多数情况下这些声明是不必要的。 + +在函数上可以向参数添加类型注释: + +```typescript +function sum(a: number, b: number) { + return a + b; +} +``` + +以下是使用匿名函数(所谓的 lambda 函数)的示例: + +```typescript +const sum = (a: number, b: number) => a + b; +``` + +当参数存在默认值时可以避免这些注释: + +```typescript +const sum = (a = 10, b: number) => a + b; +``` + +可以将返回类型注释添加到函数中: + +```typescript +const sum = (a = 10, b: number): number => a + b; +``` + +这对于更复杂的函数尤其有用,因为在实现之前编写显式返回类型可以帮助更好地思考该函数。 + +通常考虑注释类型签名,但不注释主体局部变量,并始终将类型添加到对象字面量中。 + diff --git a/website/src/content/docs/zh-cn/book/type-from-func-return.md b/website/src/content/docs/zh-cn/book/type-from-func-return.md new file mode 100644 index 00000000..14e24e2e --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-from-func-return.md @@ -0,0 +1,14 @@ +--- +title: Func 返回值的类型 +sidebar: + order: 35 + label: 35. Func 返回值的类型 +--- + + +Func Return 中的类型是指根据函数的实现自动推断函数的返回类型的能力。这允许 TypeScript 无需显式类型注释即可确定函数返回值的类型。 + +```typescript +const add = (x: number, y: number) => x + y; // TypeScript 可以推断函数的返回类型是数字 +``` + diff --git a/website/src/content/docs/zh-cn/book/type-from-module.md b/website/src/content/docs/zh-cn/book/type-from-module.md new file mode 100644 index 00000000..b0e5c1b4 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-from-module.md @@ -0,0 +1,18 @@ +--- +title: 模块的类型 +sidebar: + order: 36 + label: 36. 模块的类型 +--- + + +模块的类型是指使用模块的导出值自动推断其类型的能力。当模块导出特定类型的值时,TypeScript 可以使用该信息在将该值导入到另一个模块时自动推断该值的类型。 + + +```typescript +export const add = (x: number, y: number) => x + y; +// index.ts +import { add } from 'calc'; +const r = add(1, 2); // r 是 number 类型 +``` + diff --git a/website/src/content/docs/zh-cn/book/type-from-value.md b/website/src/content/docs/zh-cn/book/type-from-value.md new file mode 100644 index 00000000..f6dbc684 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-from-value.md @@ -0,0 +1,14 @@ +--- +title: 值的类型 +sidebar: + order: 34 + label: 34. 值的类型 +--- + + +TypeScript 中的"Type from Value"是指通过类型推断从值或表达式自动推断出类型。 + +```typescript +const x = 'x'; // TypeScript 可以自动推断变量的类型是 string +``` + diff --git a/website/src/content/docs/zh-cn/book/type-indexing.md b/website/src/content/docs/zh-cn/book/type-indexing.md new file mode 100644 index 00000000..8c09b00a --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-indexing.md @@ -0,0 +1,18 @@ +--- +title: 类型索引 +sidebar: + order: 33 + label: 33. 类型索引 +--- + + +类型索引是指能够通过预先未知的键来定义可以索引的类型,使用索引签名来指定未显式声明的属性的类型。 + +```typescript +type Dictionary = { + [key: string]: T; +}; +const myDict: Dictionary = { a: 'a', b: 'b' }; +console.log(myDict['a']); // 返回 a +``` + diff --git a/website/src/content/docs/zh-cn/book/type-manipulation.md b/website/src/content/docs/zh-cn/book/type-manipulation.md new file mode 100644 index 00000000..405c4b64 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-manipulation.md @@ -0,0 +1,335 @@ +--- +title: 类型操作 +sidebar: + order: 60 + label: 60. 类型操作 +--- + + +### 从类型创建类型 + +是否可以通过组合、操作或转换现有类型来创建新类型。 + +交集类型 ( &): + +允许您将多种类型组合成单一类型: + +```typescript +type A = { foo: number }; +type B = { bar: string }; +type C = A & B; // A和B的交集 +const obj: C = { foo: 42, bar: 'hello' }; +``` + +联合类型 (`|`): + +允许您定义可以是以下几种类型之一的类型 + +```typescript +type Result = string | number; +const value1: Result = 'hello'; +const value2: Result = 42; +``` + +映射类型: + +允许您转换现有类型的属性以创建新类型: + +```typescript +type Mutable = { + readonly [P in keyof T]: T[P]; +}; +type Person = { + name: string; + age: number; +}; +type ImmutablePerson = Mutable; // 属性变为只读 +``` + +条件类型: + +允许您根据某些条件创建类型: + +```typescript +type ExtractParam = T extends (param: infer P) => any ? P : never; +type MyFunction = (name: string) => number; +type ParamType = ExtractParam; // string +``` + +### 索引访问类型 + +在 TypeScript 中,可以使用索引访问和操作另一个类型中的属性类型 `Type[Key]`。 + +```typescript +type Person = { + name: string; + age: number; +}; + +type AgeType = Person['age']; // number +``` + +```typescript +type MyTuple = [string, number, boolean]; +type MyType = MyTuple[2]; // boolean +``` + +### 工具类型 + +可以使用几种内置工具来操作类型,下面列出了最常用的: + +#### Awaited\ + +构造一个递归解包 Promise 的类型。 + +```typescript +type A = Awaited>; // string +``` + +#### Partial\ + +构造一个类型,并将 T 的所有属性设置为可选。 + +```typescript +type Person = { + name: string; + age: number; +}; + +type A = Partial; // { name?: string | undefined; age?: number | undefined; } +``` + +#### Required\ + +构造一个类型,并将 T 的所有属性设置为必需。 + +```typescript +type Person = { + name?: string; + age?: number; +}; + +type A = Required; // { name: string; age: number; } +``` + +#### Readonly\ + +构造一个类型,并将 T 的所有属性设置为只读。 + + +```typescript +type Person = { + name: string; + age: number; +}; + +type A = Readonly; + +const a: A = { name: 'Simon', age: 17 }; +a.name = 'John'; // 无效 +``` + +#### Record\ + +构造一个具有类型 T 的一组属性 K 的类型。 + +```typescript +type Product = { + name: string; + price: number; +}; + +const products: Record = { + apple: { name: 'Apple', price: 0.5 }, + banana: { name: 'Banana', price: 0.25 }, +}; + +console.log(products.apple); // { name: 'Apple', price: 0.5 } +``` + +#### Pick\ + +通过从 T 中选取指定属性 K 来构造类型。 + +```typescript +type Product = { + name: string; + price: number; +}; + +type Price = Pick; // { price: number; } +``` + +#### Omit\ + +通过从 T 中省略指定属性 K 来构造类型。 + +```typescript +type Product = { + name: string; + price: number; +}; + +type Name = Omit; // { name: string; } +``` + +#### Exclude\ + +通过从 T 中排除类型 U 的所有值来构造类型。 + +```typescript +type Union = 'a' | 'b' | 'c'; +type MyType = Exclude; // b +``` + +#### Extract\ + +通过从 T 中提取类型 U 的所有值来构造类型。 + +```typescript +type Union = 'a' | 'b' | 'c'; +type MyType = Extract; // a | c +``` + +#### NonNullable\ + +通过从 T 中排除 null 和 undefined 来构造类型。 + +```typescript +type Union = 'a' | null | undefined | 'b'; +type MyType = NonNullable; // 'a' | 'b' +``` + +#### Parameters\ + +提取函数类型 T 的参数类型。 + +```typescript +type Func = (a: string, b: number) => void; +type MyType = Parameters; // [a: string, b: number] +``` + +#### ConstructorParameters\ + +提取构造函数类型 T 的参数类型。 + +```typescript +class Person { + constructor( + public name: string, + public age: number + ) {} +} +type PersonConstructorParams = ConstructorParameters; // [name: string, age: number] +const params: PersonConstructorParams = ['John', 30]; +const person = new Person(...params); +console.log(person); // Person { name: 'John', age: 30 } +``` + +#### ReturnType\ + +提取函数类型 T 的返回类型。 + +```typescript +type Func = (name: string) => number; +type MyType = ReturnType; // number +``` + +#### InstanceType\ + +提取类类型 T 的实例类型。 + +```typescript +class Person { + name: string; + + constructor(name: string) { + this.name = name; + } + + sayHello() { + console.log(`Hello, my name is ${this.name}!`); + } +} + +type PersonInstance = InstanceType; + +const person: PersonInstance = new Person('John'); + +person.sayHello(); // Hello, my name is John! +``` + +#### ThisParameterType\ + +从函数类型 T 中提取"this"参数的类型。 + +```typescript +interface Person { + name: string; + greet(this: Person): void; +} +type PersonThisType = ThisParameterType; // Person +``` + +#### OmitThisParameter\ + +从函数类型 T 中删除"this"参数。 + +```typescript +function capitalize(this: String) { + return this[0].toUpperCase + this.substring(1).toLowerCase(); +} + +type CapitalizeType = OmitThisParameter; // () => string +``` + +#### ThisType\ + +作为上下文类型 `this` 的一部分。 + + +```typescript +type Logger = { + log: (error: string) => void; +}; + +let helperFunctions: { [name: string]: Function } & ThisType = { + hello: function () { + this.log('some error'); // 有效,因为"log"是"this"的一部分 + this.update(); // 无效 + }, +}; +``` + +#### Uppercase\ + +将输入类型 T 的名称设为大写。 + +```typescript +type MyType = Uppercase<'abc'>; // "ABC" +``` + +#### Lowercase\ + +将输入类型 T 的名称设为小写。 + +```typescript +type MyType = Lowercase<'ABC'>; // "abc" +``` + +#### Capitalize\ + +输入类型 T 的名称大写。 + +```typescript +type MyType = Capitalize<'abc'>; // "Abc" +``` + +#### Uncapitalize\ + +将输入类型 T 的名称取消大写。 + +```typescript +type MyType = Uncapitalize<'Abc'>; // "abc" +``` + diff --git a/website/src/content/docs/zh-cn/book/type-predicates.md b/website/src/content/docs/zh-cn/book/type-predicates.md new file mode 100644 index 00000000..77c9f3fd --- /dev/null +++ b/website/src/content/docs/zh-cn/book/type-predicates.md @@ -0,0 +1,22 @@ +--- +title: 类型谓词 +sidebar: + order: 23 + label: 23. 类型谓词 +--- + + +TypeScript 中的类型谓词是返回布尔值的函数,用于将变量的类型缩小为更具体的类型。 + +```typescript +const isString = (value: unknown): value is string => typeof value === 'string'; + +const foo = (bar: unknown) => { + if (isString(bar)) { + console.log(bar.toUpperCase()); + } else { + console.log('not a string'); + } +}; +``` + diff --git a/website/src/content/docs/zh-cn/book/typescript-introduction.md b/website/src/content/docs/zh-cn/book/typescript-introduction.md new file mode 100644 index 00000000..b2019797 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/typescript-introduction.md @@ -0,0 +1,211 @@ +--- +title: TypeScript简介 +sidebar: + order: 7 + label: 7. TypeScript简介 +--- + + +### 什么是TypeScript? + +TypeScript 是一种基于 JavaScript 构建的强类型编程语言。它最初由 Anders Hejlsberg 于 2012 年设计,目前由 Microsoft 作为开源项目开发和维护。 + +TypeScript 编译为 JavaScript,并且可以在任何 JavaScript 引擎(例如浏览器或服务器 Node.js)中执行。 + +TypeScript 支持多种编程范式,例如函数式、泛型、命令式和面向对象。TypeScript 既不是解释型语言,也不是编译型语言。 + +### 为什么选择 TypeScript? + +TypeScript 是一种强类型语言,有助于防止常见的编程错误,并在程序执行之前避免某些类型的运行时错误。 + +强类型语言允许开发人员在数据类型定义中指定各种程序约束和行为,从而有助于验证软件的正确性并防止缺陷。这在大规模应用中尤其有价值。 + +TypeScript 的一些好处 + +* 静态类型,可选强类型 +* 类型推断 +* 能使用ES6和ES7的新功能 +* 跨平台和跨浏览器兼容性 \* IntelliSense 工具支持 + +### TypeScript 和 JavaScript + +TypeScript是用`.ts`或`.tsx`文件编写的, 而JavaScript是用`.js`或`.jsx`文件编写的。 + +扩展名为.tsx或.jsx的文件可以包含 JavaScript 语法扩展 JSX,该扩展在 React 中用于 UI 开发。 + +就语法而言,TypeScript 是 JavaScript (ECMAScript 2015) 的类型化超集。所有 JavaScript 代码都是有效的 TypeScript 代码,但反之则不然。 + +例如,考虑 JavaScript 文件中具有.js扩展名的函数,如下所示: + + +```typescript +const sum = (a, b) => a + b; +``` + +该函数可以通过将文件扩展名更改为 .TypeScript 来转换和使用.ts。但是,如果同一个函数使用 TypeScript 类型进行注释,则未经编译就无法在任何 JavaScript 引擎中执行。如果未编译以下 TypeScript 代码,将会产生语法错误 + + +```typescript +const sum = (a: number, b: number): number => a + b; +``` + +TypeScript 旨在通过让开发人员使用类型注释定义意图来检测编译期间运行时可能发生的异常。此外,如果没有提供类型注释,TypeScript 也可以捕获问题。例如,以下代码片段未指定任何 TypeScript 类型: + + +```typescript +const items = [{ x: 1 }, { x: 2 }]; +const result = items.filter(item => item.y); +``` + +在这种情况下,TypeScript 检测到错误并报告: + +```text +类型 '{ x: number; }' 上不存在属性 'y' 。 +``` + +TypeScript 的类型系统很大程度上受到 JavaScript 运行时行为的影响。例如,加法运算符 (+) 在 JavaScript 中可以执行字符串连接或数字加法,在 TypeScript 中以相同的方式建模: + +```typescript +const result = '1' + 1; // 结果是string类型 +``` + +TypeScript 背后的团队经过深思熟虑,决定将 JavaScript 的异常使用标记为错误。例如,考虑以下有效的 JavaScript 代码: + + +```typescript +const result = 1 + true; // 在JavaScript中, 结果等于2 +``` + +但是,TypeScript 会抛出错误: + +```text +运算符"+"不能应用于类型"number"和"boolean"。 +`````` + +出现此错误的原因是 TypeScript 严格强制执行类型兼容性,在这种情况下,它标识了数字和布尔值之间的无效操作。 + +### TypeScript 代码生成 + +TypeScript 编译器有两个主要职责:检查类型错误和编译为 JavaScript。这两个过程是相互独立的。类型不会影响 JavaScript 引擎中代码的执行,因为它们在编译过程中会被完全擦除。即使存在类型错误,TypeScript 仍然可以输出 JavaScript。以下是存在类型错误的 TypeScript 代码示例: + + +```typescript +const add = (a: number, b: number): number => a + b; +const result = add('x', 'y'); // "字符串"类型的参数不可赋值给"数字"类型的参数 +``` + +但是,它仍然可以生成可执行的 JavaScript 输出: + + +```typescript +'use strict'; +const add = (a, b) => a + b; +const result = add('x', 'y'); // xy +``` + +无法在运行时检查 TypeScript 类型。例如: + + +```typescript +interface Animal { + name: string; +} +interface Dog extends Animal { + bark: () => void; +} +interface Cat extends Animal { + meow: () => void; +} +const makeNoise = (animal: Animal) => { + if (animal instanceof Dog) { + // "Dog"仅指一种类型,但在这里用作值。 + // ... + } +}; +``` + +由于编译后类型被删除,因此无法在 JavaScript 中运行此代码。为了在运行时识别类型,我们需要使用另一种机制。TypeScript 提供了多种选项,其中常见的一个是 "标签联合(tagged union)"。例如: + +```typescript +interface Dog { + kind: 'dog'; // 标签联合 + bark: () => void; +} +interface Cat { + kind: 'cat'; // 标签联合 + meow: () => void; +} +type Animal = Dog | Cat; + +const makeNoise = (animal: Animal) => { + if (animal.kind === 'dog') { + animal.bark(); + } else { + animal.meow(); + } +}; + +const dog: Dog = { + kind: 'dog', + bark: () => console.log('bark'), +}; +makeNoise(dog); +``` + +属性"kind"是一个可以在运行时用来区分 JavaScript 中的对象的值。 + +运行时的值也可能具有与类型声明中声明的类型不同的类型。例如,如果开发人员误解了 API 类型并对其进行了错误注释。 + +TypeScript 是 JavaScript 的超集,因此"class"关键字可以在运行时用作类型和值。 + +```typescript +class Animal { + constructor(public name: string) {} +} +class Dog extends Animal { + constructor(public name: string, public bark: () => void) { + super(name); + } +} +class Cat extends Animal { + constructor(public name: string, public meow: () => void) { + super(name); + } +} +type Mammal = Dog | Cat; + +const makeNoise = (mammal: Mammal) => { + if (mammal instanceof Dog) { + mammal.bark(); + } else { + mammal.meow(); + } +}; + +const dog = new Dog('Fido', () => console.log('bark')); +makeNoise(dog); +``` + +在 JavaScript 中,"类"具有"prototype"属性,"instanceof"运算符可用于测试构造函数的原型属性是否出现在对象原型链中的任何位置。 + +TypeScript 对运行时性能没有影响,因为所有类型都将被删除。然而,TypeScript 确实引入了一些构建时间开销。 + +### 现在的现代 JavaScript(降级) + +TypeScript 可以将代码编译为自 ECMAScript 3 (1999) 以来任何已发布的 JavaScript 版本。这意味着 TypeScript 可以将代码从最新的 JavaScript 功能转换为旧版本,这一过程称为降级。这允许使用现代 JavaScript,同时保持与旧运行时环境的最大兼容性。 + +值得注意的是,在转换为旧版本 JavaScript 的过程中,TypeScript 可能会生成与本机实现相比会产生性能开销的代码。 + +以下是一些可以在 TypeScript 中使用的现代 JavaScript 功能: + +* ECMAScript 模块,而不是 AMD 风格的"define"回调或 CommonJS 的"require"语句。 +* 用类代替原型。 +* 变量声明使用"let"或"const"而不是"var"。 +* "for-of"循环或".forEach"而不是传统的"for"循环。 +* 用箭头函数代替函数表达式。 +* 解构赋值。 +* 简写属性/方法名称和计算属性名称。 +* 默认函数参数。 + +通过利用这些现代 JavaScript 功能,开发人员可以在 TypeScript 中编写更具表现力和简洁的代码。 + diff --git a/website/src/content/docs/zh-cn/book/union-type.md b/website/src/content/docs/zh-cn/book/union-type.md new file mode 100644 index 00000000..63d41839 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/union-type.md @@ -0,0 +1,16 @@ +--- +title: 联合类型 +sidebar: + order: 31 + label: 31. 联合类型 +--- + + +联合类型是一种表示值的类型,该值可以是多种类型之一。联合类型使用 `|` 表示 每种可能类型之间的符号。 + +```typescript +let x: string | number; +x = 'hello'; // 有效 +x = 123; // 有效 +``` + diff --git a/website/src/content/docs/zh-cn/book/unknown-type.md b/website/src/content/docs/zh-cn/book/unknown-type.md new file mode 100644 index 00000000..4a54db03 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/unknown-type.md @@ -0,0 +1,29 @@ +--- +title: 未知类型 +sidebar: + order: 45 + label: 45. 未知类型 +--- + + +在 TypeScript 中,未知类型表示未知类型的值。与允许任何类型值的 `any` 类型不同,`unknown` 需要在以特定方式使用它之前进行类型检查或断言,因此在未首先断言或缩小到更具体的类型的情况下,不允许对 `unknown` 进行任何操作 。 + +`unknown` 类型只能分配给任何类型和未知类型本身,它是any 的类型安全替代方案。 + + +```typescript +let value: unknown; + +let value1: unknown = value; // 有效 +let value2: any = value; // 有效 +let value3: boolean = value; // 无效 +let value4: number = value; // 无效 +``` + +```typescript +const add = (a: unknown, b: unknown): number | undefined => + typeof a === 'number' && typeof b === 'number' ? a + b : undefined; +console.log(add(1, 2)); // 3 +console.log(add('x', 2)); // undefined +``` + diff --git a/website/src/content/docs/zh-cn/book/void-type.md b/website/src/content/docs/zh-cn/book/void-type.md new file mode 100644 index 00000000..e396b458 --- /dev/null +++ b/website/src/content/docs/zh-cn/book/void-type.md @@ -0,0 +1,16 @@ +--- +title: 空类型 +sidebar: + order: 46 + label: 46. 空类型 +--- + + +`void` 类型用于指示函数不返回值。 + +```typescript +const sayHello = (): void => { + console.log('Hello!'); +}; +``` + diff --git a/website/src/content/docs/zh-cn/index.mdx b/website/src/content/docs/zh-cn/index.mdx new file mode 100644 index 00000000..6ee31b9f --- /dev/null +++ b/website/src/content/docs/zh-cn/index.mdx @@ -0,0 +1,22 @@ +--- +title: Typescript Book +description: The Concise TypeScript Book +template: splash +hero: + tagline: 《Concise TypeScript Book》全面而简洁地概述了 TypeScript + 的功能。它提供了清晰的解释,涵盖了该语言最新版本中的所有方面,从强大的类型系统到高级功能。无论您是初学者还是经验丰富的开发人员,本书都是增强您对 + TypeScript 的理解和熟练程度的宝贵资源。

本书完全免费且开源。 + actions: + - text: 现在读! + link: /zh-cn/book/the-concise-typescript-book/ + icon: right-arrow + variant: primary + - text: GitHub + link: https://github.com/gibbok/typescript-book + icon: github + variant: secondary + - text: X.com + link: https://twitter.com/gibbok_coding + icon: x.com + variant: secondary +--- diff --git a/website/src/content/i18n/zh-cn.json b/website/src/content/i18n/zh-cn.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/website/src/content/i18n/zh-cn.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/website/src/env.d.ts b/website/src/env.d.ts new file mode 100644 index 00000000..acef35f1 --- /dev/null +++ b/website/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/website/src/styles/custom.css b/website/src/styles/custom.css new file mode 100644 index 00000000..9e9b154b --- /dev/null +++ b/website/src/styles/custom.css @@ -0,0 +1,29 @@ +/* Dark mode colors. */ +:root { + --sl-color-accent-low: #36113e; + --sl-color-accent: #a400c0; + --sl-color-accent-high: #e3b6ed; + --sl-color-white: #ffffff; + --sl-color-gray-1: #f2e9fd; + --sl-color-gray-2: #c7bdd5; + --sl-color-gray-3: #9581ae; + --sl-color-gray-4: #614e78; + --sl-color-gray-5: #412e55; + --sl-color-gray-6: #2f1c42; + --sl-color-black: #1c1425; +} +/* Light mode colors. */ +:root[data-theme='light'] { + --sl-color-accent-low: #ebc9f3; + --sl-color-accent: #a700c3; + --sl-color-accent-high: #4e0e5b; + --sl-color-white: #1c1425; + --sl-color-gray-1: #2f1c42; + --sl-color-gray-2: #412e55; + --sl-color-gray-3: #614e78; + --sl-color-gray-4: #9581ae; + --sl-color-gray-5: #c7bdd5; + --sl-color-gray-6: #f2e9fd; + --sl-color-gray-7: #f8f4fe; + --sl-color-black: #ffffff; +} \ No newline at end of file diff --git a/website/tsconfig.json b/website/tsconfig.json new file mode 100644 index 00000000..77da9dd0 --- /dev/null +++ b/website/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "astro/tsconfigs/strict" +} \ No newline at end of file