diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml new file mode 100644 index 0000000..ab174db --- /dev/null +++ b/.github/workflows/conventional-commits.yml @@ -0,0 +1,31 @@ +name: Conventional Commits + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + conventional-commits: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + + - name: Setup Git + run: | + git config --global user.name "Conventional Changelog Action" + git config --global user.email "conventional.changelog.action@github.com" + git checkout ${{ github.head_ref }} + + - name: Conventional Commits + uses: TriPSs/conventional-changelog-action@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + version-file: './package/package.json' + skip-version-file: false + skip-commit: false + skip-tag: false + release-count: 0 + output-file: 'CHANGELOG.md' diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..4732878 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,74 @@ +name: PR Checks + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - main + - 'feature/**' + - 'fix/**' + - 'chore/**' + - 'docs/**' + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + cache-dependency-path: 'package/package-lock.json' + + - name: Install dependencies + working-directory: ./package + run: npm ci + + - name: Run tests + working-directory: ./package + run: npm test + + validate: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + cache-dependency-path: 'package/package-lock.json' + + - name: Install dependencies + working-directory: ./package + run: npm ci + + - name: Format code + id: format + working-directory: ./package + run: npm run format + + - name: Commit formatting changes + if: success() + working-directory: ./package + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git diff --quiet && git diff --staged --quiet || (git commit -m "style: format code" && git push) + + - name: Type check + id: type-check + working-directory: ./package + run: npm run type-check || (echo "TypeScript errors found" && exit 1) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0707d4c..fad5c63 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,30 +1,31 @@ -name: Publish to npm +name: Publish Package on: - push: - tags: - - "v*" # Trigger only on tags that start with 'v', e.g., v1.0.0 + release: + types: [created] jobs: - publish: + build: runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version: "18" + node-version: "20.x" registry-url: "https://registry.npmjs.org" - name: Install dependencies - working-directory: ./package - run: npm install + run: npm ci - - name: Publish to npm - working-directory: ./package - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + - name: Run tests + run: npm test + + - name: Build + run: npm run build + + - name: Publish to NPM run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.SHNIPPET_NPM_TOKEN }} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b1e3071 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,19 @@ +# Build output +dist/ +build/ + +# Dependencies +node_modules/ + +# Snippets +snippet/ + +# Coverage +coverage/ + +# Logs +*.log + +# Cache +.cache/ +.npm/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..1ad3d51 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": true, + "trailingComma": "es5", + "singleQuote": true, + "printWidth": 100, + "tabWidth": 2, + "useTabs": false +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c0e155e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,81 @@ +# Contributing to Shnippet + +Thank you for your interest in contributing to Shnippet! This document provides guidelines and instructions for contributing. + +## Development Setup + +1. Fork the repository +2. Clone your fork: + ```bash + git clone https://github.com/YOUR_USERNAME/shnippet.git + cd shnippet + ``` +3. Install dependencies: + ```bash + npm install + ``` + +## Branch Strategy + +We use the following branch naming conventions: + +- `main` - Production-ready code +- `feature/*` - New features (e.g., `feature/add-new-language`) +- `fix/*` - Bug fixes (e.g., `fix/parser-error`) +- `chore/*` - Maintenance tasks (e.g., `chore/update-deps`) +- `docs/*` - Documentation updates (e.g., `docs/update-readme`) + +## Commit Convention + +We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification: + +- `feat:` - New features +- `fix:` - Bug fixes +- `docs:` - Documentation changes +- `style:` - Code style changes (formatting, etc.) +- `refactor:` - Code refactoring +- `test:` - Adding or modifying tests +- `chore:` - Maintenance tasks + +Example: +``` +feat: add support for Python language +fix: handle empty file edge case +docs: update installation instructions +``` + +## Pull Request Process + +1. Create a new branch from `main` using the appropriate prefix +2. Make your changes +3. Run tests locally: + ```bash + npm test + ``` +4. Push your branch and create a Pull Request +5. Ensure all status checks pass: + - Tests + - Type checking + +## Code Style + +- We use TypeScript for type safety +- All tests must pass +- All TypeScript errors must be resolved + +## Release Process + +Releases are automated through GitHub Actions. When a PR is merged to `main`: + +1. The conventional commits workflow will: + - Update the changelog + - Update the version number + - Create a git tag +2. The publish workflow will: + - Run all tests + - Build the package + - Publish to npm + +## Questions? + +Feel free to open an issue if you have any questions about contributing! \ No newline at end of file diff --git a/package/build.js b/package/build.js index 28ad550..f33b8b2 100644 --- a/package/build.js +++ b/package/build.js @@ -6,31 +6,31 @@ await rimraf('dist'); // Build Node.js bundle await build({ - entryPoints: ['src/index.ts', 'src/bin/cli.ts'], - bundle: true, - platform: 'node', - target: 'node18', - format: 'esm', - outdir: 'dist', - outExtension: { '.js': '.js' }, - external: ['rimraf'], - banner: { - js: '#!/usr/bin/env node\n' - }, - sourcemap: true, - minify: false + entryPoints: ['src/index.ts', 'src/bin/cli.ts'], + bundle: true, + platform: 'node', + target: 'node18', + format: 'esm', + outdir: 'dist', + outExtension: { '.js': '.js' }, + external: ['rimraf'], + banner: { + js: '#!/usr/bin/env node\n', + }, + sourcemap: true, + minify: false, }); // Build client-side bundle await build({ - entryPoints: ['src/client.ts'], - bundle: true, - platform: 'browser', - target: ['es2020'], - format: 'esm', - outdir: 'dist', - outExtension: { '.js': '.browser.js' }, - sourcemap: true, - minify: true, - globalName: 'Shnippet' + entryPoints: ['src/client.ts'], + bundle: true, + platform: 'browser', + target: ['es2020'], + format: 'esm', + outdir: 'dist', + outExtension: { '.js': '.browser.js' }, + sourcemap: true, + minify: true, + globalName: 'Shnippet', }); diff --git a/package/package-lock.json b/package/package-lock.json index 40187dd..1cf2c4c 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -18,13 +18,13 @@ "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^22.7.4", - "@vitest/coverage-v8": "^3.1.3", "esbuild": "^0.25.4", "jest": "^29.7.0", + "prettier": "^3.2.5", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "typescript": "^5.6.2", - "vitest": "^3.1.3" + "vitest": "^1.2.2" } }, "node_modules/@ampproject/remapping": { @@ -1455,9 +1455,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.2.tgz", - "integrity": "sha512-JkdNEq+DFxZfUwxvB58tHMHBHVgX23ew41g1OQinthJ+ryhdRk67O31S7sYw8u2lTjHUPFxwar07BBt1KHp/hg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.1.tgz", + "integrity": "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw==", "cpu": [ "arm" ], @@ -1469,9 +1469,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.2.tgz", - "integrity": "sha512-13unNoZ8NzUmnndhPTkWPWbX3vtHodYmy+I9kuLxN+F+l+x3LdVF7UCu8TWVMt1POHLh6oDHhnOA04n8oJZhBw==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.1.tgz", + "integrity": "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA==", "cpu": [ "arm64" ], @@ -1483,9 +1483,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.2.tgz", - "integrity": "sha512-Gzf1Hn2Aoe8VZzevHostPX23U7N5+4D36WJNHK88NZHCJr7aVMG4fadqkIf72eqVPGjGc0HJHNuUaUcxiR+N/w==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.1.tgz", + "integrity": "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w==", "cpu": [ "arm64" ], @@ -1497,9 +1497,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.2.tgz", - "integrity": "sha512-47N4hxa01a4x6XnJoskMKTS8XZ0CZMd8YTbINbi+w03A2w4j1RTlnGHOz/P0+Bg1LaVL6ufZyNprSg+fW5nYQQ==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.1.tgz", + "integrity": "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg==", "cpu": [ "x64" ], @@ -1511,9 +1511,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.2.tgz", - "integrity": "sha512-8t6aL4MD+rXSHHZUR1z19+9OFJ2rl1wGKvckN47XFRVO+QL/dUSpKA2SLRo4vMg7ELA8pzGpC+W9OEd1Z/ZqoQ==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.1.tgz", + "integrity": "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg==", "cpu": [ "arm64" ], @@ -1525,9 +1525,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.2.tgz", - "integrity": "sha512-C+AyHBzfpsOEYRFjztcYUFsH4S7UsE9cDtHCtma5BK8+ydOZYgMmWg1d/4KBytQspJCld8ZIujFMAdKG1xyr4Q==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.1.tgz", + "integrity": "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA==", "cpu": [ "x64" ], @@ -1539,9 +1539,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.2.tgz", - "integrity": "sha512-de6TFZYIvJwRNjmW3+gaXiZ2DaWL5D5yGmSYzkdzjBDS3W+B9JQ48oZEsmMvemqjtAFzE16DIBLqd6IQQRuG9Q==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.1.tgz", + "integrity": "sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==", "cpu": [ "arm" ], @@ -1553,9 +1553,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.2.tgz", - "integrity": "sha512-urjaEZubdIkacKc930hUDOfQPysezKla/O9qV+O89enqsqUmQm8Xj8O/vh0gHg4LYfv7Y7UsE3QjzLQzDYN1qg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.1.tgz", + "integrity": "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==", "cpu": [ "arm" ], @@ -1567,9 +1567,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.2.tgz", - "integrity": "sha512-KlE8IC0HFOC33taNt1zR8qNlBYHj31qGT1UqWqtvR/+NuCVhfufAq9fxO8BMFC22Wu0rxOwGVWxtCMvZVLmhQg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.1.tgz", + "integrity": "sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==", "cpu": [ "arm64" ], @@ -1581,9 +1581,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.2.tgz", - "integrity": "sha512-j8CgxvfM0kbnhu4XgjnCWJQyyBOeBI1Zq91Z850aUddUmPeQvuAy6OiMdPS46gNFgy8gN1xkYyLgwLYZG3rBOg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.1.tgz", + "integrity": "sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==", "cpu": [ "arm64" ], @@ -1595,9 +1595,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.2.tgz", - "integrity": "sha512-Ybc/1qUampKuRF4tQXc7G7QY9YRyeVSykfK36Y5Qc5dmrIxwFhrOzqaVTNoZygqZ1ZieSWTibfFhQ5qK8jpWxw==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.1.tgz", + "integrity": "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==", "cpu": [ "loong64" ], @@ -1609,9 +1609,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.2.tgz", - "integrity": "sha512-3FCIrnrt03CCsZqSYAOW/k9n625pjpuMzVfeI+ZBUSDT3MVIFDSPfSUgIl9FqUftxcUXInvFah79hE1c9abD+Q==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.1.tgz", + "integrity": "sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==", "cpu": [ "ppc64" ], @@ -1623,9 +1623,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.2.tgz", - "integrity": "sha512-QNU7BFHEvHMp2ESSY3SozIkBPaPBDTsfVNGx3Xhv+TdvWXFGOSH2NJvhD1zKAT6AyuuErJgbdvaJhYVhVqrWTg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.1.tgz", + "integrity": "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==", "cpu": [ "riscv64" ], @@ -1637,9 +1637,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.2.tgz", - "integrity": "sha512-5W6vNYkhgfh7URiXTO1E9a0cy4fSgfE4+Hl5agb/U1sa0kjOLMLC1wObxwKxecE17j0URxuTrYZZME4/VH57Hg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.1.tgz", + "integrity": "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==", "cpu": [ "riscv64" ], @@ -1651,9 +1651,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.2.tgz", - "integrity": "sha512-B7LKIz+0+p348JoAL4X/YxGx9zOx3sR+o6Hj15Y3aaApNfAshK8+mWZEf759DXfRLeL2vg5LYJBB7DdcleYCoQ==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.1.tgz", + "integrity": "sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==", "cpu": [ "s390x" ], @@ -1665,9 +1665,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.2.tgz", - "integrity": "sha512-lG7Xa+BmBNwpjmVUbmyKxdQJ3Q6whHjMjzQplOs5Z+Gj7mxPtWakGHqzMqNER68G67kmCX9qX57aRsW5V0VOng==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.1.tgz", + "integrity": "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==", "cpu": [ "x64" ], @@ -1679,9 +1679,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.2.tgz", - "integrity": "sha512-tD46wKHd+KJvsmije4bUskNuvWKFcTOIM9tZ/RrmIvcXnbi0YK/cKS9FzFtAm7Oxi2EhV5N2OpfFB348vSQRXA==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.1.tgz", + "integrity": "sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==", "cpu": [ "x64" ], @@ -1693,9 +1693,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.2.tgz", - "integrity": "sha512-Bjv/HG8RRWLNkXwQQemdsWw4Mg+IJ29LK+bJPW2SCzPKOUaMmPEppQlu/Fqk1d7+DX3V7JbFdbkh/NMmurT6Pg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.1.tgz", + "integrity": "sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==", "cpu": [ "arm64" ], @@ -1707,9 +1707,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.2.tgz", - "integrity": "sha512-dt1llVSGEsGKvzeIO76HToiYPNPYPkmjhMHhP00T9S4rDern8P2ZWvWAQUEJ+R1UdMWJ/42i/QqJ2WV765GZcA==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.1.tgz", + "integrity": "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg==", "cpu": [ "ia32" ], @@ -1721,9 +1721,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.2.tgz", - "integrity": "sha512-bwspbWB04XJpeElvsp+DCylKfF4trJDa2Y9Go8O6A7YLX2LIKGcNK/CYImJN6ZP4DcuOHB4Utl3iCbnR62DudA==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz", + "integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==", "cpu": [ "x64" ], @@ -1923,234 +1923,104 @@ "dev": true, "license": "MIT" }, - "node_modules/@vitest/coverage-v8": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.1.3.tgz", - "integrity": "sha512-cj76U5gXCl3g88KSnf80kof6+6w+K4BjOflCl7t6yRJPDuCrHtVu0SgNYOUARJOL5TI8RScDbm5x4s1/P9bvpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.3.0", - "@bcoe/v8-coverage": "^1.0.2", - "debug": "^4.4.0", - "istanbul-lib-coverage": "^3.2.2", - "istanbul-lib-report": "^3.0.1", - "istanbul-lib-source-maps": "^5.0.6", - "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.17", - "magicast": "^0.3.5", - "std-env": "^3.9.0", - "test-exclude": "^7.0.1", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@vitest/browser": "3.1.3", - "vitest": "3.1.3" - }, - "peerDependenciesMeta": { - "@vitest/browser": { - "optional": true - } - } - }, - "node_modules/@vitest/coverage-v8/node_modules/@bcoe/v8-coverage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", - "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@vitest/coverage-v8/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@vitest/coverage-v8/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@vitest/coverage-v8/node_modules/istanbul-lib-source-maps": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", - "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.23", - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@vitest/coverage-v8/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@vitest/coverage-v8/node_modules/test-exclude": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", - "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^10.4.1", - "minimatch": "^9.0.4" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/@vitest/expect": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.1.3.tgz", - "integrity": "sha512-7FTQQuuLKmN1Ig/h+h/GO+44Q1IlglPlR2es4ab7Yvfx+Uk5xsv+Ykk+MEt/M2Yn/xGmzaLKxGw2lgy2bwuYqg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "3.1.3", - "@vitest/utils": "3.1.3", - "chai": "^5.2.0", - "tinyrainbow": "^2.0.0" + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "chai": "^4.3.10" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/mocker": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.1.3.tgz", - "integrity": "sha512-PJbLjonJK82uCWHjzgBJZuR7zmAOrSvKk1QBxrennDIgtH4uK0TB1PvYmc0XBCigxxtiAVPfWtAdy4lpz8SQGQ==", + "node_modules/@vitest/runner": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "3.1.3", - "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" + "@vitest/utils": "1.6.1", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" }, "funding": { "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } } }, - "node_modules/@vitest/pretty-format": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.1.3.tgz", - "integrity": "sha512-i6FDiBeJUGLDKADw2Gb01UtUNb12yyXAqC/mmRWuYl+m/U9GS7s8us5ONmGkGpUUo7/iAYzI2ePVfOZTYvUifA==", + "node_modules/@vitest/runner/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==", "dev": true, "license": "MIT", "dependencies": { - "tinyrainbow": "^2.0.0" + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" }, "funding": { - "url": "https://opencollective.com/vitest" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@vitest/runner": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.1.3.tgz", - "integrity": "sha512-Tae+ogtlNfFei5DggOsSUvkIaSuVywujMj6HzR97AHK6XK8i3BuVyIifWAm/sE3a15lF5RH9yQIrbXYuo0IFyA==", + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz", + "integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==", "dev": true, "license": "MIT", - "dependencies": { - "@vitest/utils": "3.1.3", - "pathe": "^2.0.3" + "engines": { + "node": ">=12.20" }, "funding": { - "url": "https://opencollective.com/vitest" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@vitest/snapshot": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.1.3.tgz", - "integrity": "sha512-XVa5OPNTYUsyqG9skuUkFzAeFnEzDp8hQu7kZ0N25B1+6KjGm4hWLtURyBbsIAOekfWQ7Wuz/N/XXzgYO3deWQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "3.1.3", - "magic-string": "^0.30.17", - "pathe": "^2.0.3" + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/spy": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.1.3.tgz", - "integrity": "sha512-x6w+ctOEmEXdWaa6TO4ilb7l9DxPR5bwEb6hILKuxfU1NqWT2mpJD9NJN7t3OTfxmVlOMrvtoFJGdgyzZ605lQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", "dev": true, "license": "MIT", "dependencies": { - "tinyspy": "^3.0.2" + "tinyspy": "^2.2.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/utils": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.1.3.tgz", - "integrity": "sha512-2Ltrpht4OmHO9+c/nmHtF09HWiyWdworqnHIwjfvDyWjuwKbdkcS9AnhsDn+8E2RM4x++foD1/tNuLPVvWG1Rg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "3.1.3", - "loupe": "^3.1.3", - "tinyrainbow": "^2.0.0" + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" }, "funding": { "url": "https://opencollective.com/vitest" @@ -2254,13 +2124,13 @@ } }, "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, "license": "MIT", "engines": { - "node": ">=12" + "node": "*" } }, "node_modules/async": { @@ -2531,20 +2401,32 @@ "license": "CC-BY-4.0" }, "node_modules/chai": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", - "integrity": "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", "dev": true, "license": "MIT", "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" }, "engines": { - "node": ">=12" + "node": ">=4" + } + }, + "node_modules/chai/node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" } }, "node_modules/chalk": { @@ -2575,13 +2457,16 @@ } }, "node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, "engines": { - "node": ">= 16" + "node": "*" } }, "node_modules/ci-info": { @@ -2665,6 +2550,13 @@ "dev": true, "license": "MIT" }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -2749,11 +2641,14 @@ } }, "node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", "dev": true, "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, "engines": { "node": ">=6" } @@ -2856,13 +2751,6 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", - "dev": true, - "license": "MIT" - }, "node_modules/esbuild": { "version": "0.25.4", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.4.tgz", @@ -2998,16 +2886,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/expect-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.1.tgz", - "integrity": "sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3165,6 +3043,16 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -4182,6 +4070,23 @@ "dev": true, "license": "MIT" }, + "node_modules/local-pkg": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz", + "integrity": "sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mlly": "^1.7.3", + "pkg-types": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -4203,11 +4108,14 @@ "license": "MIT" }, "node_modules/loupe": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", - "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } }, "node_modules/lru-cache": { "version": "5.1.1", @@ -4229,18 +4137,6 @@ "@jridgewell/sourcemap-codec": "^1.5.0" } }, - "node_modules/magicast": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", - "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.25.4", - "@babel/types": "^7.25.4", - "source-map-js": "^1.2.0" - } - }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -4340,6 +4236,26 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, + "node_modules/mlly/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4575,20 +4491,20 @@ "license": "ISC" }, "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", "dev": true, "license": "MIT" }, "node_modules/pathval": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", - "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, "license": "MIT", "engines": { - "node": ">= 14.16" + "node": "*" } }, "node_modules/picocolors": { @@ -4634,6 +4550,25 @@ "node": ">=8" } }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/postcss": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", @@ -4663,6 +4598,22 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -4856,9 +4807,9 @@ } }, "node_modules/rollup": { - "version": "4.40.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.2.tgz", - "integrity": "sha512-tfUOg6DTP4rhQ3VjOO6B4wyrJnGOX85requAXvqYTHsOgb2TFJdZ3aWpT8W2kPoypSGP7dZUyzxJ9ee4buM5Fg==", + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz", + "integrity": "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==", "dev": true, "license": "MIT", "dependencies": { @@ -4872,26 +4823,26 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.40.2", - "@rollup/rollup-android-arm64": "4.40.2", - "@rollup/rollup-darwin-arm64": "4.40.2", - "@rollup/rollup-darwin-x64": "4.40.2", - "@rollup/rollup-freebsd-arm64": "4.40.2", - "@rollup/rollup-freebsd-x64": "4.40.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.40.2", - "@rollup/rollup-linux-arm-musleabihf": "4.40.2", - "@rollup/rollup-linux-arm64-gnu": "4.40.2", - "@rollup/rollup-linux-arm64-musl": "4.40.2", - "@rollup/rollup-linux-loongarch64-gnu": "4.40.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.40.2", - "@rollup/rollup-linux-riscv64-gnu": "4.40.2", - "@rollup/rollup-linux-riscv64-musl": "4.40.2", - "@rollup/rollup-linux-s390x-gnu": "4.40.2", - "@rollup/rollup-linux-x64-gnu": "4.40.2", - "@rollup/rollup-linux-x64-musl": "4.40.2", - "@rollup/rollup-win32-arm64-msvc": "4.40.2", - "@rollup/rollup-win32-ia32-msvc": "4.40.2", - "@rollup/rollup-win32-x64-msvc": "4.40.2", + "@rollup/rollup-android-arm-eabi": "4.41.1", + "@rollup/rollup-android-arm64": "4.41.1", + "@rollup/rollup-darwin-arm64": "4.41.1", + "@rollup/rollup-darwin-x64": "4.41.1", + "@rollup/rollup-freebsd-arm64": "4.41.1", + "@rollup/rollup-freebsd-x64": "4.41.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.41.1", + "@rollup/rollup-linux-arm-musleabihf": "4.41.1", + "@rollup/rollup-linux-arm64-gnu": "4.41.1", + "@rollup/rollup-linux-arm64-musl": "4.41.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.41.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-musl": "4.41.1", + "@rollup/rollup-linux-s390x-gnu": "4.41.1", + "@rollup/rollup-linux-x64-gnu": "4.41.1", + "@rollup/rollup-linux-x64-musl": "4.41.1", + "@rollup/rollup-win32-arm64-msvc": "4.41.1", + "@rollup/rollup-win32-ia32-msvc": "4.41.1", + "@rollup/rollup-win32-x64-msvc": "4.41.1", "fsevents": "~2.3.2" } }, @@ -5123,6 +5074,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.1.tgz", + "integrity": "sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -5171,86 +5142,24 @@ "dev": true, "license": "MIT" }, - "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyglobby": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", - "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", "dev": true, "license": "MIT", - "dependencies": { - "fdir": "^6.4.4", - "picomatch": "^4.0.2" - }, "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.4.4", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", - "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "node": ">=14.0.0" } }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", "dev": true, "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/tinypool": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", - "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, - "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", - "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" + "node": ">=14.0.0" } }, "node_modules/tmpl": { @@ -5430,6 +5339,13 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "dev": true, + "license": "MIT" + }, "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", @@ -5491,24 +5407,21 @@ } }, "node_modules/vite": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", - "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "version": "5.4.19", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz", + "integrity": "sha512-qO3aKv3HoQC8QKiNSTuUM1l9o/XX3+c+VTgLHbJWHZGeTPVAg2XwazI9UWzoxjIJCGCV2zU60uqMzjeLZuULqA==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -5517,25 +5430,19 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "jiti": ">=1.21.0", + "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" + "terser": "^5.4.0" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, - "jiti": { - "optional": true - }, "less": { "optional": true }, @@ -5556,110 +5463,504 @@ }, "terser": { "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true } } }, "node_modules/vite-node": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.1.3.tgz", - "integrity": "sha512-uHV4plJ2IxCl4u1up1FQRrqclylKAogbtBfOTwcuJ28xFi+89PZ57BRh+naIRvH70HPwxy5QHYzg1OrEaC7AbA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", "dev": true, "license": "MIT", "dependencies": { "cac": "^6.7.14", - "debug": "^4.4.0", - "es-module-lexer": "^1.7.0", - "pathe": "^2.0.3", - "vite": "^5.0.0 || ^6.0.0" + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" }, "bin": { "vite-node": "vite-node.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/vite/node_modules/fdir": { - "version": "6.4.4", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", - "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "node_modules/vite/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], "dev": true, "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" } }, - "node_modules/vite/node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, "node_modules/vitest": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.1.3.tgz", - "integrity": "sha512-188iM4hAHQ0km23TN/adso1q5hhwKqUpv+Sd6p5sOuh6FhQnRNW3IsiIpvxqahtBabsJ2SLZgmGSpcYK4wQYJw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/expect": "3.1.3", - "@vitest/mocker": "3.1.3", - "@vitest/pretty-format": "^3.1.3", - "@vitest/runner": "3.1.3", - "@vitest/snapshot": "3.1.3", - "@vitest/spy": "3.1.3", - "@vitest/utils": "3.1.3", - "chai": "^5.2.0", - "debug": "^4.4.0", - "expect-type": "^1.2.1", - "magic-string": "^0.30.17", - "pathe": "^2.0.3", - "std-env": "^3.9.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", - "tinyglobby": "^0.2.13", - "tinypool": "^1.0.2", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0", - "vite-node": "3.1.3", - "why-is-node-running": "^2.3.0" + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.1", + "why-is-node-running": "^2.2.2" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.1.3", - "@vitest/ui": "3.1.3", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", "happy-dom": "*", "jsdom": "*" }, @@ -5667,9 +5968,6 @@ "@edge-runtime/vm": { "optional": true }, - "@types/debug": { - "optional": true - }, "@types/node": { "optional": true }, @@ -5687,6 +5985,150 @@ } } }, + "node_modules/vitest/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==", + "dev": true, + "license": "MIT", + "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/vitest/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "license": "MIT", + "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/vitest/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==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/vitest/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", diff --git a/package/package.json b/package/package.json index 8e3f837..43dded6 100644 --- a/package/package.json +++ b/package/package.json @@ -1,7 +1,7 @@ { "name": "shnippet", "type": "module", - "version": "0.0.3-alpha", + "version": "0.0.1-alpha", "description": "A snippet extraction tool for various programming languages.", "main": "dist/index.js", "browser": "dist/client.browser.js", @@ -23,9 +23,11 @@ "start": "node dist/src/bin/cli", "dev": "tsc --watch", "test": "vitest", - "postinstall": "chmod +x dist/bin/cli.js", "test:watch": "vitest watch", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", + "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"", + "type-check": "tsc --noEmit" }, "keywords": [ "snippet", @@ -43,8 +45,10 @@ "@types/node": "^22.7.4", "esbuild": "^0.25.4", "jest": "^29.7.0", + "prettier": "^3.2.5", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", - "typescript": "^5.6.2" + "typescript": "^5.6.2", + "vitest": "^1.2.2" } } diff --git a/package/shnippet.config.ts b/package/shnippet.config.ts index fe4b5d5..f142ca8 100644 --- a/package/shnippet.config.ts +++ b/package/shnippet.config.ts @@ -1,23 +1,14 @@ export const config = { - rootDirectory: "./src", - snippetOutputDirectory: "./snippets", - fileExtensions: [ - ".js", - ".ts", - ".kt", - ".gradle", - ".xml", - ".bash", - ".swift", - ".py", - ], + rootDirectory: './src', + snippetOutputDirectory: './snippets', + fileExtensions: ['.js', '.ts', '.kt', '.gradle', '.xml', '.bash', '.swift', '.py'], exclude: [], snippetTags: { - start: ":snippet-start:", - end: ":snippet-end:", - prependStart: ":prepend-start:", - prependEnd: ":prepend-end:", + start: ':snippet-start:', + end: ':snippet-end:', + prependStart: ':prepend-start:', + prependEnd: ':prepend-end:', }, - outputDirectoryStructure: "byLanguage", - version: "1.0.0", + outputDirectoryStructure: 'byLanguage', + version: '1.0.0', }; diff --git a/package/src/bin/cli.ts b/package/src/bin/cli.ts index d8bac78..278cd92 100644 --- a/package/src/bin/cli.ts +++ b/package/src/bin/cli.ts @@ -1,8 +1,8 @@ -import { SnippetExtractor } from "../index.js"; -import fs from "fs"; -import path from "path"; -import { rimraf } from "rimraf"; -import { fileURLToPath } from "url"; +import { SnippetExtractor } from '../index.js'; +import fs from 'fs'; +import path from 'path'; +import { rimraf } from 'rimraf'; +import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -17,47 +17,42 @@ async function loadConfig(configPath: string) { async function main() { const args = process.argv.slice(2); - const configFlagIndex = args.indexOf("--config"); + const configFlagIndex = args.indexOf('--config'); if (configFlagIndex !== -1 && args.length > configFlagIndex + 1) { const configPath = path.resolve(process.cwd(), args[configFlagIndex + 1]); config = await loadConfig(configPath); } else { - console.error( - "Error: --config flag is required. Please specify a config file path." - ); + console.error('Error: --config flag is required. Please specify a config file path.'); process.exit(1); } config.rootDirectory = path.resolve(process.cwd(), config.rootDirectory); - config.snippetOutputDirectory = path.resolve( - process.cwd(), - config.snippetOutputDirectory - ); + config.snippetOutputDirectory = path.resolve(process.cwd(), config.snippetOutputDirectory); // Check for "clear" argument to clear the output directory - if (args.includes("clear")) { + if (args.includes('clear')) { clearOutputDirectory(config.snippetOutputDirectory); return; } // Handle the --structure flag - const structureFlagIndex = args.indexOf("--structure"); + const structureFlagIndex = args.indexOf('--structure'); if (structureFlagIndex !== -1 && args.length > structureFlagIndex + 1) { const structureValue = args[structureFlagIndex + 1]; - const validStructures = ["flat", "match", "organized", "byLanguage"]; + const validStructures = ['flat', 'match', 'organized', 'byLanguage']; if (validStructures.includes(structureValue)) { config.outputDirectoryStructure = structureValue; } else { console.error( `Invalid output directory structure: '${structureValue}'. Valid options are: ${validStructures.join( - ", " + ', ' )}` ); process.exit(1); } } else if (structureFlagIndex !== -1) { console.error( - "The --structure flag requires a value. Valid options are: flat, match, organized, byLanguage" + 'The --structure flag requires a value. Valid options are: flat, match, organized, byLanguage' ); process.exit(1); } diff --git a/package/src/client.ts b/package/src/client.ts index 70c20f6..1a9023c 100644 --- a/package/src/client.ts +++ b/package/src/client.ts @@ -1 +1 @@ -export { snippetManager } from "./utils/snippetManager"; +export { snippetManager } from './utils/snippetManager'; diff --git a/package/src/extract/SnippetExtractor.ts b/package/src/extract/SnippetExtractor.ts index 764b536..2f2e505 100644 --- a/package/src/extract/SnippetExtractor.ts +++ b/package/src/extract/SnippetExtractor.ts @@ -1,7 +1,7 @@ -import path from "path"; -import { promises as fs } from "fs"; +import path from 'path'; +import { promises as fs } from 'fs'; -type OutputStructure = "flat" | "match" | "organized" | "byLanguage"; +type OutputStructure = 'flat' | 'match' | 'organized' | 'byLanguage'; interface SnippetExtractorConfig { rootDirectory: string; @@ -26,16 +26,14 @@ export class SnippetExtractor { private processedSnippets: Map> = new Map(); constructor(config: SnippetExtractorConfig) { - if (typeof window !== "undefined") { - throw new Error( - "SnippetExtractor can only be used in a Node.js environment" - ); + if (typeof window !== 'undefined') { + throw new Error('SnippetExtractor can only be used in a Node.js environment'); } this.validateConfig(config); this.config = { ...config, - outputDirectoryStructure: config.outputDirectoryStructure || "byLanguage", + outputDirectoryStructure: config.outputDirectoryStructure || 'byLanguage', }; this.projectRoot = config.projectRoot || process.cwd(); } @@ -45,13 +43,11 @@ export class SnippetExtractor { } private validateConfig(config: SnippetExtractorConfig): void { - if (!config.rootDirectory) throw new Error("rootDirectory is required"); - if (!config.snippetOutputDirectory) - throw new Error("snippetOutputDirectory is required"); - if (!config.fileExtensions?.length) - throw new Error("fileExtensions must not be empty"); + if (!config.rootDirectory) throw new Error('rootDirectory is required'); + if (!config.snippetOutputDirectory) throw new Error('snippetOutputDirectory is required'); + if (!config.fileExtensions?.length) throw new Error('fileExtensions must not be empty'); if (!config.snippetTags?.start || !config.snippetTags?.end) { - throw new Error("snippetTags must include start and end tags"); + throw new Error('snippetTags must include start and end tags'); } } @@ -65,7 +61,7 @@ export class SnippetExtractor { if (endIndex === -1) break; const snippetNameLine = content - .substring(startIndex + start.length, content.indexOf("\n", startIndex)) + .substring(startIndex + start.length, content.indexOf('\n', startIndex)) .trim(); startIndex = endIndex + end.length; } @@ -77,7 +73,7 @@ export class SnippetExtractor { endIndex = 0; while ((startIndex = content.indexOf(prependStart, startIndex)) !== -1) { - const endOfStartTag = content.indexOf("\n", startIndex); + const endOfStartTag = content.indexOf('\n', startIndex); const snippetNamesLine = content .substring(startIndex + prependStart.length, endOfStartTag) .trim(); @@ -90,16 +86,16 @@ export class SnippetExtractor { const importBlock = content .substring(endOfStartTag + 1, endIndex) - .split("\n") + .split('\n') .map((line) => { const trimmedLine = line.trimStart(); - if (trimmedLine.startsWith("//") || trimmedLine.startsWith("#")) { - return ""; + if (trimmedLine.startsWith('//') || trimmedLine.startsWith('#')) { + return ''; } return line; }) - .filter((line) => line.trim() !== "") - .join("\n") + .filter((line) => line.trim() !== '') + .join('\n') .trim(); snippetNames.forEach((name) => { @@ -113,12 +109,9 @@ export class SnippetExtractor { } } - private extractSnippetsFromFile( - content: string, - filePath: string - ): Record { + private extractSnippetsFromFile(content: string, filePath: string): Record { const snippets: Record = {}; - const lines = content.split("\n"); + const lines = content.split('\n'); let currentSnippet: string | null = null; let currentSnippetLines: string[] = []; let currentPrependBlock: string[] = []; @@ -136,19 +129,17 @@ export class SnippetExtractor { // Simple comment stripping - just check for // or # at start const strippedLine = - line.trimStart().startsWith("//") || line.trimStart().startsWith("#") + line.trimStart().startsWith('//') || line.trimStart().startsWith('#') ? line .trimStart() - .slice(line.trimStart().startsWith("//") ? 2 : 1) + .slice(line.trimStart().startsWith('//') ? 2 : 1) .trimStart() : line; if (strippedLine.includes(startTag)) { const snippetName = this.extractSnippetName(strippedLine, startTag); if (!snippetName) { - throw new Error( - `Missing snippet name in file ${path.basename(filePath)}` - ); + throw new Error(`Missing snippet name in file ${path.basename(filePath)}`); } if (this.processedSnippets.get(language)?.has(snippetName)) { @@ -160,12 +151,9 @@ export class SnippetExtractor { currentPrependBlock = this.prependBlocks[snippetName] || []; this.processedSnippets.get(language)?.add(snippetName); } else if (strippedLine.includes(endTag) && currentSnippet) { - const normalizedContent = - this.normalizeIndentation(currentSnippetLines); + const normalizedContent = this.normalizeIndentation(currentSnippetLines); const prependContent = - currentPrependBlock.length > 0 - ? currentPrependBlock.join("\n") + "\n\n" - : ""; + currentPrependBlock.length > 0 ? currentPrependBlock.join('\n') + '\n\n' : ''; snippets[currentSnippet] = prependContent + normalizedContent; currentSnippet = null; @@ -176,9 +164,7 @@ export class SnippetExtractor { if (currentSnippet) { throw new Error( - `Missing end tag for snippet '${currentSnippet}' in file ${path.basename( - filePath - )}` + `Missing end tag for snippet '${currentSnippet}' in file ${path.basename(filePath)}` ); } @@ -191,11 +177,11 @@ export class SnippetExtractor { } private normalizeIndentation(lines: string[]): string { - if (lines.length === 0) return ""; + if (lines.length === 0) return ''; // Find the minimum indentation const minIndent = lines.reduce((min, line) => { - if (line.trim() === "") return min; + if (line.trim() === '') return min; const indent = line.match(/^\s*/)?.[0].length ?? 0; return Math.min(min, indent); }, Infinity); @@ -205,34 +191,28 @@ export class SnippetExtractor { .map((line) => { const strippedLine = line.slice(minIndent); // Skip lines that are only comments - if (strippedLine.trim() === "//" || strippedLine.trim() === "#") { - return ""; + if (strippedLine.trim() === '//' || strippedLine.trim() === '#') { + return ''; } // Strip comment markers if present - return strippedLine.trimStart().startsWith("//") || - strippedLine.trimStart().startsWith("#") + return strippedLine.trimStart().startsWith('//') || strippedLine.trimStart().startsWith('#') ? strippedLine .trimStart() - .slice(strippedLine.trimStart().startsWith("//") ? 2 : 1) + .slice(strippedLine.trimStart().startsWith('//') ? 2 : 1) .trimStart() : strippedLine; }) - .filter((line) => line.trim() !== "") // Remove empty lines - .join("\n") + .filter((line) => line.trim() !== '') // Remove empty lines + .join('\n') .trim(); } private shouldExcludeFile(filePath: string) { const fileName = path.basename(filePath); - return this.config.exclude.some( - (excludeString) => fileName === excludeString - ); + return this.config.exclude.some((excludeString) => fileName === excludeString); } - public async processDirectory( - directory: string, - relativePath = "" - ): Promise { + public async processDirectory(directory: string, relativePath = ''): Promise { const absoluteDir = path.resolve(this.projectRoot, directory); try { @@ -244,27 +224,17 @@ export class SnippetExtractor { const stat = await fs.stat(fullPath); if (stat.isDirectory()) { - await this.processDirectory( - path.join(directory, item), - path.join(relativePath, item) - ); + await this.processDirectory(path.join(directory, item), path.join(relativePath, item)); } else if (this.config.fileExtensions.includes(path.extname(item))) { - const content = await fs.readFile(fullPath, "utf-8"); + const content = await fs.readFile(fullPath, 'utf-8'); this.prependBlocks = {}; this.gatherSnippetNames(content); this.gatherImports(content); if (!this.shouldExcludeFile(fullPath)) { - const fileSnippets = this.extractSnippetsFromFile( - content, - fullPath - ); - await this.writeSnippetsToFile( - fileSnippets, - fullPath, - relativePath - ); + const fileSnippets = this.extractSnippetsFromFile(content, fullPath); + await this.writeSnippetsToFile(fileSnippets, fullPath, relativePath); } } }) @@ -293,7 +263,7 @@ export class SnippetExtractor { for (const [snippetName, content] of Object.entries(snippets)) { const snippetPath = path.join(outputDir, `${snippetName}.snippet.txt`); - await fs.writeFile(snippetPath, content, "utf-8"); + await fs.writeFile(snippetPath, content, 'utf-8'); } } catch (error) { console.error(`Error writing snippets to ${outputDir}:`, error); @@ -303,30 +273,27 @@ export class SnippetExtractor { private getLanguageFromExtension(extension: string): string { const extensionToLanguageMap: Record = { - ".js": "js", - ".ts": "typescript", - ".kt": "kt", - ".swift": "swift", - ".gradle": "gradle", - ".bash": "bash", - ".xml": "xml", - ".py": "python", + '.js': 'js', + '.ts': 'typescript', + '.kt': 'kt', + '.swift': 'swift', + '.gradle': 'gradle', + '.bash': 'bash', + '.xml': 'xml', + '.py': 'python', }; - return extensionToLanguageMap[extension] || "other"; + return extensionToLanguageMap[extension] || 'other'; } public async extractSnippets(): Promise { - const absoluteOutputDir = path.resolve( - this.projectRoot, - this.config.snippetOutputDirectory - ); + const absoluteOutputDir = path.resolve(this.projectRoot, this.config.snippetOutputDirectory); try { await fs.mkdir(absoluteOutputDir, { recursive: true }); await this.processDirectory(this.config.rootDirectory); } catch (error) { - console.error("Error extracting snippets:", error); + console.error('Error extracting snippets:', error); throw error; } } diff --git a/package/src/index.ts b/package/src/index.ts index a311cdd..22a6a3b 100644 --- a/package/src/index.ts +++ b/package/src/index.ts @@ -1,2 +1,2 @@ -import SnippetExtractor from "./extract/SnippetExtractor.js"; +import SnippetExtractor from './extract/SnippetExtractor.js'; export { SnippetExtractor }; diff --git a/package/src/shnippet.config.ts b/package/src/shnippet.config.ts index c1c26c9..df81580 100644 --- a/package/src/shnippet.config.ts +++ b/package/src/shnippet.config.ts @@ -1,18 +1,14 @@ export const config = { - rootDirectory: "./site-new/testsuites", - snippetOutputDirectory: "./site-new/snippets", - fileExtensions: [".js", ".ts", ".kt", ".gradle", ".xml", ".bash", ".swift"], - exclude: [ - "pfiOverviewReadOfferingsJs", - "pfiOverviewWriteJs", - "pfiOverviewWriteOfferingsJs", - ], + rootDirectory: './site-new/testsuites', + snippetOutputDirectory: './site-new/snippets', + fileExtensions: ['.js', '.ts', '.kt', '.gradle', '.xml', '.bash', '.swift'], + exclude: ['pfiOverviewReadOfferingsJs', 'pfiOverviewWriteJs', 'pfiOverviewWriteOfferingsJs'], snippetTags: { - start: ":snippet-start:", - end: ":snippet-end:", - prependStart: ":prepend-start:", - prependEnd: ":prepend-end:", + start: ':snippet-start:', + end: ':snippet-end:', + prependStart: ':prepend-start:', + prependEnd: ':prepend-end:', }, - outputDirectoryStructure: "byLanguage", - version: "1.0.0", + outputDirectoryStructure: 'byLanguage', + version: '1.0.0', }; diff --git a/package/src/utils/snippetManager.ts b/package/src/utils/snippetManager.ts index 24b697c..d4664d2 100644 --- a/package/src/utils/snippetManager.ts +++ b/package/src/utils/snippetManager.ts @@ -9,7 +9,7 @@ export interface SnippetConfig { prependStart: string; prependEnd: string; }; - outputDirectoryStructure?: "byLanguage" | "flat"; + outputDirectoryStructure?: 'byLanguage' | 'flat'; version?: string; baseUrl?: string; supportedLanguages?: string[]; @@ -36,8 +36,8 @@ class SnippetManagerImpl implements SnippetManager { constructor(config: Partial = {}) { this.config = { - baseUrl: "http://localhost:3000/snippets", - supportedLanguages: ["python", "kotlin"], + baseUrl: 'http://localhost:3000/snippets', + supportedLanguages: ['python', 'kotlin'], ...config, }; } @@ -60,38 +60,33 @@ class SnippetManagerImpl implements SnippetManager { try { const url = `${this.config.baseUrl}/${language}/${name}.snippet.txt`; - console.log("Fetching from:", url); + console.log('Fetching from:', url); const response = await fetch(url); - console.log("Response status:", response.status); - console.log("Response type:", response.type); + console.log('Response status:', response.status); + console.log('Response type:', response.type); if (!response.ok) { - throw new Error( - `Failed to fetch snippet: ${name} for language: ${language}` - ); + throw new Error(`Failed to fetch snippet: ${name} for language: ${language}`); } const content = await response.text(); - console.log("Received content:", content); + console.log('Received content:', content); this.cache.set(key, content); return content; } catch (error) { - console.error( - `Error fetching snippet ${name} for language ${language}:`, - error - ); + console.error(`Error fetching snippet ${name} for language ${language}:`, error); throw error; } } getSnippetDisplayInfo(name: string) { - const languages = this.config.supportedLanguages || ["python", "kotlin"]; + const languages = this.config.supportedLanguages || ['python', 'kotlin']; const imports: Record = {}; // Use configured imports or defaults const defaultImports = this.config.defaultImports || { - python: ["from typing import Any"], - kotlin: ["import java.util.*"], + python: ['from typing import Any'], + kotlin: ['import java.util.*'], }; // Add imports for each supported language @@ -106,16 +101,13 @@ class SnippetManagerImpl implements SnippetManager { }; } - formatSnippet( - content: string, - options: { language: string; showLineNumbers?: boolean } - ): string { + formatSnippet(content: string, options: { language: string; showLineNumbers?: boolean }): string { if (!options.showLineNumbers) return content; return content - .split("\n") + .split('\n') .map((line, i) => `${i + 1} | ${line}`) - .join("\n"); + .join('\n'); } } diff --git a/package/test/__fixtures__/example.js b/package/test/__fixtures__/example.js index fcd3d09..c1eca25 100644 --- a/package/test/__fixtures__/example.js +++ b/package/test/__fixtures__/example.js @@ -1,18 +1,18 @@ // Example JavaScript file with snippets //:snippet-start: js-hello function sayHello() { - console.log("Hello from JavaScript!"); + console.log('Hello from JavaScript!'); } //:snippet-end: //:snippet-start: js-class class Example { - constructor() { - this.message = "This is a JavaScript class"; - } + constructor() { + this.message = 'This is a JavaScript class'; + } - getMessage() { - return this.message; - } + getMessage() { + return this.message; + } } -//:snippet-end: \ No newline at end of file +//:snippet-end: diff --git a/package/test/__fixtures__/example.ts b/package/test/__fixtures__/example.ts index 362c82a..c48bcb6 100644 --- a/package/test/__fixtures__/example.ts +++ b/package/test/__fixtures__/example.ts @@ -1,7 +1,7 @@ // Example TypeScript file with snippets //:snippet-start: ts-hello function sayHello(): void { - console.log("Hello from TypeScript!"); + console.log('Hello from TypeScript!'); } //:snippet-end: @@ -9,7 +9,7 @@ function sayHello(): void { class Example { private message: string; constructor() { - this.message = "This is a TypeScript class"; + this.message = 'This is a TypeScript class'; } getMessage(): string { diff --git a/package/test/__fixtures__/malformed.js b/package/test/__fixtures__/malformed.js index 871af4e..6a508bd 100644 --- a/package/test/__fixtures__/malformed.js +++ b/package/test/__fixtures__/malformed.js @@ -1,7 +1,7 @@ // Example file with a malformed snippet (missing end tag) //:snippet-start: malformed function test() { - console.log("This snippet has no end tag"); + console.log('This snippet has no end tag'); } // This is just a regular comment -// The snippet above is missing its end tag \ No newline at end of file +// The snippet above is missing its end tag diff --git a/package/test/__fixtures__/missing-name.js b/package/test/__fixtures__/missing-name.js index 6a8160a..bcadc29 100644 --- a/package/test/__fixtures__/missing-name.js +++ b/package/test/__fixtures__/missing-name.js @@ -1,5 +1,5 @@ //:snippet-start: function hello() { - console.log("Hello, world!"); + console.log('Hello, world!'); } -//:snippet-end: \ No newline at end of file +//:snippet-end: diff --git a/package/test/extract/SnippetExtractor.test.ts b/package/test/extract/SnippetExtractor.test.ts index 32bb5dd..597e3de 100644 --- a/package/test/extract/SnippetExtractor.test.ts +++ b/package/test/extract/SnippetExtractor.test.ts @@ -1,80 +1,73 @@ -import { describe, it, expect, beforeAll } from "vitest"; -import { SnippetExtractor } from "../../src/extract/SnippetExtractor"; -import path from "path"; -import { promises as fs } from "fs"; +import { describe, it, expect, beforeAll } from 'vitest'; +import { SnippetExtractor } from '../../src/extract/SnippetExtractor'; +import path from 'path'; +import { promises as fs } from 'fs'; const config = { - rootDirectory: "test/__fixtures__", - snippetOutputDirectory: "snippets", - fileExtensions: [".js", ".ts", ".py", ".kt"], - exclude: ["node_modules", "dist"], + rootDirectory: 'test/__fixtures__', + snippetOutputDirectory: 'snippets', + fileExtensions: ['.js', '.ts', '.py', '.kt'], + exclude: ['node_modules', 'dist'], snippetTags: { - start: ":snippet-start:", - end: ":snippet-end:", - prependStart: ":prepend-start:", - prependEnd: ":prepend-end:", + start: ':snippet-start:', + end: ':snippet-end:', + prependStart: ':prepend-start:', + prependEnd: ':prepend-end:', }, - outputDirectoryStructure: "byLanguage" as const, + outputDirectoryStructure: 'byLanguage' as const, projectRoot: process.cwd(), }; -describe("SnippetExtractor", () => { - describe("config validation", () => { - it("should accept a valid config", () => { +describe('SnippetExtractor', () => { + describe('config validation', () => { + it('should accept a valid config', () => { expect(() => new SnippetExtractor(config)).not.toThrow(); }); - it("should throw when rootDirectory is missing", () => { - const invalidConfig = { ...config, rootDirectory: "" }; - expect(() => new SnippetExtractor(invalidConfig)).toThrow( - "rootDirectory is required" - ); + it('should throw when rootDirectory is missing', () => { + const invalidConfig = { ...config, rootDirectory: '' }; + expect(() => new SnippetExtractor(invalidConfig)).toThrow('rootDirectory is required'); }); - it("should throw when snippetOutputDirectory is missing", () => { - const invalidConfig = { ...config, snippetOutputDirectory: "" }; + it('should throw when snippetOutputDirectory is missing', () => { + const invalidConfig = { ...config, snippetOutputDirectory: '' }; expect(() => new SnippetExtractor(invalidConfig)).toThrow( - "snippetOutputDirectory is required" + 'snippetOutputDirectory is required' ); }); - it("should throw when fileExtensions is empty", () => { + it('should throw when fileExtensions is empty', () => { const invalidConfig = { ...config, fileExtensions: [] }; - expect(() => new SnippetExtractor(invalidConfig)).toThrow( - "fileExtensions must not be empty" - ); + expect(() => new SnippetExtractor(invalidConfig)).toThrow('fileExtensions must not be empty'); }); - it("should throw when snippetTags.start is missing", () => { + it('should throw when snippetTags.start is missing', () => { const invalidConfig = { ...config, - snippetTags: { ...config.snippetTags, start: "" }, + snippetTags: { ...config.snippetTags, start: '' }, }; expect(() => new SnippetExtractor(invalidConfig)).toThrow( - "snippetTags must include start and end tags" + 'snippetTags must include start and end tags' ); }); - it("should throw when snippetTags.end is missing", () => { + it('should throw when snippetTags.end is missing', () => { const invalidConfig = { ...config, - snippetTags: { ...config.snippetTags, end: "" }, + snippetTags: { ...config.snippetTags, end: '' }, }; expect(() => new SnippetExtractor(invalidConfig)).toThrow( - "snippetTags must include start and end tags" + 'snippetTags must include start and end tags' ); }); }); - describe("valid snippets", () => { + describe('valid snippets', () => { let extractor: SnippetExtractor; beforeAll(async () => { // Clean up any existing snippets - const absoluteOutputDir = path.resolve( - process.cwd(), - config.snippetOutputDirectory - ); + const absoluteOutputDir = path.resolve(process.cwd(), config.snippetOutputDirectory); try { await fs.rm(absoluteOutputDir, { recursive: true, force: true }); } catch (error) { @@ -84,55 +77,55 @@ describe("SnippetExtractor", () => { // Create a new config that excludes the malformed file const validConfig = { ...config, - exclude: [...config.exclude, "malformed.js", "missing-name.js"], + exclude: [...config.exclude, 'malformed.js', 'missing-name.js'], }; extractor = new SnippetExtractor(validConfig); await extractor.extractSnippets(); }); - describe("extractSnippets", () => { - it("should create directories for each language", async () => { + describe('extractSnippets', () => { + it('should create directories for each language', async () => { const absoluteOutputDir = path.resolve( extractor.getProjectRoot(), config.snippetOutputDirectory ); const items = await fs.readdir(absoluteOutputDir); - expect(items).toContain("typescript"); - expect(items).toContain("js"); - expect(items).toContain("python"); - expect(items).toContain("kt"); + expect(items).toContain('typescript'); + expect(items).toContain('js'); + expect(items).toContain('python'); + expect(items).toContain('kt'); }); - it("should create files with correct names in each language directory", async () => { + it('should create files with correct names in each language directory', async () => { const absoluteOutputDir = path.resolve( extractor.getProjectRoot(), config.snippetOutputDirectory ); // Check JavaScript snippets - const jsDir = path.join(absoluteOutputDir, "js"); + const jsDir = path.join(absoluteOutputDir, 'js'); const jsFiles = await fs.readdir(jsDir); - expect(jsFiles).toContain("js-hello.snippet.txt"); - expect(jsFiles).toContain("js-class.snippet.txt"); + expect(jsFiles).toContain('js-hello.snippet.txt'); + expect(jsFiles).toContain('js-class.snippet.txt'); // Check Kotlin snippets - const ktDir = path.join(absoluteOutputDir, "kt"); + const ktDir = path.join(absoluteOutputDir, 'kt'); const ktFiles = await fs.readdir(ktDir); - expect(ktFiles).toContain("example1.snippet.txt"); - expect(ktFiles).toContain("example2.snippet.txt"); + expect(ktFiles).toContain('example1.snippet.txt'); + expect(ktFiles).toContain('example2.snippet.txt'); // Check Python snippets - const pyDir = path.join(absoluteOutputDir, "python"); + const pyDir = path.join(absoluteOutputDir, 'python'); const pyFiles = await fs.readdir(pyDir); - expect(pyFiles).toContain("example1.snippet.txt"); - expect(pyFiles).toContain("example2.snippet.txt"); + expect(pyFiles).toContain('example1.snippet.txt'); + expect(pyFiles).toContain('example2.snippet.txt'); }); - it("should extract content correctly from source files", async () => { + it('should extract content correctly from source files', async () => { const normalizeContent = (content: string): string => { return content - .replace(/\s+/g, "") // Remove all whitespace + .replace(/\s+/g, '') // Remove all whitespace .toLowerCase(); // Convert to lowercase }; @@ -149,35 +142,28 @@ describe("SnippetExtractor", () => { const rawContent = content.slice(startIndex, endIndex).trim(); // Remove any comment markers at the start of each line return rawContent - .split("\n") + .split('\n') .map((line) => { // First remove any comment markers - const withoutComments = line - .replace(/^[\s]*[\/#]+\s*/, "") - .trim(); + const withoutComments = line.replace(/^[\s]*[\/#]+\s*/, '').trim(); // Then remove the snippet name if it's at the start of the first line - if (line === rawContent.split("\n")[0]) { - return withoutComments.replace(/^[a-z0-9-]+\s*/, "").trim(); + if (line === rawContent.split('\n')[0]) { + return withoutComments.replace(/^[a-z0-9-]+\s*/, '').trim(); } return withoutComments; }) - .join("\n") + .join('\n') .trim(); }; // Test JavaScript content const jsSource = await fs.readFile( - path.join(process.cwd(), config.rootDirectory, "example.js"), - "utf-8" + path.join(process.cwd(), config.rootDirectory, 'example.js'), + 'utf-8' ); const jsSnippet = await fs.readFile( - path.join( - process.cwd(), - config.snippetOutputDirectory, - "js", - "js-hello.snippet.txt" - ), - "utf-8" + path.join(process.cwd(), config.snippetOutputDirectory, 'js', 'js-hello.snippet.txt'), + 'utf-8' ); const jsSourceContent = extractContentFromSource( @@ -185,23 +171,16 @@ describe("SnippetExtractor", () => { config.snippetTags.start, config.snippetTags.end ); - expect(normalizeContent(jsSnippet)).toBe( - normalizeContent(jsSourceContent) - ); + expect(normalizeContent(jsSnippet)).toBe(normalizeContent(jsSourceContent)); // Test Kotlin content const ktSource = await fs.readFile( - path.join(process.cwd(), config.rootDirectory, "example.kt"), - "utf-8" + path.join(process.cwd(), config.rootDirectory, 'example.kt'), + 'utf-8' ); const ktSnippet = await fs.readFile( - path.join( - process.cwd(), - config.snippetOutputDirectory, - "kt", - "example1.snippet.txt" - ), - "utf-8" + path.join(process.cwd(), config.snippetOutputDirectory, 'kt', 'example1.snippet.txt'), + 'utf-8' ); const ktSourceContent = extractContentFromSource( @@ -209,32 +188,30 @@ describe("SnippetExtractor", () => { config.snippetTags.start, config.snippetTags.end ); - expect(normalizeContent(ktSnippet)).toBe( - normalizeContent(ktSourceContent) - ); + expect(normalizeContent(ktSnippet)).toBe(normalizeContent(ktSourceContent)); }); }); }); - describe("error handling", () => { - it("should throw an error when a snippet is missing its end tag", async () => { + describe('error handling', () => { + it('should throw an error when a snippet is missing its end tag', async () => { const extractor = new SnippetExtractor({ ...config, - exclude: [...config.exclude, "missing-name.js"], + exclude: [...config.exclude, 'missing-name.js'], }); await expect(extractor.extractSnippets()).rejects.toThrow( "Missing end tag for snippet 'malformed' in file malformed.js" ); }); - it("should throw an error when a snippet is missing its name", async () => { + it('should throw an error when a snippet is missing its name', async () => { const testConfig = { ...config, - exclude: [...config.exclude, "malformed.js"], + exclude: [...config.exclude, 'malformed.js'], }; const extractor = new SnippetExtractor(testConfig); await expect(extractor.extractSnippets()).rejects.toThrow( - "Missing snippet name in file missing-name.js" + 'Missing snippet name in file missing-name.js' ); }); }); diff --git a/package/test/utils/snippetManager.test.ts b/package/test/utils/snippetManager.test.ts index 2d3cec3..678469b 100644 --- a/package/test/utils/snippetManager.test.ts +++ b/package/test/utils/snippetManager.test.ts @@ -1,7 +1,7 @@ -import { snippetManager } from "../../src/utils/snippetManager"; -import { describe, expect, it, beforeEach, vi } from "vitest"; +import { snippetManager } from '../../src/utils/snippetManager'; +import { describe, expect, it, beforeEach, vi } from 'vitest'; -describe("SnippetManager", () => { +describe('SnippetManager', () => { beforeEach(() => { global.fetch = vi.fn().mockImplementation(() => Promise.resolve({ @@ -10,74 +10,72 @@ describe("SnippetManager", () => { } as Response) ); snippetManager.updateConfig({ - exclude: ["**/malformed/**", "**/missing-name/**"], - supportedLanguages: ["python"], + exclude: ['**/malformed/**', '**/missing-name/**'], + supportedLanguages: ['python'], }); }); - it("Can get a snippet", async () => { - const snippet = await snippetManager.getSnippet("test", "python"); + it('Can get a snippet', async () => { + const snippet = await snippetManager.getSnippet('test', 'python'); expect(snippet).toBe("print('Hello, world!')"); }); - it("Can display info for a snippet", () => { - const displayInfo = snippetManager.getSnippetDisplayInfo("test"); + it('Can display info for a snippet', () => { + const displayInfo = snippetManager.getSnippetDisplayInfo('test'); expect(displayInfo).toEqual({ - languages: ["python"], - defaultLanguage: "python", + languages: ['python'], + defaultLanguage: 'python', imports: { - python: ["from typing import Any"], + python: ['from typing import Any'], }, }); }); - it("Can update config and clear cache", async () => { + it('Can update config and clear cache', async () => { // First, fetch a snippet to populate cache - await snippetManager.getSnippet("test", "python"); - expect(snippetManager["cache"].size).toBe(1); + await snippetManager.getSnippet('test', 'python'); + expect(snippetManager['cache'].size).toBe(1); // Update config with new settings const newConfig = { - baseUrl: "http://new-url.com/snippets", - supportedLanguages: ["typescript"], - exclude: ["**/malformed/**", "**/missing-name/**", "**/new-exclude/**"], + baseUrl: 'http://new-url.com/snippets', + supportedLanguages: ['typescript'], + exclude: ['**/malformed/**', '**/missing-name/**', '**/new-exclude/**'], }; snippetManager.updateConfig(newConfig); // Verify cache is cleared - expect(snippetManager["cache"].size).toBe(0); + expect(snippetManager['cache'].size).toBe(0); // Verify new config is applied - expect(snippetManager["config"].baseUrl).toBe(newConfig.baseUrl); - expect(snippetManager["config"].supportedLanguages).toEqual( - newConfig.supportedLanguages - ); - expect(snippetManager["config"].exclude).toEqual(newConfig.exclude); + expect(snippetManager['config'].baseUrl).toBe(newConfig.baseUrl); + expect(snippetManager['config'].supportedLanguages).toEqual(newConfig.supportedLanguages); + expect(snippetManager['config'].exclude).toEqual(newConfig.exclude); }); - it("Caches snippet results and reuses them", async () => { + it('Caches snippet results and reuses them', async () => { // First call should make a network request - await snippetManager.getSnippet("test", "python"); + await snippetManager.getSnippet('test', 'python'); expect(global.fetch).toHaveBeenCalledTimes(1); // Reset the fetch mock to verify it's not called again vi.clearAllMocks(); // Second call should use cache - const snippet = await snippetManager.getSnippet("test", "python"); + const snippet = await snippetManager.getSnippet('test', 'python'); expect(snippet).toBe("print('Hello, world!')"); expect(global.fetch).not.toHaveBeenCalled(); }); - it("Uses different cache keys for different languages", async () => { + it('Uses different cache keys for different languages', async () => { // Fetch same snippet in different languages - await snippetManager.getSnippet("test", "python"); - await snippetManager.getSnippet("test", "kotlin"); + await snippetManager.getSnippet('test', 'python'); + await snippetManager.getSnippet('test', 'kotlin'); // Should have made two network requests expect(global.fetch).toHaveBeenCalledTimes(2); // Cache should have two entries - expect(snippetManager["cache"].size).toBe(2); + expect(snippetManager['cache'].size).toBe(2); }); }); diff --git a/package/vitest.config.ts b/package/vitest.config.ts index 3e5563f..e4656fd 100644 --- a/package/vitest.config.ts +++ b/package/vitest.config.ts @@ -1,20 +1,20 @@ -import { defineConfig } from "vitest/config"; +import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { globals: true, - environment: "node", + environment: 'node', coverage: { - provider: "v8", - reporter: ["text", "json", "html"], + provider: 'v8', + reporter: ['text', 'json', 'html'], exclude: [ - "node_modules/**", - "dist/**", - "**/*.d.ts", - "test/**", - "**/*.test.ts", - "**/*.config.ts", - "**/types.ts", + 'node_modules/**', + 'dist/**', + '**/*.d.ts', + 'test/**', + '**/*.test.ts', + '**/*.config.ts', + '**/types.ts', ], }, },